Lines Matching refs:trng
58 struct exynos_trng_dev *trng; in exynos_trng_do_read() local
63 trng = (struct exynos_trng_dev *)rng->priv; in exynos_trng_do_read()
65 writel_relaxed(max * 8, trng->mem + EXYNOS_TRNG_FIFO_CTRL); in exynos_trng_do_read()
66 val = readl_poll_timeout(trng->mem + EXYNOS_TRNG_FIFO_CTRL, val, in exynos_trng_do_read()
71 memcpy_fromio(data, trng->mem + EXYNOS_TRNG_FIFO_0, max); in exynos_trng_do_read()
78 struct exynos_trng_dev *trng = (struct exynos_trng_dev *)rng->priv; in exynos_trng_init() local
82 sss_rate = clk_get_rate(trng->clk); in exynos_trng_init()
90 dev_err(trng->dev, "clock divider too large: %d", val); in exynos_trng_init()
94 writel_relaxed(val, trng->mem + EXYNOS_TRNG_CLKDIV); in exynos_trng_init()
98 writel_relaxed(val, trng->mem + EXYNOS_TRNG_CTRL); in exynos_trng_init()
104 writel_relaxed(0, trng->mem + EXYNOS_TRNG_POST_CTRL); in exynos_trng_init()
111 struct exynos_trng_dev *trng; in exynos_trng_probe() local
114 trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL); in exynos_trng_probe()
115 if (!trng) in exynos_trng_probe()
118 trng->rng.name = devm_kstrdup(&pdev->dev, dev_name(&pdev->dev), in exynos_trng_probe()
120 if (!trng->rng.name) in exynos_trng_probe()
123 trng->rng.init = exynos_trng_init; in exynos_trng_probe()
124 trng->rng.read = exynos_trng_do_read; in exynos_trng_probe()
125 trng->rng.priv = (unsigned long) trng; in exynos_trng_probe()
127 platform_set_drvdata(pdev, trng); in exynos_trng_probe()
128 trng->dev = &pdev->dev; in exynos_trng_probe()
130 trng->mem = devm_platform_ioremap_resource(pdev, 0); in exynos_trng_probe()
131 if (IS_ERR(trng->mem)) in exynos_trng_probe()
132 return PTR_ERR(trng->mem); in exynos_trng_probe()
141 trng->clk = devm_clk_get(&pdev->dev, "secss"); in exynos_trng_probe()
142 if (IS_ERR(trng->clk)) { in exynos_trng_probe()
143 ret = PTR_ERR(trng->clk); in exynos_trng_probe()
148 ret = clk_prepare_enable(trng->clk); in exynos_trng_probe()
154 ret = devm_hwrng_register(&pdev->dev, &trng->rng); in exynos_trng_probe()
165 clk_disable_unprepare(trng->clk); in exynos_trng_probe()
178 struct exynos_trng_dev *trng = platform_get_drvdata(pdev); in exynos_trng_remove() local
180 clk_disable_unprepare(trng->clk); in exynos_trng_remove()