Skip to content

Commit eb94396

Browse files
committed
bcm2835-rng: Avoid initialising if already enabled
Avoids the 0x40000 cycles of warmup again if firmware has already used it
1 parent 47caf07 commit eb94396

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎drivers/char/hw_random/bcm2835-rng.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ static int bcm2835_rng_init(struct hwrng *rng)
102102
}
103103

104104
/* set warm-up count & enable */
105-
rng_writel(priv, RNG_WARMUP_COUNT, RNG_STATUS);
106-
rng_writel(priv, RNG_RBGEN, RNG_CTRL);
105+
if (!(rng_readl(priv, RNG_CTRL) & RNG_RBGEN)) {
106+
rng_writel(priv, RNG_WARMUP_COUNT, RNG_STATUS);
107+
rng_writel(priv, RNG_RBGEN, RNG_CTRL);
108+
}
107109

108110
return ret;
109111
}

0 commit comments

Comments
 (0)