2020-06-20 04:45:52

by Horia Geanta

[permalink] [raw]
Subject: [PATCH 0/4] hwrng: add support for i.MX6 rngb

Add support for RNGB found in some i.MX6 SoCs (6SL, 6SLL, 6ULL, 6ULZ),
based on RNGC driver (drivers/char/hw_random/imx-rngc.c).

This driver claims support also for RNGB (besides RNGC),
and is currently used only by i.MX25.

Note:

All the i.MX6 SoCs with RNGB have a DCP (Data Co-Processor)
crypto accelerator.

Several NXP SoC from QorIQ family (P1010, P1023, P4080, P3041, P5020)
also have a RNGB, however it's part of the CAAM
(Cryptograhic Accelerator and Assurance Module) crypto accelerator.
In this case, RNGB is managed in the caam driver
(drivers/crypto/caam/), since it's tightly related to
the caam "job ring" interface.

Horia Geantă (4):
ARM: dts: imx6sl: fix rng node
ARM: dts: imx6sll: add rng
ARM: dts: imx6ull: add rng
hwrng: imx-rngc: enable driver for i.MX6

arch/arm/boot/dts/imx6sl.dtsi | 2 ++
arch/arm/boot/dts/imx6sll.dtsi | 7 +++++++
arch/arm/boot/dts/imx6ull.dtsi | 7 +++++++
drivers/char/hw_random/Kconfig | 2 +-
4 files changed, 17 insertions(+), 1 deletion(-)

--
2.17.1


2020-06-20 04:45:53

by Horia Geanta

[permalink] [raw]
Subject: [PATCH 1/4] ARM: dts: imx6sl: fix rng node

rng DT node was added without a compatible string.

i.MX driver for RNGC (drivers/char/hw_random/imx-rngc.c) also claims
support for RNGB, and is currently used for i.MX25.

Let's used this driver also for RNGB block in i.MX6SL.

Fixes: e29fe21cff96 ("ARM: dts: add device tree source for imx6sl SoC")
Signed-off-by: Horia Geantă <[email protected]>
---
arch/arm/boot/dts/imx6sl.dtsi | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 911d8cf77f2c..1f0f250ee175 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -939,8 +939,10 @@
};

rngb: rngb@21b4000 {
+ compatible = "fsl,imx25-rngb";
reg = <0x021b4000 0x4000>;
interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clks IMX6SL_CLK_DUMMY>;
};

weim: weim@21b8000 {
--
2.17.1

2020-06-20 04:46:03

by Horia Geanta

[permalink] [raw]
Subject: [PATCH 3/4] ARM: dts: imx6ull: add rng

Add node for the RNGB block.

Signed-off-by: Horia Geantă <[email protected]>
---
arch/arm/boot/dts/imx6ull.dtsi | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ull.dtsi b/arch/arm/boot/dts/imx6ull.dtsi
index fcde7f77ae42..70cc098adeee 100644
--- a/arch/arm/boot/dts/imx6ull.dtsi
+++ b/arch/arm/boot/dts/imx6ull.dtsi
@@ -68,6 +68,13 @@
clock-names = "dcp";
};

+ rngb: rng@2284000 {
+ compatible = "fsl,imx25-rngb";
+ reg = <0x02284000 0x4000>;
+ interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clks IMX6UL_CLK_DUMMY>;
+ };
+
iomuxc_snvs: iomuxc-snvs@2290000 {
compatible = "fsl,imx6ull-iomuxc-snvs";
reg = <0x02290000 0x4000>;
--
2.17.1

2020-06-20 04:46:45

by Horia Geanta

[permalink] [raw]
Subject: [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6

i.MX6 SL, SLL, ULL, ULZ SoCs have an RNGB block.

Since imx-rngc driver supports also rngb,
let's enable it for these SoCs too.

Signed-off-by: Horia Geantă <[email protected]>
---
drivers/char/hw_random/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index 0ad17efc96df..53f6a7e4392f 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -245,7 +245,7 @@ config HW_RANDOM_MXC_RNGA
config HW_RANDOM_IMX_RNGC
tristate "Freescale i.MX RNGC Random Number Generator"
depends on HAS_IOMEM && HAVE_CLK
- depends on SOC_IMX25 || COMPILE_TEST
+ depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL || COMPILE_TEST
default HW_RANDOM
help
This driver provides kernel-side support for the Random Number
--
2.17.1

2020-06-20 04:46:57

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH 1/4] ARM: dts: imx6sl: fix rng node

Hi Horia,

On Fri, Jun 19, 2020 at 6:34 PM Horia Geantă <[email protected]> wrote:
>
> rng DT node was added without a compatible string.
>
> i.MX driver for RNGC (drivers/char/hw_random/imx-rngc.c) also claims
> support for RNGB, and is currently used for i.MX25.
>
> Let's used this driver also for RNGB block in i.MX6SL.

"Let's use"

>
> Fixes: e29fe21cff96 ("ARM: dts: add device tree source for imx6sl SoC")
> Signed-off-by: Horia Geantă <[email protected]>
> ---
> arch/arm/boot/dts/imx6sl.dtsi | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
> index 911d8cf77f2c..1f0f250ee175 100644
> --- a/arch/arm/boot/dts/imx6sl.dtsi
> +++ b/arch/arm/boot/dts/imx6sl.dtsi
> @@ -939,8 +939,10 @@
> };
>
> rngb: rngb@21b4000 {
> + compatible = "fsl,imx25-rngb";

Better to use:

compatible = "fsl,imx6sl-rngb","fsl,imx25-rngb";

and document fsl,imx6sl-rngb

2020-06-20 04:47:00

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6

On Fri, Jun 19, 2020 at 6:34 PM Horia Geantă <[email protected]> wrote:
>
> i.MX6 SL, SLL, ULL, ULZ SoCs have an RNGB block.
>
> Since imx-rngc driver supports also rngb,
> let's enable it for these SoCs too.
>
> Signed-off-by: Horia Geantă <[email protected]>
> ---
> drivers/char/hw_random/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
> index 0ad17efc96df..53f6a7e4392f 100644
> --- a/drivers/char/hw_random/Kconfig
> +++ b/drivers/char/hw_random/Kconfig
> @@ -245,7 +245,7 @@ config HW_RANDOM_MXC_RNGA
> config HW_RANDOM_IMX_RNGC
> tristate "Freescale i.MX RNGC Random Number Generator"
> depends on HAS_IOMEM && HAVE_CLK
> - depends on SOC_IMX25 || COMPILE_TEST
> + depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL || COMPILE_TEST

If in the future more SoCs will use this IP, then we will need to keep
extending this list over and over again.

Maybe you could use:

depends on MACH_IMX || COMPILE_TEST



> default HW_RANDOM
> help
> This driver provides kernel-side support for the Random Number
> --
> 2.17.1
>

2020-06-20 04:48:16

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6

On Fri, Jun 19, 2020 at 6:46 PM Fabio Estevam <[email protected]> wrote:

> If in the future more SoCs will use this IP, then we will need to keep
> extending this list over and over again.
>
> Maybe you could use:
>
> depends on MACH_IMX || COMPILE_TEST

MACH_MXC is what I meant ;-)

2020-06-21 12:54:22

by Horia Geanta

[permalink] [raw]
Subject: Re: [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6

On 6/20/2020 12:49 AM, Fabio Estevam wrote:
> On Fri, Jun 19, 2020 at 6:46 PM Fabio Estevam <[email protected]> wrote:
>
>> If in the future more SoCs will use this IP, then we will need to keep
>> extending this list over and over again.
>>
>> Maybe you could use:
>>
>> depends on MACH_IMX || COMPILE_TEST
>
> MACH_MXC is what I meant ;-)
>
Probably ARCH_MXC.

ARCH_MXC was originally the dependency for this driver, until it was changed
to a more specific one by
commit fcdba3c33a4d ("hwrng: imx-rngc - improve dependencies")

I don't think we'll see too many RNGB deployments in the future,
thus the list of SoCs shouldn't change that often.

Horia