mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-18 15:09:53 +00:00
hwrng: mxc-rnga - fix data_present API
Commit45001e9
, which added support for RNGA, ignored the previous commit984e976
, which changed the data_present API. Cc: Matt Mackall <mpm@selenic.com> Cc: Sascha Hauer <kernel@pengutronix.de> Cc: Alan Carvalho de Assis <acassis@gmail.com> Cc: <linux-arm-kernel@lists.infradead.org> Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
398710379f
commit
3621189064
@ -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 */
|
||||
@ -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;
|
||||
int i;
|
||||
|
||||
/* 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;
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user