18 #include <linux/module.h>
20 #include <linux/random.h>
25 #include <linux/slab.h>
32 #define RNG_OUT_REG 0x00
33 #define RNG_STAT_REG 0x04
35 #define RNG_ALARM_REG 0x24
37 #define RNG_CONFIG_REG 0x28
41 #define RNG_REV_REG 0x3c
43 #define RNG_MASK_REG 0x40
47 #define RNG_SYSSTATUS 0x44
71 static int omap_rng_data_present(
struct hwrng *rng,
int wait)
78 for (i = 0; i < 20; i++) {
92 static int omap_rng_data_read(
struct hwrng *rng,
u32 *data)
103 static struct hwrng omap_rng_ops = {
105 .data_present = omap_rng_data_present,
106 .data_read = omap_rng_data_read,
116 dev_err(&pdev->
dev,
"could not allocate memory\n");
120 omap_rng_ops.
priv = (
unsigned long)priv;
137 pm_runtime_get_sync(&pdev->
dev);
143 dev_info(&pdev->
dev,
"OMAP Random Number Generator ver. %02x\n",
152 pm_runtime_disable(&pdev->
dev);
167 pm_runtime_put_sync(&pdev->
dev);
168 pm_runtime_disable(&pdev->
dev);
177 #ifdef CONFIG_PM_SLEEP
179 static int omap_rng_suspend(
struct device *
dev)
184 pm_runtime_put_sync(dev);
189 static int omap_rng_resume(
struct device *
dev)
193 pm_runtime_get_sync(dev);
200 #define OMAP_RNG_PM (&omap_rng_pm)
204 #define OMAP_RNG_PM NULL
217 .probe = omap_rng_probe,
218 .remove =
__exit_p(omap_rng_remove),
221 static int __init omap_rng_init(
void)
226 static void __exit omap_rng_exit(
void)