diff options
Diffstat (limited to 'drivers/char/hw_random/geode-rng.c')
-rw-r--r-- | drivers/char/hw_random/geode-rng.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/char/hw_random/geode-rng.c b/drivers/char/hw_random/geode-rng.c index 8e8658dcd2e3..fed4ef5569f5 100644 --- a/drivers/char/hw_random/geode-rng.c +++ b/drivers/char/hw_random/geode-rng.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/hw_random.h> | 30 | #include <linux/hw_random.h> |
31 | #include <linux/delay.h> | ||
31 | #include <asm/io.h> | 32 | #include <asm/io.h> |
32 | 33 | ||
33 | 34 | ||
@@ -61,11 +62,18 @@ static int geode_rng_data_read(struct hwrng *rng, u32 *data) | |||
61 | return 4; | 62 | return 4; |
62 | } | 63 | } |
63 | 64 | ||
64 | static int geode_rng_data_present(struct hwrng *rng) | 65 | static int geode_rng_data_present(struct hwrng *rng, int wait) |
65 | { | 66 | { |
66 | void __iomem *mem = (void __iomem *)rng->priv; | 67 | void __iomem *mem = (void __iomem *)rng->priv; |
68 | int data, i; | ||
67 | 69 | ||
68 | return !!(readl(mem + GEODE_RNG_STATUS_REG)); | 70 | for (i = 0; i < 20; i++) { |
71 | data = !!(readl(mem + GEODE_RNG_STATUS_REG)); | ||
72 | if (data || !wait) | ||
73 | break; | ||
74 | udelay(10); | ||
75 | } | ||
76 | return data; | ||
69 | } | 77 | } |
70 | 78 | ||
71 | 79 | ||