summaryrefslogtreecommitdiff
path: root/drivers/char/hw_random/imx-rngc.c
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2023-09-12 17:31:17 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2023-09-20 08:15:29 +0300
commitb6c6044b4ba561e3ca2d8a2a815f3091ee7ff33c (patch)
tree099ef1212301ef9cdbae8d1a51e1de85057cbc1b /drivers/char/hw_random/imx-rngc.c
parentdda5b055e4b4d77c53debe559d74a59a9e32d4de (diff)
downloadlinux-b6c6044b4ba561e3ca2d8a2a815f3091ee7ff33c.tar.xz
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." The lowest possible frequency of the rngc peripheral clock is 33.25MHz, the selftest would then take about 872us. 2.5ms should be enough for the selftest timeout. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char/hw_random/imx-rngc.c')
-rw-r--r--drivers/char/hw_random/imx-rngc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index e4b385b01b11..127c292dfbbf 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 2500 /* 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;