0561-bcm2835-rng-Avoid-initialising-if-already-enabled.patch 982 B

1234567891011121314151617181920212223242526
  1. From b7791eea502e0d98ae204750aff2abafc431fb11 Mon Sep 17 00:00:00 2001
  2. From: popcornmix <popcornmix@gmail.com>
  3. Date: Tue, 6 Dec 2016 17:05:39 +0000
  4. Subject: [PATCH] bcm2835-rng: Avoid initialising if already enabled
  5. Avoids the 0x40000 cycles of warmup again if firmware has already used it
  6. ---
  7. drivers/char/hw_random/bcm2835-rng.c | 7 ++++---
  8. 1 file changed, 4 insertions(+), 3 deletions(-)
  9. --- a/drivers/char/hw_random/bcm2835-rng.c
  10. +++ b/drivers/char/hw_random/bcm2835-rng.c
  11. @@ -62,9 +62,10 @@ static int bcm2835_rng_probe(struct plat
  12. bcm2835_rng_ops.priv = (unsigned long)rng_base;
  13. /* set warm-up count & enable */
  14. - __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS);
  15. - __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL);
  16. -
  17. + if (!(__raw_readl(rng_base + RNG_CTRL) & RNG_RBGEN)) {
  18. + __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS);
  19. + __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL);
  20. + }
  21. /* register driver */
  22. err = hwrng_register(&bcm2835_rng_ops);
  23. if (err) {