From patchwork Fri May 19 16:04:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 96486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1351951vqo; Fri, 19 May 2023 09:15:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ57FjOdlWpSyGRlnLUNUt9ugiOCTstaOaNTgDrjdFYBSdefrn+0/+GIYso2ySAYqjqto3fR X-Received: by 2002:a05:6a00:1a4f:b0:646:74ce:a36c with SMTP id h15-20020a056a001a4f00b0064674cea36cmr3898546pfv.8.1684512923618; Fri, 19 May 2023 09:15:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684512923; cv=none; d=google.com; s=arc-20160816; b=FAnhe5kQGhVtRFGMvnzO4vOt3xdBzcB4LnTEHGcQ8L69o/TtrgO0ZxKbKxJII576Xz zHYvDQaopFyT5A3d7IUwsNCk+N/41NwGZCHs7wUbUu9CLdOw8XYKj+6nXY+OnDanB4P3 vKdeJHMjS3G4BKx1LLfgVjnV+mcJzbednpY969dtDvMruKoWjRCqEyIxD0CHWocE+ahI kVrut3s+ap5Q8nPm4+skWOe8HuuV/FHNG7rCe+iOtrGJlHsgyTFDA3KcG2UPzAQLImAu +UPYsao1nQK8r4cN2zJnFBjfIu3T/vjp/7Yz9QRegW95thLTXAQArd8YiAH6dCFwQCbV 5VLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3X/KbCrm7Ku674Hj6AITqyLbyWd77+1V3G/mXM5JuRI=; b=T/tQiVWrjaWpmKhPe708/hEgIekZ4G7Ny3AIJfnzlNjhAStuYEf6bw81mZzHleSTWw 8fiz7sRuSpxE9WjavfK3R6XL6cSxaJe/Irqlj1mHPBiYsifjIetSdUPSCKL+Xw0G7leJ xKb7ykCdZeyJlHsJSCKjJ/4rLi7ImNoMjsjWMAWdcReGTqB2ixdXo5oh0B/7OIQUOBwP ATexu59i2ORmgzLtM3p1lw0x10gEGwIQKxBfX97I3VMZ7ZFFXRTWnpcJHNKSskkBqsCe 6X5zGpHIuqvYNloUIGJpCvPFtAgoElLSJhd/qP4TCHyshYYpyIyNDDTija0q/WMnAdHH AqcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 126-20020a620684000000b0063b88f52220si4080737pfg.144.2023.05.19.09.15.07; Fri, 19 May 2023 09:15:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbjESQFh (ORCPT + 99 others); Fri, 19 May 2023 12:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjESQFe (ORCPT ); Fri, 19 May 2023 12:05:34 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BDECC9; Fri, 19 May 2023 09:05:32 -0700 (PDT) Received: from ipservice-092-217-072-086.092.217.pools.vodafone-ip.de ([92.217.72.86] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1q02bg-0001Ah-Vs; Fri, 19 May 2023 18:05:29 +0200 From: Martin Kaiser To: Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 1/3] hwrng: imx-rngc - simpler check for available random bytes Date: Fri, 19 May 2023 18:04:31 +0200 Message-Id: <20230519160433.287161-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230519160433.287161-1-martin@kaiser.cx> References: <20230427185357.923412-1-martin@kaiser.cx> <20230519160433.287161-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766339822990932299?= X-GMAIL-MSGID: =?utf-8?q?1766339822990932299?= The "level" field in the status register contains the number of random bytes that are available in the FIFO. Use GENMASK to extract this field. We only want to check if level is 0 or if we can read another byte. There's no need for the shift or the level variable. Signed-off-by: Martin Kaiser --- v2: - remove the shift when checking the fifo level field drivers/char/hw_random/imx-rngc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index a1c24148ed31..cf29c323453a 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -17,6 +17,7 @@ #include #include #include +#include #define RNGC_VER_ID 0x0000 #define RNGC_COMMAND 0x0004 @@ -44,8 +45,7 @@ #define RNGC_CTRL_AUTO_SEED 0x00000010 #define RNGC_STATUS_ERROR 0x00010000 -#define RNGC_STATUS_FIFO_LEVEL_MASK 0x00000f00 -#define RNGC_STATUS_FIFO_LEVEL_SHIFT 8 +#define RNGC_STATUS_FIFO_LEVEL_MASK GENMASK(11, 8) #define RNGC_STATUS_SEED_DONE 0x00000020 #define RNGC_STATUS_ST_DONE 0x00000010 @@ -122,7 +122,6 @@ static int imx_rngc_read(struct hwrng *rng, void *data, size_t max, bool wait) { struct imx_rngc *rngc = container_of(rng, struct imx_rngc, rng); unsigned int status; - unsigned int level; int retval = 0; while (max >= sizeof(u32)) { @@ -132,11 +131,7 @@ static int imx_rngc_read(struct hwrng *rng, void *data, size_t max, bool wait) if (status & RNGC_STATUS_ERROR) break; - /* how many random numbers are in FIFO? [0-16] */ - level = (status & RNGC_STATUS_FIFO_LEVEL_MASK) >> - RNGC_STATUS_FIFO_LEVEL_SHIFT; - - if (level) { + if (status & RNGC_STATUS_FIFO_LEVEL_MASK) { /* retrieve a random number from FIFO */ *(u32 *)data = readl(rngc->base + RNGC_FIFO); From patchwork Fri May 19 16:04:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 96489 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1357068vqo; Fri, 19 May 2023 09:22:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7C4jtjLiVbIMVzwOO/6+6aKwDLmurQcSjywxDgltqy7m/GIg31SqCQjQdzVVW6gPBX3gkV X-Received: by 2002:a17:90a:881:b0:253:510e:130a with SMTP id v1-20020a17090a088100b00253510e130amr3325060pjc.19.1684513365662; Fri, 19 May 2023 09:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684513365; cv=none; d=google.com; s=arc-20160816; b=QOwLPdvdfwNpTCEAlZgE8vHxRm/PpR4TFvOqTWXLLG69IEuYRKgwuuElnmDl248VmO j+KzbM6/e1ev1w5fo66DjtjP+51YoZltl/wuy5i4NKIHZ7N70+y1aqVCM1E6+0Yikkzd KRc7521+OPXRVi3FaUKd3Gkh3UKzlWqbUlHk3oJFVmCDNOrZWSKcyyvb4S+t3QuOVmqT QcPYsyKUgf4J9wHTnEoJBdWssC+5Z49jd8Dg9uBbHtNLxAgMxIjivxK/5u3pun3LqGMq jPSJxQUMWX4UlR8LeBD61cBVCC+lbtkbVxV0YmeTM06IDf8SB9A57Tms1KCWLcqNj/kV HLIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QNC6AWEI5h0QalFgl/Ea1sL+Cqur0RjPq13hrvm97pg=; b=LRxvliCtB0KcexUH7xfvv9+zQvJgDzJL7VL2PksT9GwY5s+7Uo0ZLeAG2B5Qd6fqa4 D1nfdgf3WIgQe5pBAdM3OgQd4XadzmeJcjxfWmrrqzqvO5VSjxxCYeaFcKj9Vh65FwMc i6AS7Kh0wAQc/Qa4HTk21yUBIdbjxaiysqonht7xMbngQAnZTZ3vNEVrQzFvAsyZRAmz pXzpU4aOV+VD4s0JZ+sjipTCs4pLwiVNw5WHJUQpKah7OQ+sOUQwuHkgu9Hg+zUtbPVx lpc/ae3SNZQOQIA1dzfbQV0o0CCv6dnHdswsZ7iTJGPc9UhFIAq7bJ8uzljCTumsM9VL roOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a63ad4e000000b0052c9458bc03si3734763pgo.278.2023.05.19.09.22.32; Fri, 19 May 2023 09:22:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229643AbjESQFj (ORCPT + 99 others); Fri, 19 May 2023 12:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjESQFe (ORCPT ); Fri, 19 May 2023 12:05:34 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09CED9E; Fri, 19 May 2023 09:05:33 -0700 (PDT) Received: from ipservice-092-217-072-086.092.217.pools.vodafone-ip.de ([92.217.72.86] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1q02bk-0001Ah-JD; Fri, 19 May 2023 18:05:32 +0200 From: Martin Kaiser To: Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 2/3] hwrng: imx-rngc - use bitfield macros to read rng type Date: Fri, 19 May 2023 18:04:32 +0200 Message-Id: <20230519160433.287161-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230519160433.287161-1-martin@kaiser.cx> References: <20230427185357.923412-1-martin@kaiser.cx> <20230519160433.287161-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764358567427078965?= X-GMAIL-MSGID: =?utf-8?q?1766340286966514637?= Use the mechanism from bitfield.h to read the rng type field in the version_id register. This makes the code a tiny bit simpler. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/imx-rngc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index cf29c323453a..b5f7b91bd13e 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -27,7 +27,7 @@ #define RNGC_FIFO 0x0014 /* the fields in the ver id register */ -#define RNGC_TYPE_SHIFT 28 +#define RNG_TYPE GENMASK(31, 28) #define RNGC_VER_MAJ_SHIFT 8 /* the rng_type field */ @@ -251,7 +251,7 @@ static int imx_rngc_probe(struct platform_device *pdev) return irq; ver_id = readl(rngc->base + RNGC_VER_ID); - rng_type = ver_id >> RNGC_TYPE_SHIFT; + rng_type = FIELD_GET(RNG_TYPE, ver_id); /* * This driver supports only RNGC and RNGB. (There's a different * driver for RNGA.) From patchwork Fri May 19 16:04:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 96490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1357317vqo; Fri, 19 May 2023 09:23:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Ak2ZycnPxsHQLwOcfjc21eSlLHAcujkxYABsoxsj9v3oPjx2jfYN1DYM/LDwjq/d5DfjJ X-Received: by 2002:a05:6a21:9984:b0:105:f8e4:7227 with SMTP id ve4-20020a056a21998400b00105f8e47227mr3071393pzb.33.1684513391335; Fri, 19 May 2023 09:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684513391; cv=none; d=google.com; s=arc-20160816; b=IaNRmnpkd3R7bmI4oI/eqJGCqo8BzYrmWTaYJLpaLuaiiWPMi9vjn0Ey1TSdBdg96A 9v7BDGB6Iq1r/Qo6gugKsfnpXBeWrv7/OTmCpG/6BmTQ7VOjfLjvgL/WiJ5hVo7vZ9ZD cLlzJrouLoDJZJn1f3xT/mGuKxUOebkTLCu090gKNhZarg6iG50Q3uZU0CMTL/qaM2Oe q1C9RTW1PhAN479w2zyv3iTl3nYvu+58Jj+bu76pbQ0pi20AmehRj2FapqJiTX/uH3wZ ONyo3Gu8X+fS+UQ/PdxypQfC4z0k0PkRkmLLn8ngEbRi5oVVQUtKdVHYy7AehFEYvBYV WIDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FRqVZrLGb8716JoPvB3lnzuyxzERdmE97t3wQEyBjgg=; b=oXkXLz4KuunJoSTb5lfv++2lre1gIeYTUpSs+QA8uJXhg9PU/wlQIDbNxKxdRlRQp3 KD3GI6iYLdU0jJwUKue1+NkWlJQa4GSLrIJLTAgNLSDYcr8KKWy65/Qvm6ciApckUtcw hdvZ/SG6nkRvBX9JBUEknJm/3LuIOwol/96xbVVWeI5xkXLfg1oxfeyUC466Y+k5Ti2K vZPPFM8dyGKRJjEYZUUjWShks7/Q++NWaM199dkfCzSm93z9qle6U+RfIby0XgGv3Oup G8kGu6CXIkaz+4jQLngDSwHqr+R6+3ndmJdVd/vz9MhfTbWthxVSFdfWVX+2SY8oHZ9A nJEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s30-20020a63925e000000b005303a66d415si4137575pgn.405.2023.05.19.09.22.59; Fri, 19 May 2023 09:23:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjESQFm (ORCPT + 99 others); Fri, 19 May 2023 12:05:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjESQFh (ORCPT ); Fri, 19 May 2023 12:05:37 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D62A9E; Fri, 19 May 2023 09:05:36 -0700 (PDT) Received: from ipservice-092-217-072-086.092.217.pools.vodafone-ip.de ([92.217.72.86] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1q02bm-0001Ah-Vr; Fri, 19 May 2023 18:05:35 +0200 From: Martin Kaiser To: Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 3/3] hwrng: imx-rngc - use BIT(x) for register bit defines Date: Fri, 19 May 2023 18:04:33 +0200 Message-Id: <20230519160433.287161-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230519160433.287161-1-martin@kaiser.cx> References: <20230427185357.923412-1-martin@kaiser.cx> <20230519160433.287161-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764358606942834353?= X-GMAIL-MSGID: =?utf-8?q?1766340314120824688?= Rewrite the defines for register bits to use BIT(x) instead of writing out the 32-bit number. This makes it easier to compare the code with the register descriptions in the reference manual. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/imx-rngc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index b5f7b91bd13e..9c6988c658e2 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -35,19 +35,19 @@ #define RNGC_TYPE_RNGC 0x2 -#define RNGC_CMD_CLR_ERR 0x00000020 -#define RNGC_CMD_CLR_INT 0x00000010 -#define RNGC_CMD_SEED 0x00000002 -#define RNGC_CMD_SELF_TEST 0x00000001 +#define RNGC_CMD_CLR_ERR BIT(5) +#define RNGC_CMD_CLR_INT BIT(4) +#define RNGC_CMD_SEED BIT(1) +#define RNGC_CMD_SELF_TEST BIT(0) -#define RNGC_CTRL_MASK_ERROR 0x00000040 -#define RNGC_CTRL_MASK_DONE 0x00000020 -#define RNGC_CTRL_AUTO_SEED 0x00000010 +#define RNGC_CTRL_MASK_ERROR BIT(6) +#define RNGC_CTRL_MASK_DONE BIT(5) +#define RNGC_CTRL_AUTO_SEED BIT(4) -#define RNGC_STATUS_ERROR 0x00010000 +#define RNGC_STATUS_ERROR BIT(16) #define RNGC_STATUS_FIFO_LEVEL_MASK GENMASK(11, 8) -#define RNGC_STATUS_SEED_DONE 0x00000020 -#define RNGC_STATUS_ST_DONE 0x00000010 +#define RNGC_STATUS_SEED_DONE BIT(5) +#define RNGC_STATUS_ST_DONE BIT(4) #define RNGC_ERROR_STATUS_STAT_ERR 0x00000008