crypto: hisilicon/trng - add support for HiSTB TRNG
Subsystems (2)
PATCH v5 1/1 crypto: hisilicon/trng - add support for HiSTB TRNG
HiSTB TRNG are found on some HiSilicon STB SoCs.
---
v2: fix typo
v3: add option for post process depth, adjust timeout
v4: do not case to __iomem, as requested
v5: do not use rng->priv at all
drivers/crypto/hisilicon/Kconfig | 7 + drivers/crypto/hisilicon/Makefile | 2 +- drivers/crypto/hisilicon/trng/Makefile | 3 + drivers/crypto/hisilicon/trng/trng-stb.c | 176 +++++++++++++++++++++++ 4 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/hisilicon/trng/trng-stb.c
drivers/crypto/hisilicon/Kconfig +7 -0
@@ -82,3 +82,10 @@ config CRYPTO_DEV_HISI_TRNG select CRYPTO_RNG help Support for HiSilicon TRNG Driver. + +config CRYPTO_DEV_HISTB_TRNG + tristate "Support for HiSTB TRNG Driver" + depends on ARCH_HISI || COMPILE_TEST + select HW_RANDOM + help + Support for HiSTB TRNG Driver.
drivers/crypto/hisilicon/Makefile +1 -1
@@ -5,4 +5,4 @@ obj-$(CONFIG_CRYPTO_DEV_HISI_SEC2) += sec2/ obj-$(CONFIG_CRYPTO_DEV_HISI_QM) += hisi_qm.o hisi_qm-objs = qm.o sgl.o debugfs.o obj-$(CONFIG_CRYPTO_DEV_HISI_ZIP) += zip/ -obj-$(CONFIG_CRYPTO_DEV_HISI_TRNG) += trng/ +obj-y += trng/
drivers/crypto/hisilicon/trng/Makefile +3 -0
@@ -1,2 +1,5 @@ obj-$(CONFIG_CRYPTO_DEV_HISI_TRNG) += hisi-trng-v2.o hisi-trng-v2-objs = trng.o + +obj-$(CONFIG_CRYPTO_DEV_HISTB_TRNG) += histb-trng.o +histb-trng-objs += trng-stb.o
drivers/crypto/hisilicon/trng/trng-stb.c new file +176 -0
176 lines not on this page · raw message
Signature · 1 line
2.39.2
Herbert Xu
maintainerQuoted 8 lines · David Yang
HiSTB TRNG are found on some HiSilicon STB SoCs.
Signed-off-by David Yang <[email protected]>---
v2: fix typo
v3: add option for post process depth, adjust timeout
v4: do not case to__iomem, as requested
v5: do not userng->privat all
Quoted 6 lines
drivers/crypto/hisilicon/Kconfig | 7 + drivers/crypto/hisilicon/Makefile | 2 +- drivers/crypto/hisilicon/trng/Makefile | 3 + drivers/crypto/hisilicon/trng/trng-stb.c | 176 +++++++++++++++++++++++ 4 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/hisilicon/trng/trng-stb.c
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Quoted 17 lines · Herbert Xu <[email protected]> 于2023年4月6日周四 16:53写道:
Quoted 8 lines · David Yang
HiSTB TRNG are found on some HiSilicon STB SoCs.
Signed-off-by David Yang <[email protected]>---
v2: fix typo
v3: add option for post process depth, adjust timeout
v4: do not case to__iomem, as requested
v5: do not userng->privat allQuoted 6 lines
drivers/crypto/hisilicon/Kconfig | 7 + drivers/crypto/hisilicon/Makefile | 2 +- drivers/crypto/hisilicon/trng/Makefile | 3 + drivers/crypto/hisilicon/trng/trng-stb.c | 176 +++++++++++++++++++++++ 4 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/hisilicon/trng/trng-stb.c
Quoted 5 lines
Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Thanks for merging this patch. But after considering your former reply about drivers/char/hw_random , I'm thinking if that is a better place for this driver. If that is the case I'd like to post a new version of patch.
Sorry for late reply.
Herbert Xu
maintainerQuoted 7 lines · Yangfl
Thanks for merging this patch. But after considering your former reply about
drivers/char/hw_random, I'm thinking if that is a better place for this driver. If that is the case I'd like to post a new version of patch.Sorry for late reply.
If you need to move it please send an incremental patch.
Thanks,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Quoted 63 lines · David Yang
HiSTB TRNG are found on some HiSilicon STB SoCs.
Signed-off-by David Yang <[email protected]>---
v2: fix typo
v3: add option for post process depth, adjust timeout
v4: do not case to__iomem, as requested
v5: do not userng->privat alldrivers/crypto/hisilicon/Kconfig | 7 + drivers/crypto/hisilicon/Makefile | 2 +- drivers/crypto/hisilicon/trng/Makefile | 3 + drivers/crypto/hisilicon/trng/trng-stb.c | 176 +++++++++++++++++++++++ 4 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/hisilicon/trng/trng-stb.cdrivers/crypto/hisilicon/Kconfig +7
-0@@ -82,3 +82,10 @@ config CRYPTO_DEV_HISI_TRNG select CRYPTO_RNG help Support for HiSilicon TRNG Driver. + +config CRYPTO_DEV_HISTB_TRNG + tristate "Support for HiSTB TRNG Driver" + depends on ARCH_HISI || COMPILE_TEST + select HW_RANDOM + help + Support for HiSTB TRNG Driver.drivers/crypto/hisilicon/Makefile +1
-1@@ -5,4 +5,4 @@ obj-$(CONFIG_CRYPTO_DEV_HISI_SEC2) += sec2/ obj-$(CONFIG_CRYPTO_DEV_HISI_QM) += hisi_qm.o hisi_qm-objs = qm.o sgl.o debugfs.o obj-$(CONFIG_CRYPTO_DEV_HISI_ZIP) += zip/ -obj-$(CONFIG_CRYPTO_DEV_HISI_TRNG) += trng/ +obj-y += trng/drivers/crypto/hisilicon/trng/Makefile +3
-0@@ -1,2 +1,5 @@ obj-$(CONFIG_CRYPTO_DEV_HISI_TRNG) += hisi-trng-v2.o hisi-trng-v2-objs = trng.o + +obj-$(CONFIG_CRYPTO_DEV_HISTB_TRNG) += histb-trng.o +histb-trng-objs += trng-stb.odrivers/crypto/hisilicon/trng/trng-stb.c new file +7
-0@@ -0,0 +1,176 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* +* Device driver for True RNG in HiSTB SoCs +* +* Copyright (c) 2023 David Yang +*/ +
drivers/crypto/hisilicon/trng/trng-stb.c line 17
Quoted 10 lines
drivers/crypto/hisilicon/trng/trng-stb.c new file +10
-0+#include <crypto/internal/rng.h> +#include <linux/device.h> +#include <linux/err.h> +#include <linux/hw_random.h> +#include <linux/io.h> +#include <linux/iopoll.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/mutex.h> +#include <linux/of_device.h>
You don't need anything from this header...
You need platform_device.h and mod_devicetable.h
[...]
drivers/crypto/hisilicon/trng/trng-stb.c line 159
Quoted 2 lines
drivers/crypto/hisilicon/trng/trng-stb.c new file +2
-0+static const struct of_device_id histb_trng_of_match[] = { + { .compatible ="hisilicon,histb-trng" , },
This binding isn't documented. Please submit a schema.
Rob