[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230824192059.1569591-2-martin@kaiser.cx>
Date: Thu, 24 Aug 2023 21:20:54 +0200
From: Martin Kaiser <martin@...ser.cx>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Alexander Stein <alexander.stein@...tq-group.com>,
linux-crypto@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Martin Kaiser <martin@...ser.cx>
Subject: [PATCH v2 1/6] hwrng: imx-rngc - reasonable timeout for selftest
Set a more reasonable timeout for the rngc selftest.
According to the reference manual, "The self test takes approximately
29,000 cycles to complete." With the rngc peripheral clock running at
66.5 MHz, this would be 436us. Let's use 1.5ms insteaf of 3sec for the
timeout.
Signed-off-by: Martin Kaiser <martin@...ser.cx>
---
v2:
- adjust timeouts before we switch to polling
drivers/char/hw_random/imx-rngc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index e4b385b01b11..6024c923b67d 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -53,6 +53,7 @@
#define RNGC_TIMEOUT 3000 /* 3 sec */
+#define RNGC_SELFTEST_TIMEOUT 1500 /* us */
static bool self_test = true;
module_param(self_test, bool, 0);
@@ -110,7 +111,8 @@ static int imx_rngc_self_test(struct imx_rngc *rngc)
cmd = readl(rngc->base + RNGC_COMMAND);
writel(cmd | RNGC_CMD_SELF_TEST, rngc->base + RNGC_COMMAND);
- ret = wait_for_completion_timeout(&rngc->rng_op_done, msecs_to_jiffies(RNGC_TIMEOUT));
+ ret = wait_for_completion_timeout(&rngc->rng_op_done,
+ usecs_to_jiffies(RNGC_SELFTEST_TIMEOUT));
imx_rngc_irq_mask_clear(rngc);
if (!ret)
return -ETIMEDOUT;
--
2.39.2
Powered by blists - more mailing lists