linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: David Yang <mmyangfl@gmail.com>
Cc: linux-crypto@vger.kernel.org, Weili Qian <qianweili@huawei.com>,
	Zhou Wang <wangzhou1@hisilicon.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5] crypto: hisilicon/trng - add support for HiSTB TRNG
Date: Thu, 20 Apr 2023 07:48:58 -0500	[thread overview]
Message-ID: <20230420124858.GA2645094-robh@kernel.org> (raw)
In-Reply-To: <20230401164448.1393336-1-mmyangfl@gmail.com>

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@gmail.com>
> ---
> 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

      parent reply	other threads:[~2023-04-20 12:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01 16:44 [PATCH v5] crypto: hisilicon/trng - add support for HiSTB TRNG David Yang
2023-04-06  8:53 ` Herbert Xu
2023-04-08 16:06   ` Yangfl
2023-04-09  3:33     ` Herbert Xu
2023-04-20 12:48 ` Rob Herring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230420124858.GA2645094-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmyangfl@gmail.com \
    --cc=qianweili@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).