Searched refs:rngdev (Results 1 - 1 of 1) sorted by relevance

/linux-4.1.27/drivers/char/hw_random/
H A Dtx4939-rng.c67 struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); tx4939_rng_data_present() local
70 if (rngdev->data_avail) tx4939_rng_data_present()
71 return rngdev->data_avail; tx4939_rng_data_present()
74 if (!(read_rng(rngdev->base, TX4939_RNG_RCSR) tx4939_rng_data_present()
76 rngdev->databuf[0] = tx4939_rng_data_present()
77 read_rng(rngdev->base, TX4939_RNG_ROR(0)); tx4939_rng_data_present()
78 rngdev->databuf[1] = tx4939_rng_data_present()
79 read_rng(rngdev->base, TX4939_RNG_ROR(1)); tx4939_rng_data_present()
80 rngdev->databuf[2] = tx4939_rng_data_present()
81 read_rng(rngdev->base, TX4939_RNG_ROR(2)); tx4939_rng_data_present()
82 rngdev->data_avail = tx4939_rng_data_present()
83 sizeof(rngdev->databuf) / sizeof(u32); tx4939_rng_data_present()
86 rngdev->base, TX4939_RNG_RCSR); tx4939_rng_data_present()
95 return rngdev->data_avail; tx4939_rng_data_present()
100 struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); tx4939_rng_data_read() local
102 rngdev->data_avail--; tx4939_rng_data_read()
103 *buffer = *((u32 *)&rngdev->databuf + rngdev->data_avail); tx4939_rng_data_read()
109 struct tx4939_rng *rngdev; tx4939_rng_probe() local
113 rngdev = devm_kzalloc(&dev->dev, sizeof(*rngdev), GFP_KERNEL); tx4939_rng_probe()
114 if (!rngdev) tx4939_rng_probe()
117 rngdev->base = devm_ioremap_resource(&dev->dev, r); tx4939_rng_probe()
118 if (IS_ERR(rngdev->base)) tx4939_rng_probe()
119 return PTR_ERR(rngdev->base); tx4939_rng_probe()
121 rngdev->rng.name = dev_name(&dev->dev); tx4939_rng_probe()
122 rngdev->rng.data_present = tx4939_rng_data_present; tx4939_rng_probe()
123 rngdev->rng.data_read = tx4939_rng_data_read; tx4939_rng_probe()
127 write_rng(TX4939_RNG_RCSR_RST, rngdev->base, TX4939_RNG_RCSR); tx4939_rng_probe()
128 write_rng(0, rngdev->base, TX4939_RNG_RCSR); tx4939_rng_probe()
130 write_rng(TX4939_RNG_RCSR_ST, rngdev->base, TX4939_RNG_RCSR); tx4939_rng_probe()
141 rngdev->data_avail = 0; tx4939_rng_probe()
142 if (!tx4939_rng_data_present(&rngdev->rng, 1)) tx4939_rng_probe()
146 platform_set_drvdata(dev, rngdev); tx4939_rng_probe()
147 return hwrng_register(&rngdev->rng); tx4939_rng_probe()
152 struct tx4939_rng *rngdev = platform_get_drvdata(dev); tx4939_rng_remove() local
154 hwrng_unregister(&rngdev->rng); tx4939_rng_remove()

Completed in 33 milliseconds