[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa9aee7a6cbe4f1320a83db1097a4a486ca1781c.camel@pengutronix.de>
Date: Fri, 21 Jun 2024 13:41:00 +0200
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Daniel Golle <daniel@...rotopia.org>, Aurelien Jarno
<aurelien@...el32.net>, Olivia Mackall <olivia@...enic.com>, Herbert Xu
<herbert@...dor.apana.org.au>, Rob Herring <robh@...nel.org>, Krzysztof
Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Heiko
Stuebner <heiko@...ech.de>, Uwe Kleine-König
<ukleinek@...ian.org>, Sebastian Reichel
<sebastian.reichel@...labora.com>, Anand Moon <linux.amoon@...il.com>,
Dragan Simic <dsimic@...jaro.org>, Sascha Hauer <s.hauer@...gutronix.de>,
Martin Kaiser <martin@...ser.cx>, Ard Biesheuvel <ardb@...nel.org>,
linux-crypto@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-rockchip@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/3] hwrng: add Rockchip SoC hwrng driver
Hi,
On Fr, 2024-06-21 at 02:25 +0100, Daniel Golle wrote:
> From: Aurelien Jarno <aurelien@...el32.net>
>
> Rockchip SoCs used to have a random number generator as part of their
> crypto device, and support for it has to be added to the corresponding
> driver. However newer Rockchip SoCs like the RK356x have an independent
> True Random Number Generator device. This patch adds a driver for it,
> greatly inspired from the downstream driver.
>
> The TRNG device does not seem to have a signal conditionner and the FIPS
> 140-2 test returns a lot of failures. They can be reduced by increasing
> RK_RNG_SAMPLE_CNT, in a tradeoff between quality and speed. This value
> has been adjusted to get ~90% of successes and the quality value has
> been set accordingly.
>
> Signed-off-by: Aurelien Jarno <aurelien@...el32.net>
> [daniel@...rotpia.org: code style fixes]
> Signed-off-by: Daniel Golle <daniel@...rotopia.org>
> ---
> MAINTAINERS | 1 +
> drivers/char/hw_random/Kconfig | 14 ++
> drivers/char/hw_random/Makefile | 1 +
> drivers/char/hw_random/rockchip-rng.c | 229 ++++++++++++++++++++++++++
> 4 files changed, 245 insertions(+)
> create mode 100644 drivers/char/hw_random/rockchip-rng.c
>
[...]
> diff --git a/drivers/char/hw_random/rockchip-rng.c b/drivers/char/hw_random/rockchip-rng.c
> new file mode 100644
> index 000000000000..6070abb73847
> --- /dev/null
> +++ b/drivers/char/hw_random/rockchip-rng.c
> @@ -0,0 +1,229 @@
[...]
>
> +static int rk_rng_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct rk_rng *rk_rng;
> + int ret;
> +
> + rk_rng = devm_kzalloc(dev, sizeof(*rk_rng), GFP_KERNEL);
> + if (!rk_rng)
> + return -ENOMEM;
> +
> + rk_rng->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(rk_rng->base))
> + return PTR_ERR(rk_rng->base);
> +
> + rk_rng->clk_num = devm_clk_bulk_get_all(dev, &rk_rng->clk_bulks);
> + if (rk_rng->clk_num < 0)
> + return dev_err_probe(dev, rk_rng->clk_num,
> + "Failed to get clks property\n");
> +
> + rk_rng->rst = devm_reset_control_array_get(&pdev->dev, false, false);
Please use devm_reset_control_array_get_exclusive() instead.
regards
Philipp
Powered by blists - more mailing lists