linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] hwrng: add support for i.MX6 rngb
@ 2020-06-19 21:33 Horia Geantă
  2020-06-19 21:33 ` [PATCH 1/4] ARM: dts: imx6sl: fix rng node Horia Geantă
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Horia Geantă @ 2020-06-19 21:33 UTC (permalink / raw)
  To: Rob Herring, Shawn Guo, Sascha Hauer, Matt Mackall, Herbert Xu
  Cc: Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	devicetree, linux-arm-kernel, Arnd Bergmann, Greg Kroah-Hartman,
	Martin Kaiser, Franck Lenormand, Iuliana Prodan,
	Silvano Di Ninno, linux-crypto, linux-kernel

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] ARM: dts: imx6sl: fix rng node
  2020-06-19 21:33 [PATCH 0/4] hwrng: add support for i.MX6 rngb Horia Geantă
@ 2020-06-19 21:33 ` Horia Geantă
  2020-06-19 21:44   ` Fabio Estevam
  2020-06-19 21:33 ` [PATCH 2/4] ARM: dts: imx6sll: add rng Horia Geantă
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Horia Geantă @ 2020-06-19 21:33 UTC (permalink / raw)
  To: Rob Herring, Shawn Guo, Sascha Hauer, Matt Mackall, Herbert Xu
  Cc: Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	devicetree, linux-arm-kernel, Arnd Bergmann, Greg Kroah-Hartman,
	Martin Kaiser, Franck Lenormand, Iuliana Prodan,
	Silvano Di Ninno, linux-crypto, linux-kernel

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ă <horia.geanta@nxp.com>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] ARM: dts: imx6sll: add rng
  2020-06-19 21:33 [PATCH 0/4] hwrng: add support for i.MX6 rngb Horia Geantă
  2020-06-19 21:33 ` [PATCH 1/4] ARM: dts: imx6sl: fix rng node Horia Geantă
@ 2020-06-19 21:33 ` Horia Geantă
  2020-06-19 21:33 ` [PATCH 3/4] ARM: dts: imx6ull: " Horia Geantă
  2020-06-19 21:33 ` [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6 Horia Geantă
  3 siblings, 0 replies; 9+ messages in thread
From: Horia Geantă @ 2020-06-19 21:33 UTC (permalink / raw)
  To: Rob Herring, Shawn Guo, Sascha Hauer, Matt Mackall, Herbert Xu
  Cc: Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	devicetree, linux-arm-kernel, Arnd Bergmann, Greg Kroah-Hartman,
	Martin Kaiser, Franck Lenormand, Iuliana Prodan,
	Silvano Di Ninno, linux-crypto, linux-kernel

Add node for the RNGB block.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
---
 arch/arm/boot/dts/imx6sll.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi
index edd3abb9a9f1..e634cd45086b 100644
--- a/arch/arm/boot/dts/imx6sll.dtsi
+++ b/arch/arm/boot/dts/imx6sll.dtsi
@@ -786,6 +786,13 @@
 				clocks = <&clks IMX6SLL_CLK_MMDC_P0_IPG>;
 			};
 
+			rngb: rng@21b4000 {
+				compatible = "fsl,imx25-rngb";
+				reg = <0x021b4000 0x4000>;
+				interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clks IMX6SLL_CLK_DUMMY>;
+			};
+
 			ocotp: ocotp-ctrl@21bc000 {
 				#address-cells = <1>;
 				#size-cells = <1>;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] ARM: dts: imx6ull: add rng
  2020-06-19 21:33 [PATCH 0/4] hwrng: add support for i.MX6 rngb Horia Geantă
  2020-06-19 21:33 ` [PATCH 1/4] ARM: dts: imx6sl: fix rng node Horia Geantă
  2020-06-19 21:33 ` [PATCH 2/4] ARM: dts: imx6sll: add rng Horia Geantă
@ 2020-06-19 21:33 ` Horia Geantă
  2020-06-19 21:33 ` [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6 Horia Geantă
  3 siblings, 0 replies; 9+ messages in thread
From: Horia Geantă @ 2020-06-19 21:33 UTC (permalink / raw)
  To: Rob Herring, Shawn Guo, Sascha Hauer, Matt Mackall, Herbert Xu
  Cc: Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	devicetree, linux-arm-kernel, Arnd Bergmann, Greg Kroah-Hartman,
	Martin Kaiser, Franck Lenormand, Iuliana Prodan,
	Silvano Di Ninno, linux-crypto, linux-kernel

Add node for the RNGB block.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6
  2020-06-19 21:33 [PATCH 0/4] hwrng: add support for i.MX6 rngb Horia Geantă
                   ` (2 preceding siblings ...)
  2020-06-19 21:33 ` [PATCH 3/4] ARM: dts: imx6ull: " Horia Geantă
@ 2020-06-19 21:33 ` Horia Geantă
  2020-06-19 21:46   ` Fabio Estevam
  3 siblings, 1 reply; 9+ messages in thread
From: Horia Geantă @ 2020-06-19 21:33 UTC (permalink / raw)
  To: Rob Herring, Shawn Guo, Sascha Hauer, Matt Mackall, Herbert Xu
  Cc: Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	devicetree, linux-arm-kernel, Arnd Bergmann, Greg Kroah-Hartman,
	Martin Kaiser, Franck Lenormand, Iuliana Prodan,
	Silvano Di Ninno, linux-crypto, linux-kernel

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ă <horia.geanta@nxp.com>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] ARM: dts: imx6sl: fix rng node
  2020-06-19 21:33 ` [PATCH 1/4] ARM: dts: imx6sl: fix rng node Horia Geantă
@ 2020-06-19 21:44   ` Fabio Estevam
  0 siblings, 0 replies; 9+ messages in thread
From: Fabio Estevam @ 2020-06-19 21:44 UTC (permalink / raw)
  To: Horia Geantă
  Cc: Rob Herring, Shawn Guo, Sascha Hauer, Matt Mackall, Herbert Xu,
	Pengutronix Kernel Team, NXP Linux Team,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Arnd Bergmann, Greg Kroah-Hartman, Martin Kaiser,
	Franck Lenormand, Iuliana Prodan, Silvano Di Ninno,
	open list:HARDWARE RANDOM NUMBER GENERATOR CORE, linux-kernel

Hi Horia,

On Fri, Jun 19, 2020 at 6:34 PM Horia Geantă <horia.geanta@nxp.com> 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ă <horia.geanta@nxp.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6
  2020-06-19 21:33 ` [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6 Horia Geantă
@ 2020-06-19 21:46   ` Fabio Estevam
  2020-06-19 21:49     ` Fabio Estevam
  0 siblings, 1 reply; 9+ messages in thread
From: Fabio Estevam @ 2020-06-19 21:46 UTC (permalink / raw)
  To: Horia Geantă
  Cc: Rob Herring, Shawn Guo, Sascha Hauer, Matt Mackall, Herbert Xu,
	Pengutronix Kernel Team, NXP Linux Team,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Arnd Bergmann, Greg Kroah-Hartman, Martin Kaiser,
	Franck Lenormand, Iuliana Prodan, Silvano Di Ninno,
	open list:HARDWARE RANDOM NUMBER GENERATOR CORE, linux-kernel

On Fri, Jun 19, 2020 at 6:34 PM Horia Geantă <horia.geanta@nxp.com> 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ă <horia.geanta@nxp.com>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6
  2020-06-19 21:46   ` Fabio Estevam
@ 2020-06-19 21:49     ` Fabio Estevam
  2020-06-21 12:53       ` Horia Geantă
  0 siblings, 1 reply; 9+ messages in thread
From: Fabio Estevam @ 2020-06-19 21:49 UTC (permalink / raw)
  To: Horia Geantă
  Cc: Rob Herring, Shawn Guo, Sascha Hauer, Matt Mackall, Herbert Xu,
	Pengutronix Kernel Team, NXP Linux Team,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Arnd Bergmann, Greg Kroah-Hartman, Martin Kaiser,
	Franck Lenormand, Iuliana Prodan, Silvano Di Ninno,
	open list:HARDWARE RANDOM NUMBER GENERATOR CORE, linux-kernel

On Fri, Jun 19, 2020 at 6:46 PM Fabio Estevam <festevam@gmail.com> 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 ;-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6
  2020-06-19 21:49     ` Fabio Estevam
@ 2020-06-21 12:53       ` Horia Geantă
  0 siblings, 0 replies; 9+ messages in thread
From: Horia Geantă @ 2020-06-21 12:53 UTC (permalink / raw)
  To: Fabio Estevam, Uwe Kleine-König
  Cc: Rob Herring, Shawn Guo, Sascha Hauer, Matt Mackall, Herbert Xu,
	Pengutronix Kernel Team, dl-linux-imx,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Arnd Bergmann, Greg Kroah-Hartman, Martin Kaiser,
	Franck Lenormand, Iuliana Prodan, Silvano Di Ninno,
	open list:HARDWARE RANDOM NUMBER GENERATOR CORE, linux-kernel

On 6/20/2020 12:49 AM, Fabio Estevam wrote:
> On Fri, Jun 19, 2020 at 6:46 PM Fabio Estevam <festevam@gmail.com> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-21 12:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19 21:33 [PATCH 0/4] hwrng: add support for i.MX6 rngb Horia Geantă
2020-06-19 21:33 ` [PATCH 1/4] ARM: dts: imx6sl: fix rng node Horia Geantă
2020-06-19 21:44   ` Fabio Estevam
2020-06-19 21:33 ` [PATCH 2/4] ARM: dts: imx6sll: add rng Horia Geantă
2020-06-19 21:33 ` [PATCH 3/4] ARM: dts: imx6ull: " Horia Geantă
2020-06-19 21:33 ` [PATCH 4/4] hwrng: imx-rngc: enable driver for i.MX6 Horia Geantă
2020-06-19 21:46   ` Fabio Estevam
2020-06-19 21:49     ` Fabio Estevam
2020-06-21 12:53       ` Horia Geantă

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).