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

/linux-4.4.14/drivers/char/hw_random/
H A Dmxc-rnga.c62 struct mxc_rng { struct
72 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); mxc_rnga_data_present() local
76 int level = (__raw_readl(mxc_rng->mem + RNGA_STATUS) & mxc_rnga_data_present()
89 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); mxc_rnga_data_read() local
92 *data = __raw_readl(mxc_rng->mem + RNGA_OUTPUT_FIFO); mxc_rnga_data_read()
95 err = __raw_readl(mxc_rng->mem + RNGA_STATUS) & RNGA_STATUS_ERROR_INT; mxc_rnga_data_read()
99 dev_dbg(mxc_rng->dev, "Error while reading random number!\n"); mxc_rnga_data_read()
100 ctrl = __raw_readl(mxc_rng->mem + RNGA_CONTROL); mxc_rnga_data_read()
102 mxc_rng->mem + RNGA_CONTROL); mxc_rnga_data_read()
111 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); mxc_rnga_init() local
114 ctrl = __raw_readl(mxc_rng->mem + RNGA_CONTROL); mxc_rnga_init()
115 __raw_writel(ctrl & ~RNGA_CONTROL_SLEEP, mxc_rng->mem + RNGA_CONTROL); mxc_rnga_init()
118 osc = __raw_readl(mxc_rng->mem + RNGA_STATUS); mxc_rnga_init()
120 dev_err(mxc_rng->dev, "RNGA Oscillator is dead!\n"); mxc_rnga_init()
125 ctrl = __raw_readl(mxc_rng->mem + RNGA_CONTROL); mxc_rnga_init()
126 __raw_writel(ctrl | RNGA_CONTROL_GO, mxc_rng->mem + RNGA_CONTROL); mxc_rnga_init()
134 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); mxc_rnga_cleanup() local
136 ctrl = __raw_readl(mxc_rng->mem + RNGA_CONTROL); mxc_rnga_cleanup()
139 __raw_writel(ctrl & ~RNGA_CONTROL_GO, mxc_rng->mem + RNGA_CONTROL); mxc_rnga_cleanup()
146 struct mxc_rng *mxc_rng; mxc_rnga_probe() local
148 mxc_rng = devm_kzalloc(&pdev->dev, sizeof(*mxc_rng), GFP_KERNEL); mxc_rnga_probe()
149 if (!mxc_rng) mxc_rnga_probe()
152 mxc_rng->dev = &pdev->dev; mxc_rnga_probe()
153 mxc_rng->rng.name = "mxc-rnga"; mxc_rnga_probe()
154 mxc_rng->rng.init = mxc_rnga_init; mxc_rnga_probe()
155 mxc_rng->rng.cleanup = mxc_rnga_cleanup, mxc_rnga_probe()
156 mxc_rng->rng.data_present = mxc_rnga_data_present, mxc_rnga_probe()
157 mxc_rng->rng.data_read = mxc_rnga_data_read, mxc_rnga_probe()
159 mxc_rng->clk = devm_clk_get(&pdev->dev, NULL); mxc_rnga_probe()
160 if (IS_ERR(mxc_rng->clk)) { mxc_rnga_probe()
162 return PTR_ERR(mxc_rng->clk); mxc_rnga_probe()
165 err = clk_prepare_enable(mxc_rng->clk); mxc_rnga_probe()
170 mxc_rng->mem = devm_ioremap_resource(&pdev->dev, res); mxc_rnga_probe()
171 if (IS_ERR(mxc_rng->mem)) { mxc_rnga_probe()
172 err = PTR_ERR(mxc_rng->mem); mxc_rnga_probe()
176 err = hwrng_register(&mxc_rng->rng); mxc_rnga_probe()
185 clk_disable_unprepare(mxc_rng->clk); mxc_rnga_probe()
191 struct mxc_rng *mxc_rng = platform_get_drvdata(pdev); mxc_rnga_remove() local
193 hwrng_unregister(&mxc_rng->rng); mxc_rnga_remove()
195 clk_disable_unprepare(mxc_rng->clk); mxc_rnga_remove()

Completed in 42 milliseconds