/drivers/crypto/ |
D | exynos-rng.c | 66 struct exynos_rng_dev *rng; member 87 static u32 exynos_rng_readl(struct exynos_rng_dev *rng, u32 offset) in exynos_rng_readl() argument 89 return readl_relaxed(rng->mem + offset); in exynos_rng_readl() 92 static void exynos_rng_writel(struct exynos_rng_dev *rng, u32 val, u32 offset) in exynos_rng_writel() argument 94 writel_relaxed(val, rng->mem + offset); in exynos_rng_writel() 97 static int exynos_rng_set_seed(struct exynos_rng_dev *rng, in exynos_rng_set_seed() argument 117 exynos_rng_writel(rng, val, EXYNOS_RNG_SEED(seed_reg)); in exynos_rng_set_seed() 120 val = exynos_rng_readl(rng, EXYNOS_RNG_STATUS); in exynos_rng_set_seed() 122 dev_warn(rng->dev, "Seed setting not finished\n"); in exynos_rng_set_seed() 126 rng->last_seeding = jiffies; in exynos_rng_set_seed() [all …]
|
D | qcom-rng.c | 38 struct qcom_rng *rng; member 43 static int qcom_rng_read(struct qcom_rng *rng, u8 *data, unsigned int max) in qcom_rng_read() argument 51 ret = readl_poll_timeout(rng->base + PRNG_STATUS, val, in qcom_rng_read() 57 val = readl_relaxed(rng->base + PRNG_DATA_OUT); in qcom_rng_read() 80 struct qcom_rng *rng = ctx->rng; in qcom_rng_generate() local 83 ret = clk_prepare_enable(rng->clk); in qcom_rng_generate() 87 mutex_lock(&rng->lock); in qcom_rng_generate() 89 ret = qcom_rng_read(rng, dstn, dlen); in qcom_rng_generate() 91 mutex_unlock(&rng->lock); in qcom_rng_generate() 92 clk_disable_unprepare(rng->clk); in qcom_rng_generate() [all …]
|
D | atmel-sha204a.c | 25 struct hwrng *rng = areq; in atmel_sha204a_rng_done() local 32 rng->priv = (unsigned long)work_data; in atmel_sha204a_rng_done() 36 static int atmel_sha204a_rng_read_nonblocking(struct hwrng *rng, void *data, in atmel_sha204a_rng_read_nonblocking() argument 42 i2c_priv = container_of(rng, struct atmel_i2c_client_priv, hwrng); in atmel_sha204a_rng_read_nonblocking() 48 if (rng->priv) { in atmel_sha204a_rng_read_nonblocking() 49 work_data = (struct atmel_i2c_work_data *)rng->priv; in atmel_sha204a_rng_read_nonblocking() 52 rng->priv = 0; in atmel_sha204a_rng_read_nonblocking() 65 atmel_i2c_enqueue(work_data, atmel_sha204a_rng_done, rng); in atmel_sha204a_rng_read_nonblocking() 70 static int atmel_sha204a_rng_read(struct hwrng *rng, void *data, size_t max, in atmel_sha204a_rng_read() argument 78 return atmel_sha204a_rng_read_nonblocking(rng, data, max); in atmel_sha204a_rng_read() [all …]
|
/drivers/char/hw_random/ |
D | core.c | 57 static int hwrng_init(struct hwrng *rng); 60 static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size, 68 static void add_early_randomness(struct hwrng *rng) in add_early_randomness() argument 74 bytes_read = rng_get_data(rng, rng_buffer, size, 0); in add_early_randomness() 82 struct hwrng *rng = container_of(kref, struct hwrng, ref); in cleanup_rng() local 84 if (rng->cleanup) in cleanup_rng() 85 rng->cleanup(rng); in cleanup_rng() 87 complete(&rng->cleanup_done); in cleanup_rng() 90 static int set_current_rng(struct hwrng *rng) in set_current_rng() argument 96 err = hwrng_init(rng); in set_current_rng() [all …]
|
D | Makefile | 6 obj-$(CONFIG_HW_RANDOM) += rng-core.o 7 rng-core-y := core.o 8 obj-$(CONFIG_HW_RANDOM_TIMERIOMEM) += timeriomem-rng.o 9 obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o 10 obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o 11 obj-$(CONFIG_HW_RANDOM_ATMEL) += atmel-rng.o 12 obj-$(CONFIG_HW_RANDOM_BA431) += ba431-rng.o 13 obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o 14 obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o 15 n2-rng-y := n2-drv.o n2-asm.o [all …]
|
D | cavium-rng-vf.c | 82 static int check_rng_health(struct cavium_rng *rng) in check_rng_health() argument 90 if (!rng->pf_regbase) in check_rng_health() 93 status = readq(rng->pf_regbase + HEALTH_STATUS_REG); in check_rng_health() 95 dev_err(&rng->pdev->dev, "HWRNG: Startup health test failed\n"); in check_rng_health() 110 cur_err = (cycles * 1000000000) / rng->clock_rate; /* In nanosec */ in check_rng_health() 116 rng->prev_error = 0; in check_rng_health() 117 rng->prev_time = 0; in check_rng_health() 121 if (rng->prev_error) { in check_rng_health() 125 time_elapsed = (cur_time - rng->prev_time) * 10; in check_rng_health() 126 time_elapsed += rng->prev_error; in check_rng_health() [all …]
|
D | hisi-rng.c | 23 #define to_hisi_rng(p) container_of(p, struct hisi_rng, rng) 31 struct hwrng rng; member 34 static int hisi_rng_init(struct hwrng *rng) in hisi_rng_init() argument 36 struct hisi_rng *hrng = to_hisi_rng(rng); in hisi_rng_init() 57 static void hisi_rng_cleanup(struct hwrng *rng) in hisi_rng_cleanup() argument 59 struct hisi_rng *hrng = to_hisi_rng(rng); in hisi_rng_cleanup() 64 static int hisi_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in hisi_rng_read() argument 66 struct hisi_rng *hrng = to_hisi_rng(rng); in hisi_rng_read() 75 struct hisi_rng *rng; in hisi_rng_probe() local 78 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in hisi_rng_probe() [all …]
|
D | mtk-rng.c | 33 #define to_mtk_rng(p) container_of(p, struct mtk_rng, rng) 38 struct hwrng rng; member 41 static int mtk_rng_init(struct hwrng *rng) in mtk_rng_init() argument 43 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_init() 58 static void mtk_rng_cleanup(struct hwrng *rng) in mtk_rng_cleanup() argument 60 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_cleanup() 70 static bool mtk_rng_wait_ready(struct hwrng *rng, bool wait) in mtk_rng_wait_ready() argument 72 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_wait_ready() 83 static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in mtk_rng_read() argument 85 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_read() [all …]
|
D | octeon-rng.c | 28 static int octeon_rng_init(struct hwrng *rng) in octeon_rng_init() argument 31 struct octeon_rng *p = container_of(rng, struct octeon_rng, ops); in octeon_rng_init() 40 static void octeon_rng_cleanup(struct hwrng *rng) in octeon_rng_cleanup() argument 43 struct octeon_rng *p = container_of(rng, struct octeon_rng, ops); in octeon_rng_cleanup() 50 static int octeon_rng_data_read(struct hwrng *rng, u32 *data) in octeon_rng_data_read() argument 52 struct octeon_rng *p = container_of(rng, struct octeon_rng, ops); in octeon_rng_data_read() 62 struct octeon_rng *rng; in octeon_rng_probe() local 71 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in octeon_rng_probe() 72 if (!rng) in octeon_rng_probe() 84 rng->control_status = devm_ioremap(&pdev->dev, in octeon_rng_probe() [all …]
|
D | stm32-rng.c | 31 struct hwrng rng; member 38 static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) in stm32_rng_read() argument 41 container_of(rng, struct stm32_rng_private, rng); in stm32_rng_read() 45 pm_runtime_get_sync((struct device *) priv->rng.priv); in stm32_rng_read() 57 dev_err((struct device *)priv->rng.priv, in stm32_rng_read() 76 pm_runtime_mark_last_busy((struct device *) priv->rng.priv); in stm32_rng_read() 77 pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv); in stm32_rng_read() 82 static int stm32_rng_init(struct hwrng *rng) in stm32_rng_init() argument 85 container_of(rng, struct stm32_rng_private, rng); in stm32_rng_init() 104 static void stm32_rng_cleanup(struct hwrng *rng) in stm32_rng_cleanup() argument [all …]
|
D | npcm-rng.c | 29 #define to_npcm_rng(p) container_of(p, struct npcm_rng, rng) 33 struct hwrng rng; member 36 static int npcm_rng_init(struct hwrng *rng) in npcm_rng_init() argument 38 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_init() 46 static void npcm_rng_cleanup(struct hwrng *rng) in npcm_rng_cleanup() argument 48 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_cleanup() 53 static int npcm_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in npcm_rng_read() argument 55 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_read() 59 pm_runtime_get_sync((struct device *)priv->rng.priv); in npcm_rng_read() 81 pm_runtime_mark_last_busy((struct device *)priv->rng.priv); in npcm_rng_read() [all …]
|
D | mxc-rnga.c | 56 struct hwrng rng; member 61 static int mxc_rnga_data_present(struct hwrng *rng, int wait) in mxc_rnga_data_present() argument 64 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_data_present() 77 static int mxc_rnga_data_read(struct hwrng *rng, u32 * data) in mxc_rnga_data_read() argument 81 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_data_read() 100 static int mxc_rnga_init(struct hwrng *rng) in mxc_rnga_init() argument 103 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_init() 123 static void mxc_rnga_cleanup(struct hwrng *rng) in mxc_rnga_cleanup() argument 126 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_cleanup() 144 mxc_rng->rng.name = "mxc-rnga"; in mxc_rnga_probe() [all …]
|
D | ingenic-rng.c | 36 struct hwrng rng; member 39 static int ingenic_rng_init(struct hwrng *rng) in ingenic_rng_init() argument 41 struct ingenic_rng *priv = container_of(rng, struct ingenic_rng, rng); in ingenic_rng_init() 48 static void ingenic_rng_cleanup(struct hwrng *rng) in ingenic_rng_cleanup() argument 50 struct ingenic_rng *priv = container_of(rng, struct ingenic_rng, rng); in ingenic_rng_cleanup() 55 static int ingenic_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in ingenic_rng_read() argument 57 struct ingenic_rng *priv = container_of(rng, struct ingenic_rng, rng); in ingenic_rng_read() 100 priv->rng.name = pdev->name; in ingenic_rng_probe() 101 priv->rng.init = ingenic_rng_init; in ingenic_rng_probe() 102 priv->rng.cleanup = ingenic_rng_cleanup; in ingenic_rng_probe() [all …]
|
D | cavium-rng.c | 26 struct cavium_rng_pf *rng; in cavium_rng_probe() local 29 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in cavium_rng_probe() 30 if (!rng) in cavium_rng_probe() 34 rng->control_status = pcim_iomap(pdev, 0, 0); in cavium_rng_probe() 35 if (!rng->control_status) { in cavium_rng_probe() 43 rng->control_status); in cavium_rng_probe() 45 pci_set_drvdata(pdev, rng); in cavium_rng_probe() 51 writeq(0, rng->control_status); in cavium_rng_probe() 64 struct cavium_rng_pf *rng; in cavium_rng_remove() local 66 rng = pci_get_drvdata(pdev); in cavium_rng_remove() [all …]
|
D | ingenic-trng.c | 35 struct hwrng rng; member 38 static int ingenic_trng_init(struct hwrng *rng) in ingenic_trng_init() argument 40 struct ingenic_trng *trng = container_of(rng, struct ingenic_trng, rng); in ingenic_trng_init() 50 static void ingenic_trng_cleanup(struct hwrng *rng) in ingenic_trng_cleanup() argument 52 struct ingenic_trng *trng = container_of(rng, struct ingenic_trng, rng); in ingenic_trng_cleanup() 60 static int ingenic_trng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in ingenic_trng_read() argument 62 struct ingenic_trng *trng = container_of(rng, struct ingenic_trng, rng); in ingenic_trng_read() 108 trng->rng.name = pdev->name; in ingenic_trng_probe() 109 trng->rng.init = ingenic_trng_init; in ingenic_trng_probe() 110 trng->rng.cleanup = ingenic_trng_cleanup; in ingenic_trng_probe() [all …]
|
D | iproc-rng200.c | 50 struct hwrng rng; member 54 #define to_rng_priv(rng) container_of(rng, struct iproc_rng200_dev, rng) argument 98 static int iproc_rng200_read(struct hwrng *rng, void *buf, size_t max, in iproc_rng200_read() argument 101 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_read() 159 static int iproc_rng200_init(struct hwrng *rng) in iproc_rng200_init() argument 161 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_init() 168 static void iproc_rng200_cleanup(struct hwrng *rng) in iproc_rng200_cleanup() argument 170 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_cleanup() 194 priv->rng.name = "iproc-rng200"; in iproc_rng200_probe() 195 priv->rng.read = iproc_rng200_read; in iproc_rng200_probe() [all …]
|
D | ba431-rng.c | 42 struct hwrng rng; member 115 static int ba431_trng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in ba431_trng_read() argument 117 struct ba431_trng *ba431 = container_of(rng, struct ba431_trng, rng); in ba431_trng_read() 155 static void ba431_trng_cleanup(struct hwrng *rng) in ba431_trng_cleanup() argument 157 struct ba431_trng *ba431 = container_of(rng, struct ba431_trng, rng); in ba431_trng_cleanup() 163 static int ba431_trng_init(struct hwrng *rng) in ba431_trng_init() argument 165 struct ba431_trng *ba431 = container_of(rng, struct ba431_trng, rng); in ba431_trng_init() 187 ba431->rng.name = pdev->name; in ba431_trng_probe() 188 ba431->rng.init = ba431_trng_init; in ba431_trng_probe() 189 ba431->rng.cleanup = ba431_trng_cleanup; in ba431_trng_probe() [all …]
|
D | bcm2835-rng.c | 32 struct hwrng rng; member 39 static inline struct bcm2835_rng_priv *to_rng_priv(struct hwrng *rng) in to_rng_priv() argument 41 return container_of(rng, struct bcm2835_rng_priv, rng); in to_rng_priv() 64 static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max, in bcm2835_rng_read() argument 67 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_read() 87 static int bcm2835_rng_init(struct hwrng *rng) in bcm2835_rng_init() argument 89 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_init() 115 static void bcm2835_rng_cleanup(struct hwrng *rng) in bcm2835_rng_cleanup() argument 117 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_cleanup() 169 priv->rng.name = pdev->name; in bcm2835_rng_probe() [all …]
|
D | tx4939-rng.c | 29 struct hwrng rng; member 65 static int tx4939_rng_data_present(struct hwrng *rng, int wait) in tx4939_rng_data_present() argument 67 struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); in tx4939_rng_data_present() 98 static int tx4939_rng_data_read(struct hwrng *rng, u32 *buffer) in tx4939_rng_data_read() argument 100 struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); in tx4939_rng_data_read() 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() 140 if (!tx4939_rng_data_present(&rngdev->rng, 1)) in tx4939_rng_probe() 145 return devm_hwrng_register(&dev->dev, &rngdev->rng); in tx4939_rng_probe()
|
D | imx-rngc.c | 64 struct hwrng rng; member 121 static int imx_rngc_read(struct hwrng *rng, void *data, size_t max, bool wait) in imx_rngc_read() argument 123 struct imx_rngc *rngc = container_of(rng, struct imx_rngc, rng); in imx_rngc_read() 172 static int imx_rngc_init(struct hwrng *rng) in imx_rngc_init() argument 174 struct imx_rngc *rngc = container_of(rng, struct imx_rngc, rng); in imx_rngc_init() 223 static void imx_rngc_cleanup(struct hwrng *rng) in imx_rngc_cleanup() argument 225 struct imx_rngc *rngc = container_of(rng, struct imx_rngc, rng); in imx_rngc_cleanup() 273 rngc->rng.name = pdev->name; in imx_rngc_probe() 274 rngc->rng.init = imx_rngc_init; in imx_rngc_probe() 275 rngc->rng.read = imx_rngc_read; in imx_rngc_probe() [all …]
|
D | pic32-rng.c | 38 struct hwrng rng; member 48 static int pic32_rng_read(struct hwrng *rng, void *buf, size_t max, in pic32_rng_read() argument 51 struct pic32_rng *priv = container_of(rng, struct pic32_rng, rng); in pic32_rng_read() 92 priv->rng.name = pdev->name; in pic32_rng_probe() 93 priv->rng.read = pic32_rng_read; in pic32_rng_probe() 95 ret = devm_hwrng_register(&pdev->dev, &priv->rng); in pic32_rng_probe() 106 struct pic32_rng *rng = platform_get_drvdata(pdev); in pic32_rng_remove() local 108 writel(0, rng->base + RNGCON); in pic32_rng_remove()
|
D | exynos-trng.c | 52 struct hwrng rng; member 55 static int exynos_trng_do_read(struct hwrng *rng, void *data, size_t max, in exynos_trng_do_read() argument 63 trng = (struct exynos_trng_dev *)rng->priv; in exynos_trng_do_read() 76 static int exynos_trng_init(struct hwrng *rng) in exynos_trng_init() argument 78 struct exynos_trng_dev *trng = (struct exynos_trng_dev *)rng->priv; in exynos_trng_init() 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() [all …]
|
D | ks-sa-rng.c | 85 struct hwrng rng; member 113 static int ks_sa_rng_init(struct hwrng *rng) in ks_sa_rng_init() argument 116 struct device *dev = (struct device *)rng->priv; in ks_sa_rng_init() 154 static void ks_sa_rng_cleanup(struct hwrng *rng) in ks_sa_rng_cleanup() argument 156 struct device *dev = (struct device *)rng->priv; in ks_sa_rng_cleanup() 165 static int ks_sa_rng_data_read(struct hwrng *rng, u32 *data) in ks_sa_rng_data_read() argument 167 struct device *dev = (struct device *)rng->priv; in ks_sa_rng_data_read() 180 static int ks_sa_rng_data_present(struct hwrng *rng, int wait) in ks_sa_rng_data_present() argument 182 struct device *dev = (struct device *)rng->priv; in ks_sa_rng_data_present() 221 ks_sa_rng->rng = (struct hwrng) { in ks_sa_rng_probe() [all …]
|
/drivers/crypto/amcc/ |
D | crypto4xx_trng.c | 28 static int ppc4xx_trng_data_present(struct hwrng *rng, int wait) in ppc4xx_trng_data_present() argument 30 struct crypto4xx_device *dev = (void *)rng->priv; in ppc4xx_trng_data_present() 45 static int ppc4xx_trng_data_read(struct hwrng *rng, u32 *data) in ppc4xx_trng_data_read() argument 47 struct crypto4xx_device *dev = (void *)rng->priv; in ppc4xx_trng_data_read() 75 struct hwrng *rng = NULL; in ppc4xx_trng_probe() local 90 rng = kzalloc(sizeof(*rng), GFP_KERNEL); in ppc4xx_trng_probe() 91 if (!rng) in ppc4xx_trng_probe() 94 rng->name = KBUILD_MODNAME; in ppc4xx_trng_probe() 95 rng->data_present = ppc4xx_trng_data_present; in ppc4xx_trng_probe() 96 rng->data_read = ppc4xx_trng_data_read; in ppc4xx_trng_probe() [all …]
|
/drivers/crypto/caam/ |
D | caamrng.c | 36 struct hwrng rng; member 145 static int caam_read(struct hwrng *rng, void *dst, size_t max, bool wait) in caam_read() argument 147 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_read() 164 static void caam_cleanup(struct hwrng *rng) in caam_cleanup() argument 166 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_cleanup() 173 static int caam_init(struct hwrng *rng) in caam_init() argument 175 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_init() 230 rng_inst = rd_reg32(&priv->ctrl->vreg.rng) & CHA_VER_NUM_MASK; in caam_rng_init() 244 ctx->rng.name = "rng-caam"; in caam_rng_init() 245 ctx->rng.init = caam_init; in caam_rng_init() [all …]
|