Lines Matching refs:rngdev
67 struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); in tx4939_rng_data_present() local
70 if (rngdev->data_avail) in tx4939_rng_data_present()
71 return rngdev->data_avail; in tx4939_rng_data_present()
74 if (!(read_rng(rngdev->base, TX4939_RNG_RCSR) in tx4939_rng_data_present()
76 rngdev->databuf[0] = in tx4939_rng_data_present()
77 read_rng(rngdev->base, TX4939_RNG_ROR(0)); in tx4939_rng_data_present()
78 rngdev->databuf[1] = in tx4939_rng_data_present()
79 read_rng(rngdev->base, TX4939_RNG_ROR(1)); in tx4939_rng_data_present()
80 rngdev->databuf[2] = in tx4939_rng_data_present()
81 read_rng(rngdev->base, TX4939_RNG_ROR(2)); in tx4939_rng_data_present()
82 rngdev->data_avail = in tx4939_rng_data_present()
83 sizeof(rngdev->databuf) / sizeof(u32); in tx4939_rng_data_present()
86 rngdev->base, TX4939_RNG_RCSR); in tx4939_rng_data_present()
95 return rngdev->data_avail; in tx4939_rng_data_present()
100 struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); in tx4939_rng_data_read() local
102 rngdev->data_avail--; in tx4939_rng_data_read()
103 *buffer = *((u32 *)&rngdev->databuf + rngdev->data_avail); in tx4939_rng_data_read()
109 struct tx4939_rng *rngdev; in tx4939_rng_probe() local
112 rngdev = devm_kzalloc(&dev->dev, sizeof(*rngdev), GFP_KERNEL); in tx4939_rng_probe()
113 if (!rngdev) in tx4939_rng_probe()
115 rngdev->base = devm_platform_ioremap_resource(dev, 0); in tx4939_rng_probe()
116 if (IS_ERR(rngdev->base)) in tx4939_rng_probe()
117 return PTR_ERR(rngdev->base); in tx4939_rng_probe()
119 rngdev->rng.name = dev_name(&dev->dev); in tx4939_rng_probe()
120 rngdev->rng.data_present = tx4939_rng_data_present; in tx4939_rng_probe()
121 rngdev->rng.data_read = tx4939_rng_data_read; in tx4939_rng_probe()
125 write_rng(TX4939_RNG_RCSR_RST, rngdev->base, TX4939_RNG_RCSR); in tx4939_rng_probe()
126 write_rng(0, rngdev->base, TX4939_RNG_RCSR); in tx4939_rng_probe()
128 write_rng(TX4939_RNG_RCSR_ST, rngdev->base, TX4939_RNG_RCSR); in tx4939_rng_probe()
139 rngdev->data_avail = 0; in tx4939_rng_probe()
140 if (!tx4939_rng_data_present(&rngdev->rng, 1)) in tx4939_rng_probe()
144 platform_set_drvdata(dev, rngdev); in tx4939_rng_probe()
145 return devm_hwrng_register(&dev->dev, &rngdev->rng); in tx4939_rng_probe()