On Sun, Apr 02, 2023 at 12:44:40AM +0800, David Yang wrote: > HiSTB TRNG are found on some HiSilicon STB SoCs. > > Signed-off-by: David Yang <mmyangfl@xxxxxxxxx> > --- > 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 > > diff --git a/drivers/crypto/hisilicon/Kconfig b/drivers/crypto/hisilicon/Kconfig > index 4137a8bf131f..e8690c223584 100644 > --- a/drivers/crypto/hisilicon/Kconfig > +++ b/drivers/crypto/hisilicon/Kconfig > @@ -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. > diff --git a/drivers/crypto/hisilicon/Makefile b/drivers/crypto/hisilicon/Makefile > index 8595a5a5d228..fc51e0edec69 100644 > --- a/drivers/crypto/hisilicon/Makefile > +++ b/drivers/crypto/hisilicon/Makefile > @@ -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/ > diff --git a/drivers/crypto/hisilicon/trng/Makefile b/drivers/crypto/hisilicon/trng/Makefile > index d909079f351c..cf20b057c66b 100644 > --- a/drivers/crypto/hisilicon/trng/Makefile > +++ b/drivers/crypto/hisilicon/trng/Makefile > @@ -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 > diff --git a/drivers/crypto/hisilicon/trng/trng-stb.c b/drivers/crypto/hisilicon/trng/trng-stb.c > new file mode 100644 > index 000000000000..29200a7d3d81 > --- /dev/null > +++ b/drivers/crypto/hisilicon/trng/trng-stb.c > @@ -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 > + */ > + > +#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 [...] > +static const struct of_device_id histb_trng_of_match[] = { > + { .compatible = "hisilicon,histb-trng", }, This binding isn't documented. Please submit a schema. Rob