Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318345
b: refs/heads/master
c: 3621189
h: refs/heads/master
i:
  318343: 225438d
v: v3
  • Loading branch information
Benoît Thébaudeau authored and Herbert Xu committed Jun 27, 2012
1 parent e8f5bdc commit 0f0d7c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 398710379f516012c52d2ae396a9ba919bd6a7ab
refs/heads/master: 3621189064301a5fbb5d06ca17d966a026f4e501
21 changes: 13 additions & 8 deletions trunk/drivers/char/hw_random/mxc-rnga.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <linux/hw_random.h>
#include <linux/delay.h>
#include <linux/io.h>

/* RNGA Registers */
Expand Down Expand Up @@ -60,16 +61,20 @@

static struct platform_device *rng_dev;

static int mxc_rnga_data_present(struct hwrng *rng)
static int mxc_rnga_data_present(struct hwrng *rng, int wait)
{
int level;
void __iomem *rng_base = (void __iomem *)rng->priv;

/* how many random numbers is in FIFO? [0-16] */
level = ((__raw_readl(rng_base + RNGA_STATUS) &
RNGA_STATUS_LEVEL_MASK) >> 8);

return level > 0 ? 1 : 0;
int i;

for (i = 0; i < 20; i++) {
/* how many random numbers are in FIFO? [0-16] */
int level = (__raw_readl(rng_base + RNGA_STATUS) &
RNGA_STATUS_LEVEL_MASK) >> 8;
if (level || !wait)
return !!level;
udelay(10);
}
return 0;
}

static int mxc_rnga_data_read(struct hwrng *rng, u32 * data)
Expand Down

0 comments on commit 0f0d7c0

Please sign in to comment.