10 #include <linux/module.h>
11 #include <linux/kernel.h>
19 #define TX4939_RNG_RCSR 0x00000000
20 #define TX4939_RNG_ROR(n) (0x00000018 + (n) * 8)
22 #define TX4939_RNG_RCSR_INTE 0x00000008
23 #define TX4939_RNG_RCSR_RST 0x00000004
24 #define TX4939_RNG_RCSR_FIN 0x00000002
25 #define TX4939_RNG_RCSR_ST 0x00000001
34 static void rng_io_start(
void)
47 static void rng_io_end(
void)
56 return ____raw_readq(base + offset);
61 return ____raw_writeq(val, base + offset);
64 static int tx4939_rng_data_present(
struct hwrng *rng,
int wait)
71 for (i = 0; i < 20; i++) {
84 write_rng(TX4939_RNG_RCSR_ST,
122 rngdev->
rng.name = dev_name(&dev->
dev);
123 rngdev->
rng.data_present = tx4939_rng_data_present;
124 rngdev->
rng.data_read = tx4939_rng_data_read;
141 for (i = 0; i < 2; i++) {
143 if (!tx4939_rng_data_present(&rngdev->
rng, 1))
147 platform_set_drvdata(dev, rngdev);
153 struct tx4939_rng *rngdev = platform_get_drvdata(dev);
156 platform_set_drvdata(dev,
NULL);
162 .name =
"tx4939-rng",
165 .remove = tx4939_rng_remove,
168 static int __init tx4939rng_init(
void)
173 static void __exit tx4939rng_exit(
void)