Skip to contentSkip to conversation

crypto: hisilicon/trng - add support for HiSTB TRNG

PATCH Superseded David Yang 2 participants 2 messages Mar 21, 2023 – Mar 31, 2023

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

David Yang

author
#0 lore raw

PATCH v2 1/1 crypto: hisilicon/trng - add support for HiSTB TRNG

HiSTB TRNG are found on some HiSilicon STB SoCs.

---
v2: fix typo

 drivers/crypto/hisilicon/Kconfig         |   7 ++
 drivers/crypto/hisilicon/Makefile        |   2 +-
 drivers/crypto/hisilicon/trng/Makefile   |   3 +
 drivers/crypto/hisilicon/trng/trng-stb.c | 127 +++++++++++++++++++++++
 4 files changed, 138 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/hisilicon/trng/trng-stb.c
drivers/crypto/hisilicon/Kconfig +7 -0
index 4137a8bf1..e8690c223 100644
@@ -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
index 8595a5a5d..fc51e0ede 100644
@@ -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
index d909079f3..cf20b057c 100644
@@ -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 +127 -0

127 lines not on this page · raw message

Signature · 1 line
2.39.2
maintainer
#1 lore raw

drivers/crypto/hisilicon/trng/trng-stb.c line 25

Quoted 4 lines · David Yang
drivers/crypto/hisilicon/trng/trng-stb.c new file +3 -0
+static int histb_trng_wait(struct hwrng *rng)
+{
+	void __iomem *base = (void __iomem *) rng->priv;

You should never need to cast something to __iomem.

Please copy what the meson driver does, that is the right way.

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