Skip to contentSkip to conversation

m68k: coldfire: Add RNG support for MCF54418

PATCH In review Jean-Michel Hautbois 6 participants 17 messages Nov 26, 2025 – Oct 15

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v4 cover m68k: coldfire: Add RNG support for MCF54418

This series adds support for the MCF54418 hardware random number generator (RNGB).

The MCF54418 contains an RNGB hardware block compatible with the imx-rngc driver. This series enables its use by:
- Adding platform device registration for the RNG hardware
- Enabling the clock at platform initialization
- Making the imx-rngc driver compatible with Coldfire's always-on clock model using devm_clk_get_optional()

Testing on DLC Next board shows:
- Hardware RNG throughput: 26 MB/s
- FIPS 140-2 quality: 0.2% failure rate (rng-tools)
- Boot time improvement: CRNG initialization 7 seconds faster

---
Changes in v4:
- Postpone const qualifiers for now
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Depend on COLDFIRE is enough
- Split the clock change in a dedicated commit
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Split const qualifier changes into a separate patch as suggested by Frank Li
- Mark all resource arrays (including RNG) as const in device.c
- No functional changes to RNG implementation

---
Jean-Michel Hautbois (2):
hwrng: imx-rngc: Use optional clock
m68k: coldfire: Add RNG support for MCF54418

 arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++
 arch/m68k/coldfire/m5441x.c       |  2 +-
 arch/m68k/include/asm/m5441xsim.h |  9 +++++++++
 drivers/char/hw_random/Kconfig    |  3 ++-
 drivers/char/hw_random/imx-rngc.c |  9 ++++++++-
 5 files changed, 48 insertions(+), 3 deletions(-)

---
base-commit: ac3fd01e4c1efce8f2c054cdeb2ddd2fc0fb150d
change-id: 20251107-b4-m5441x-add-rng-support-0fdb8d40210a

Best regards,

Signature · 1 line
Jean-Michel Hautbois <[email protected]>
#1 lore raw

PATCH v4 1/2 hwrng: imx-rngc: Use optional clock

Change devm_clk_get() to devm_clk_get_optional() to support platforms where the RNG clock is always enabled and not exposed via the clock framework (such as ColdFire MCF54418).

---
 drivers/char/hw_random/imx-rngc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/imx-rngc.c +1 -1
index 241664a9b5d9..d6a847e48339 100644
@@ -259,7 +259,7 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
 	if (IS_ERR(rngc->base))
 		return PTR_ERR(rngc->base);
 
-	rngc->clk = devm_clk_get(&pdev->dev, NULL);
+	rngc->clk = devm_clk_get_optional(&pdev->dev, NULL);
 	if (IS_ERR(rngc->clk))
 		return dev_err_probe(&pdev->dev, PTR_ERR(rngc->clk), "Cannot get rng_clk\n");
 
Signature · 1 line
2.39.5
#2 lore raw

Re: [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock

Thus wrote Jean-Michel Hautbois via B4 Relay ([email protected]):

Quoted 17 lines

From: Jean-Michel Hautbois <[email protected]>

Change devm_clk_get() to devm_clk_get_optional() to support platforms where the RNG clock is always enabled and not exposed via the clock framework (such as ColdFire MCF54418).

---
 drivers/char/hw_random/imx-rngc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/imx-rngc.c +0 -0
index 241664a9b5d9..d6a847e48339 100644

drivers/char/hw_random/imx-rngc.c static int __init imx_rngc_probe(struct platform_device *pdev) · line 264

Quoted 7 lines
drivers/char/hw_random/imx-rngc.c +1 -1
@@ -259,7 +259,7 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
 	if (IS_ERR(rngc->base))
 		return PTR_ERR(rngc->base);
 
-	rngc->clk = devm_clk_get(&pdev->dev, NULL);
+	rngc->clk = devm_clk_get_optional(&pdev->dev, NULL);
 	if (IS_ERR(rngc->clk))
 		return dev_err_probe(&pdev->dev, PTR_ERR(rngc->clk), "Cannot get rng_clk\n");

The clock is not optional on a standard imx25 system. If it's missing in the device tree, the rngb will not work and we should not load the driver.

Should we call devm_clk_get or devm_clk_get_optional, depending on the detected device?

Best regards,
Martin

#3 lore raw

Re: [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock

Hi Martin,

Quoted 22 lines · Martin Kaiser

Thus wrote Jean-Michel Hautbois via B4 Relay ([email protected]):

Quoted 19 lines

From: Jean-Michel Hautbois <[email protected]>

Change devm_clk_get() to devm_clk_get_optional() to support platforms where the RNG clock is always enabled and not exposed via the clock framework (such as ColdFire MCF54418).

---
 drivers/char/hw_random/imx-rngc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/imx-rngc.c +0 -0
index 241664a9b5d9..d6a847e48339 100644
@@ -259,7 +259,7 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
      if (IS_ERR(rngc->base))
              return PTR_ERR(rngc->base);
Quoted 7 lines

drivers/char/hw_random/imx-rngc.c static int __init imx_rngc_probe(struct platform_device *pdev) · line 264

Quoted 4 lines
drivers/char/hw_random/imx-rngc.c +1 -1
-     rngc->clk = devm_clk_get(&pdev->dev, NULL);
+     rngc->clk = devm_clk_get_optional(&pdev->dev, NULL);
      if (IS_ERR(rngc->clk))
              return dev_err_probe(&pdev->dev, PTR_ERR(rngc->clk), "Cannot get rng_clk\n");

The clock is not optional on a standard imx25 system. If it's missing in the device tree, the rngb will not work and we should not load the driver.

As the clocks property is marked required in Documentation/devicetree/bindings/rng/imx-rng.yaml, "make dtbs_check" should flag a missing clock.

Quoted 2 lines

Should we call devm_clk_get or devm_clk_get_optional, depending on the detected device?

That can quickly lead to complex code. Nowadays it is fine to rely on "make dtbs_check" for some part of the validation.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Reviewed-by
#4 lore raw

Re: [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock

Hi Geert,

Thus wrote Geert Uytterhoeven ([email protected]):

Quoted 37 lines

Hi Martin,

Quoted 22 lines · Martin Kaiser

Thus wrote Jean-Michel Hautbois via B4 Relay ([email protected]):

Quoted 19 lines

From: Jean-Michel Hautbois <[email protected]>

Change devm_clk_get() to devm_clk_get_optional() to support platforms where the RNG clock is always enabled and not exposed via the clock framework (such as ColdFire MCF54418).

---
 drivers/char/hw_random/imx-rngc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/imx-rngc.c +0 -0
index 241664a9b5d9..d6a847e48339 100644
@@ -259,7 +259,7 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
      if (IS_ERR(rngc->base))
              return PTR_ERR(rngc->base);
Quoted 7 lines

drivers/char/hw_random/imx-rngc.c static int __init imx_rngc_probe(struct platform_device *pdev) · line 264

Quoted 4 lines
drivers/char/hw_random/imx-rngc.c +1 -1
-     rngc->clk = devm_clk_get(&pdev->dev, NULL);
+     rngc->clk = devm_clk_get_optional(&pdev->dev, NULL);
      if (IS_ERR(rngc->clk))
              return dev_err_probe(&pdev->dev, PTR_ERR(rngc->clk), "Cannot get rng_clk\n");

The clock is not optional on a standard imx25 system. If it's missing in the device tree, the rngb will not work and we should not load the driver.

As the clocks property is marked required in Documentation/devicetree/bindings/rng/imx-rng.yaml, "make dtbs_check" should flag a missing clock.

Quoted 5 lines
Quoted 2 lines

Should we call devm_clk_get or devm_clk_get_optional, depending on the detected device?

That can quickly lead to complex code. Nowadays it is fine to rely on "make dtbs_check" for some part of the validation.

ok, understood. With this clarification, I'm happy with the patch.

Thanks,
Martin

maintainer Acked-by on v4 1/2
#5 lore raw

Re: [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock

In reply to Jean-Michel Hautbois
Quoted 11 lines · On Wed, Nov 26, 2025 at 08:08:09AM +0100, Jean-Michel Hautbois via B4 Relay…

From: Jean-Michel Hautbois <[email protected]>

Change devm_clk_get() to devm_clk_get_optional() to support platforms where the RNG clock is always enabled and not exposed via the clock framework (such as ColdFire MCF54418).

---
 drivers/char/hw_random/imx-rngc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#6 lore raw

Re: [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock

In reply to Jean-Michel Hautbois
Quoted 11 lines · On Wed, Nov 26, 2025 at 08:08:09AM +0100, Jean-Michel Hautbois via B4 Relay…

From: Jean-Michel Hautbois <[email protected]>

Change devm_clk_get() to devm_clk_get_optional() to support platforms where the RNG clock is always enabled and not exposed via the clock framework (such as ColdFire MCF54418).

---
 drivers/char/hw_random/imx-rngc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#7 lore raw

PATCH v4 2/2 m68k: coldfire: Add RNG support for MCF54418

In reply to Jean-Michel Hautbois

Add support for the hardware Random Number Generator (RNGB) found on MCF54418 ColdFire processors with clock enabled at platform initialization.

The RNGB block is compatible with the imx-rngc driver.

---
 arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++
 arch/m68k/coldfire/m5441x.c       |  2 +-
 arch/m68k/include/asm/m5441xsim.h |  9 +++++++++
 drivers/char/hw_random/Kconfig    |  3 ++-
 drivers/char/hw_random/imx-rngc.c |  7 +++++++
 5 files changed, 47 insertions(+), 2 deletions(-)
arch/m68k/coldfire/device.c +28 -0
index b6958ec2a220..9d8f844e319a 100644
@@ -622,6 +622,31 @@ static struct platform_device mcf_flexcan0 = {
 };
 #endif /* MCFFLEXCAN_SIZE */
 
+#ifdef MCF_RNG_BASE
+/*
+ * Random Number Generator (RNG) - only on MCF54418
+ */
+static struct resource mcf_rng_resource[] = {
+	{
+		.start = MCF_RNG_BASE,
+		.end   = MCF_RNG_BASE + MCF_RNG_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.start = MCF_IRQ_RNG,
+		.end   = MCF_IRQ_RNG,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device mcf_rng = {
+	.name           = "imx-rngc",
+	.id             = -1,
+	.num_resources  = ARRAY_SIZE(mcf_rng_resource),
+	.resource       = mcf_rng_resource,
+};
+#endif /* MCF_RNG_BASE */
+
 static struct platform_device *mcf_devices[] __initdata = {
 	&mcf_uart,
 #ifdef MCFFEC_BASE0
@@ -660,6 +685,9 @@ static struct platform_device *mcf_devices[] __initdata = {
 #ifdef MCFFLEXCAN_SIZE
 	&mcf_flexcan0,
 #endif
+#ifdef MCF_RNG_BASE
+	&mcf_rng,
+#endif
 };
 
 /*
arch/m68k/coldfire/m5441x.c +1 -1
index 7a25cfc7ac07..ab5b00637237 100644
@@ -158,6 +158,7 @@ static struct clk * const enable_clks[] __initconst = {
 	&__clk_0_33, /* pit.1 */
 	&__clk_0_37, /* eport */
 	&__clk_0_48, /* pll */
+	&__clk_0_49, /* rng */
 	&__clk_0_51, /* esdhc */
 
 	&__clk_1_36, /* CCM/reset module/Power management */
@@ -179,7 +180,6 @@ static struct clk * const disable_clks[] __initconst = {
 	&__clk_0_44, /* usb otg */
 	&__clk_0_45, /* usb host */
 	&__clk_0_47, /* ssi.0 */
-	&__clk_0_49, /* rng */
 	&__clk_0_50, /* ssi.1 */
 	&__clk_0_53, /* enet-fec */
 	&__clk_0_54, /* enet-fec */
arch/m68k/include/asm/m5441xsim.h +9 -0
index f48cf63bd782..dd64cdfcad3e 100644
@@ -198,6 +198,15 @@
 #define MCFRTC_SIZE		(0xfc0a8840 - 0xfc0a8000)
 #define MCF_IRQ_RTC		(MCFINT2_VECBASE + MCFINT2_RTC)
 
+/*
+ *  Random Number Generator (RNG) Module.
+ *  Note: Only present in MCF54418, not in MCF54410/54415/54417
+ */
+#define MCF_RNG_BASE		0xfc0c4000
+#define MCF_RNG_SIZE		0x1c
+#define MCFINT2_RNG		28
+#define MCF_IRQ_RNG		(MCFINT2_VECBASE + MCFINT2_RNG)
+
 /*
  *  GPIO Module.
  */
drivers/char/hw_random/Kconfig +2 -1
index 492a2a61a65b..2f301e43db84 100644
@@ -270,12 +270,13 @@ config HW_RANDOM_MXC_RNGA
 config HW_RANDOM_IMX_RNGC
 	tristate "Freescale i.MX RNGC Random Number Generator"
 	depends on HAS_IOMEM
-	depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL || COMPILE_TEST
+	depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL || COLDFIRE || COMPILE_TEST
 	default HW_RANDOM
 	help
 	  This driver provides kernel-side support for the Random Number
 	  Generator Version C hardware found on some Freescale i.MX
 	  processors. Version B is also supported by this driver.
+	  Also supports RNGB on Freescale MCF54418 (Coldfire V4e).
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called imx-rngc.
drivers/char/hw_random/imx-rngc.c +7 -0
index d6a847e48339..44f20a05de0a 100644
@@ -353,12 +353,19 @@ static const struct of_device_id imx_rngc_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, imx_rngc_dt_ids);
 
+static const struct platform_device_id imx_rngc_devtype[] = {
+	{ .name = "imx-rngc" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, imx_rngc_devtype);
+
 static struct platform_driver imx_rngc_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.pm = pm_ptr(&imx_rngc_pm_ops),
 		.of_match_table = imx_rngc_dt_ids,
 	},
+	.id_table = imx_rngc_devtype,
 };
 
 module_platform_driver_probe(imx_rngc_driver, imx_rngc_probe);
Signature · 1 line
2.39.5
maintainer Acked-by on v4 2/2
#8 lore raw

Hi Jean-Michel,

Quoted 10 lines · On 26/11/25 17:08, Jean-Michel Hautbois via B4 Relay wrote:

From: Jean-Michel Hautbois <[email protected]>

Add support for the hardware Random Number Generator (RNGB) found on MCF54418 ColdFire processors with clock enabled at platform initialization.

The RNGB block is compatible with the imx-rngc driver.

Quoted 7 lines
---
  arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++
  arch/m68k/coldfire/m5441x.c       |  2 +-
  arch/m68k/include/asm/m5441xsim.h |  9 +++++++++
  drivers/char/hw_random/Kconfig    |  3 ++-
  drivers/char/hw_random/imx-rngc.c |  7 +++++++
  5 files changed, 47 insertions(+), 2 deletions(-)

I am happy with the ColdFire arch parts, so from me:

I don't mind taking this commit via the m68knommu git tree if the hw_rng maintainers are ok with that. Otherwise if you break out the arch/m68k parts I can apply those on their own.

Regards
Greg

Quoted 130 lines
arch/m68k/coldfire/device.c +28 -0
index b6958ec2a220..9d8f844e319a 100644
@@ -622,6 +622,31 @@ static struct platform_device mcf_flexcan0 = {
  };
  #endif /* MCFFLEXCAN_SIZE */
 
+#ifdef MCF_RNG_BASE
+/*
+ * Random Number Generator (RNG) - only on MCF54418
+ */
+static struct resource mcf_rng_resource[] = {
+	{
+		.start = MCF_RNG_BASE,
+		.end   = MCF_RNG_BASE + MCF_RNG_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.start = MCF_IRQ_RNG,
+		.end   = MCF_IRQ_RNG,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device mcf_rng = {
+	.name           = "imx-rngc",
+	.id             = -1,
+	.num_resources  = ARRAY_SIZE(mcf_rng_resource),
+	.resource       = mcf_rng_resource,
+};
+#endif /* MCF_RNG_BASE */
+
  static struct platform_device *mcf_devices[] __initdata = {
  	&mcf_uart,
  #ifdef MCFFEC_BASE0
@@ -660,6 +685,9 @@ static struct platform_device *mcf_devices[] __initdata = {
  #ifdef MCFFLEXCAN_SIZE
  	&mcf_flexcan0,
  #endif
+#ifdef MCF_RNG_BASE
+	&mcf_rng,
+#endif
  };
 
  /*
arch/m68k/coldfire/m5441x.c +1 -1
index 7a25cfc7ac07..ab5b00637237 100644
@@ -158,6 +158,7 @@ static struct clk * const enable_clks[] __initconst = {
  	&__clk_0_33, /* pit.1 */
  	&__clk_0_37, /* eport */
  	&__clk_0_48, /* pll */
+	&__clk_0_49, /* rng */
  	&__clk_0_51, /* esdhc */
 
  	&__clk_1_36, /* CCM/reset module/Power management */
@@ -179,7 +180,6 @@ static struct clk * const disable_clks[] __initconst = {
  	&__clk_0_44, /* usb otg */
  	&__clk_0_45, /* usb host */
  	&__clk_0_47, /* ssi.0 */
-	&__clk_0_49, /* rng */
  	&__clk_0_50, /* ssi.1 */
  	&__clk_0_53, /* enet-fec */
  	&__clk_0_54, /* enet-fec */
arch/m68k/include/asm/m5441xsim.h +9 -0
index f48cf63bd782..dd64cdfcad3e 100644
@@ -198,6 +198,15 @@
  #define MCFRTC_SIZE		(0xfc0a8840 - 0xfc0a8000)
  #define MCF_IRQ_RTC		(MCFINT2_VECBASE + MCFINT2_RTC)
 
+/*
+ *  Random Number Generator (RNG) Module.
+ *  Note: Only present in MCF54418, not in MCF54410/54415/54417
+ */
+#define MCF_RNG_BASE		0xfc0c4000
+#define MCF_RNG_SIZE		0x1c
+#define MCFINT2_RNG		28
+#define MCF_IRQ_RNG		(MCFINT2_VECBASE + MCFINT2_RNG)
+
  /*
   *  GPIO Module.
   */
drivers/char/hw_random/Kconfig +2 -1
index 492a2a61a65b..2f301e43db84 100644
@@ -270,12 +270,13 @@ config HW_RANDOM_MXC_RNGA
  config HW_RANDOM_IMX_RNGC
  	tristate "Freescale i.MX RNGC Random Number Generator"
  	depends on HAS_IOMEM
-	depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL || COMPILE_TEST
+	depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL || COLDFIRE || COMPILE_TEST
  	default HW_RANDOM
  	help
  	  This driver provides kernel-side support for the Random Number
  	  Generator Version C hardware found on some Freescale i.MX
  	  processors. Version B is also supported by this driver.
+	  Also supports RNGB on Freescale MCF54418 (Coldfire V4e).
 
  	  To compile this driver as a module, choose M here: the
  	  module will be called imx-rngc.
drivers/char/hw_random/imx-rngc.c +7 -0
index d6a847e48339..44f20a05de0a 100644
@@ -353,12 +353,19 @@ static const struct of_device_id imx_rngc_dt_ids[] = {
  };
  MODULE_DEVICE_TABLE(of, imx_rngc_dt_ids);
 
+static const struct platform_device_id imx_rngc_devtype[] = {
+	{ .name = "imx-rngc" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, imx_rngc_devtype);
+
  static struct platform_driver imx_rngc_driver = {
  	.driver = {
  		.name = KBUILD_MODNAME,
  		.pm = pm_ptr(&imx_rngc_pm_ops),
  		.of_match_table = imx_rngc_dt_ids,
  	},
+	.id_table = imx_rngc_devtype,
  };
 
  module_platform_driver_probe(imx_rngc_driver, imx_rngc_probe);
#9 lore raw

Hi Greg,

Sorry for the very long silence on this one, it fell off my radar...

Le 03/12/2025 à 13:15, Greg Ungerer a écrit :

Quoted 21 lines

Hi Jean-Michel,

Quoted 10 lines · On 26/11/25 17:08, Jean-Michel Hautbois via B4 Relay wrote:

From: Jean-Michel Hautbois <[email protected]>

Add support for the hardware Random Number Generator (RNGB) found on MCF54418 ColdFire processors with clock enabled at platform initialization.

The RNGB block is compatible with the imx-rngc driver.

Quoted 7 lines

---
  arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++ arch/m68k/coldfire/m5441x.c       |  2 +- arch/m68k/include/asm/m5441xsim.h |  9 +++++++++ drivers/char/hw_random/Kconfig    |  3 ++- drivers/char/hw_random/imx-rngc.c |  7 +++++++

  5 files changed, 47 insertions(+), 2 deletions(-)
Quoted 7 lines

I am happy with the ColdFire arch parts, so from me:

I don't mind taking this commit via the m68knommu git tree if the hw_rng maintainers are ok with that. Otherwise if you break out the arch/m68k parts I can apply those on their own.

I think Herbert acked ?
Do you need another ack ?

Thanks !
JM

Quoted 135 lines

Regards
Greg

Quoted 129 lines
arch/m68k/coldfire/device.c +28 -0
index b6958ec2a220..9d8f844e319a 100644
@@ -622,6 +622,31 @@ static struct platform_device mcf_flexcan0 = {
   };
   #endif /* MCFFLEXCAN_SIZE */
+#ifdef MCF_RNG_BASE
+/*
+ * Random Number Generator (RNG) - only on MCF54418
+ */
+static struct resource mcf_rng_resource[] = {
+    {
+        .start = MCF_RNG_BASE,
+        .end   = MCF_RNG_BASE + MCF_RNG_SIZE - 1,
+        .flags = IORESOURCE_MEM,
+    },
+    {
+        .start = MCF_IRQ_RNG,
+        .end   = MCF_IRQ_RNG,
+        .flags = IORESOURCE_IRQ,
+    },
+};
+
+static struct platform_device mcf_rng = {
+    .name           = "imx-rngc",
+    .id             = -1,
+    .num_resources  = ARRAY_SIZE(mcf_rng_resource),
+    .resource       = mcf_rng_resource,
+};
+#endif /* MCF_RNG_BASE */
+
   static struct platform_device *mcf_devices[] __initdata = {
       &mcf_uart,
   #ifdef MCFFEC_BASE0
@@ -660,6 +685,9 @@ static struct platform_device *mcf_devices[] 
 __initdata = {
   #ifdef MCFFLEXCAN_SIZE
       &mcf_flexcan0,
   #endif
+#ifdef MCF_RNG_BASE
+    &mcf_rng,
+#endif
   };
   /*
arch/m68k/coldfire/m5441x.c +0 -0
index 7a25cfc7ac07..ab5b00637237 100644
@@ -158,6 +158,7 @@ static struct clk * const enable_clks[] 
 __initconst = {

      &__clk_0_33, /* pit.1 */
      &__clk_0_37, /* eport */
      &__clk_0_48, /* pll */
+    &__clk_0_49, /* rng */
      &__clk_0_51, /* esdhc */
      &__clk_1_36, /* CCM/reset module/Power management */

arch/m68k/coldfire/m5441x.c +0 -0
@@ -179,7 +180,6 @@ static struct clk * const disable_clks[] 
 __initconst = {

      &__clk_0_44, /* usb otg */
      &__clk_0_45, /* usb host */
      &__clk_0_47, /* ssi.0 */
-    &__clk_0_49, /* rng */
      &__clk_0_50, /* ssi.1 */
      &__clk_0_53, /* enet-fec */
      &__clk_0_54, /* enet-fec */

arch/m68k/include/asm/m5441xsim.h +9 -0
index f48cf63bd782..dd64cdfcad3e 100644
@@ -198,6 +198,15 @@
   #define MCFRTC_SIZE        (0xfc0a8840 - 0xfc0a8000)
   #define MCF_IRQ_RTC        (MCFINT2_VECBASE + MCFINT2_RTC)
+/*
+ *  Random Number Generator (RNG) Module.
+ *  Note: Only present in MCF54418, not in MCF54410/54415/54417
+ */
+#define MCF_RNG_BASE        0xfc0c4000
+#define MCF_RNG_SIZE        0x1c
+#define MCFINT2_RNG        28
+#define MCF_IRQ_RNG        (MCFINT2_VECBASE + MCFINT2_RNG)
+
   /*
    *  GPIO Module.
    */
drivers/char/hw_random/Kconfig +0 -0
index 492a2a61a65b..2f301e43db84 100644
@@ -270,12 +270,13 @@ config HW_RANDOM_MXC_RNGA

  config HW_RANDOM_IMX_RNGC
      tristate "Freescale i.MX RNGC Random Number Generator" depends on HAS_IOMEM
-    depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL

|| COMPILE_TEST
+    depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL 
|| COLDFIRE || COMPILE_TEST

      default HW_RANDOM
      help
        This driver provides kernel-side support for the Random Number Generator Version C hardware found on some Freescale i.MX processors. Version B is also supported by this driver. +      Also supports RNGB on Freescale MCF54418 (Coldfire V4e). To compile this driver as a module, choose M here: the module will be called imx-rngc.

drivers/char/hw_random/imx-rngc.c +7 -0
index d6a847e48339..44f20a05de0a 100644
@@ -353,12 +353,19 @@ static const struct of_device_id 
 imx_rngc_dt_ids[] = {
   };
   MODULE_DEVICE_TABLE(of, imx_rngc_dt_ids);
+static const struct platform_device_id imx_rngc_devtype[] = {
+    { .name = "imx-rngc" },
+    { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, imx_rngc_devtype);
+
   static struct platform_driver imx_rngc_driver = {
       .driver = {
           .name = KBUILD_MODNAME,
           .pm = pm_ptr(&imx_rngc_pm_ops),
           .of_match_table = imx_rngc_dt_ids,
       },
+    .id_table = imx_rngc_devtype,
   };
   module_platform_driver_probe(imx_rngc_driver, imx_rngc_probe);
 
#10 lore raw

Hi JM,

Quoted 28 lines · Jean-Michel Hautbois

Hi Greg,

Sorry for the very long silence on this one, it fell off my radar...

Le 03/12/2025 à 13:15, Greg Ungerer a écrit :

Quoted 23 lines

Hi Jean-Michel,

Quoted 10 lines · On 26/11/25 17:08, Jean-Michel Hautbois via B4 Relay wrote:

From: Jean-Michel Hautbois <[email protected]>

Add support for the hardware Random Number Generator (RNGB) found on MCF54418 ColdFire processors with clock enabled at platform initialization.

The RNGB block is compatible with the imx-rngc driver.

Quoted 7 lines

---
  arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++ arch/m68k/coldfire/m5441x.c       |  2 +- arch/m68k/include/asm/m5441xsim.h |  9 +++++++++ drivers/char/hw_random/Kconfig    |  3 ++- drivers/char/hw_random/imx-rngc.c |  7 +++++++

  5 files changed, 47 insertions(+), 2 deletions(-)

I am happy with the ColdFire arch parts, so from me:

Quoted 8 lines
Quoted 5 lines

I don't mind taking this commit via the m68knommu git tree if the hw_rng maintainers are ok with that. Otherwise if you break out the arch/m68k parts I can apply those on their own.

I think Herbert acked ?
Do you need another ack ?

I would like to see an acknowledgement that taking this patch via the m68knommu git tree (to Linus) is ok with the RNG maintainers.

Regards
Greg

Quoted 139 lines

Thanks !
JM

Quoted 135 lines

Regards
Greg

Quoted 129 lines
arch/m68k/coldfire/device.c +28 -0
index b6958ec2a220..9d8f844e319a 100644
@@ -622,6 +622,31 @@ static struct platform_device mcf_flexcan0 = {
   };
   #endif /* MCFFLEXCAN_SIZE */
+#ifdef MCF_RNG_BASE
+/*
+ * Random Number Generator (RNG) - only on MCF54418
+ */
+static struct resource mcf_rng_resource[] = {
+    {
+        .start = MCF_RNG_BASE,
+        .end   = MCF_RNG_BASE + MCF_RNG_SIZE - 1,
+        .flags = IORESOURCE_MEM,
+    },
+    {
+        .start = MCF_IRQ_RNG,
+        .end   = MCF_IRQ_RNG,
+        .flags = IORESOURCE_IRQ,
+    },
+};
+
+static struct platform_device mcf_rng = {
+    .name           = "imx-rngc",
+    .id             = -1,
+    .num_resources  = ARRAY_SIZE(mcf_rng_resource),
+    .resource       = mcf_rng_resource,
+};
+#endif /* MCF_RNG_BASE */
+
   static struct platform_device *mcf_devices[] __initdata = {
       &mcf_uart,
   #ifdef MCFFEC_BASE0
@@ -660,6 +685,9 @@ static struct platform_device *mcf_devices[] 
 __initdata = {
   #ifdef MCFFLEXCAN_SIZE
       &mcf_flexcan0,
   #endif
+#ifdef MCF_RNG_BASE
+    &mcf_rng,
+#endif
   };
   /*
arch/m68k/coldfire/m5441x.c +0 -0
index 7a25cfc7ac07..ab5b00637237 100644
@@ -158,6 +158,7 @@ static struct clk * const enable_clks[] 
 __initconst = {

      &__clk_0_33, /* pit.1 */
      &__clk_0_37, /* eport */
      &__clk_0_48, /* pll */
+    &__clk_0_49, /* rng */
      &__clk_0_51, /* esdhc */
      &__clk_1_36, /* CCM/reset module/Power management */

arch/m68k/coldfire/m5441x.c +0 -0
@@ -179,7 +180,6 @@ static struct clk * const disable_clks[] 
 __initconst = {

      &__clk_0_44, /* usb otg */
      &__clk_0_45, /* usb host */
      &__clk_0_47, /* ssi.0 */
-    &__clk_0_49, /* rng */
      &__clk_0_50, /* ssi.1 */
      &__clk_0_53, /* enet-fec */
      &__clk_0_54, /* enet-fec */

arch/m68k/include/asm/m5441xsim.h +9 -0
index f48cf63bd782..dd64cdfcad3e 100644
@@ -198,6 +198,15 @@
   #define MCFRTC_SIZE        (0xfc0a8840 - 0xfc0a8000)
   #define MCF_IRQ_RTC        (MCFINT2_VECBASE + MCFINT2_RTC)
+/*
+ *  Random Number Generator (RNG) Module.
+ *  Note: Only present in MCF54418, not in MCF54410/54415/54417
+ */
+#define MCF_RNG_BASE        0xfc0c4000
+#define MCF_RNG_SIZE        0x1c
+#define MCFINT2_RNG        28
+#define MCF_IRQ_RNG        (MCFINT2_VECBASE + MCFINT2_RNG)
+
   /*
    *  GPIO Module.
    */
drivers/char/hw_random/Kconfig +0 -0
index 492a2a61a65b..2f301e43db84 100644
@@ -270,12 +270,13 @@ config HW_RANDOM_MXC_RNGA

  config HW_RANDOM_IMX_RNGC
      tristate "Freescale i.MX RNGC Random Number Generator" depends on HAS_IOMEM
-    depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL

|| COMPILE_TEST
+    depends on SOC_IMX25 || SOC_IMX6SL || SOC_IMX6SLL || SOC_IMX6UL 
|| COLDFIRE || COMPILE_TEST

      default HW_RANDOM
      help
        This driver provides kernel-side support for the Random Number Generator Version C hardware found on some Freescale i.MX processors. Version B is also supported by this driver. +      Also supports RNGB on Freescale MCF54418 (Coldfire V4e). To compile this driver as a module, choose M here: the module will be called imx-rngc.

drivers/char/hw_random/imx-rngc.c +7 -0
index d6a847e48339..44f20a05de0a 100644
@@ -353,12 +353,19 @@ static const struct of_device_id 
 imx_rngc_dt_ids[] = {
   };
   MODULE_DEVICE_TABLE(of, imx_rngc_dt_ids);
+static const struct platform_device_id imx_rngc_devtype[] = {
+    { .name = "imx-rngc" },
+    { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, imx_rngc_devtype);
+
   static struct platform_driver imx_rngc_driver = {
       .driver = {
           .name = KBUILD_MODNAME,
           .pm = pm_ptr(&imx_rngc_pm_ops),
           .of_match_table = imx_rngc_dt_ids,
       },
+    .id_table = imx_rngc_devtype,
   };
   module_platform_driver_probe(imx_rngc_driver, imx_rngc_probe);
 
#11 lore raw

Herbert, Greg,

Gentle ping, and the delay is mostly mine: this sat on my own list for months. The series has had all the acks it needs since December 2025, but Greg would like your word before taking the arch half[1].

The two patches are independent at build time, so the simplest path is the one Greg suggested himself[2]: 1/2 through crypto, 2/2 through m68knommu. 2/2 is mostly arch code, but it also adds COLDFIRE to the HW_RANDOM_IMX_RNGC dependency and a platform id_table to imx-rngc.c[3], so it needs your ack for Greg to take it.

Both still apply with git am -3 on current mainline and on m68knommu/for-next. Happy to send a rebased v5 instead, no rush.

[1] https://lore.kernel.org/all/[email protected]
[2] https://lore.kernel.org/all/[email protected]
[3] https://lore.kernel.org/all/[email protected]

Thanks,
JM

maintainer
#12 lore raw
In reply to Greg Ungerer
Quoted 37 lines · Greg Ungerer

Hi JM,

Quoted 34 lines · Jean-Michel Hautbois

Hi Greg,

Sorry for the very long silence on this one, it fell off my radar...

Le 03/12/2025 à 13:15, Greg Ungerer a écrit :

Quoted 28 lines

Hi Jean-Michel,

Quoted 10 lines · On 26/11/25 17:08, Jean-Michel Hautbois via B4 Relay wrote:

From: Jean-Michel Hautbois <[email protected]>

Add support for the hardware Random Number Generator (RNGB) found on MCF54418 ColdFire processors with clock enabled at platform initialization.

The RNGB block is compatible with the imx-rngc driver.

Quoted 7 lines

---
  arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++ arch/m68k/coldfire/m5441x.c       |  2 +- arch/m68k/include/asm/m5441xsim.h |  9 +++++++++ drivers/char/hw_random/Kconfig    |  3 ++- drivers/char/hw_random/imx-rngc.c |  7 +++++++

  5 files changed, 47 insertions(+), 2 deletions(-)

I am happy with the ColdFire arch parts, so from me:

I don't mind taking this commit via the m68knommu git tree if the hw_rng maintainers are ok with that. Otherwise if you break out the arch/m68k parts I can apply those on their own.

Quoted 5 lines
Quoted 2 lines

I think Herbert acked ?
Do you need another ack ?

I would like to see an acknowledgement that taking this patch via the m68knommu git tree (to Linus) is ok with the RNG maintainers.

I have no objections to this.

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#13 lore raw

Hi JM,

Quoted 38 lines · Herbert Xu
Quoted 37 lines · Greg Ungerer

Hi JM,

Quoted 34 lines · Jean-Michel Hautbois

Hi Greg,

Sorry for the very long silence on this one, it fell off my radar...

Le 03/12/2025 à 13:15, Greg Ungerer a écrit :

Quoted 28 lines

Hi Jean-Michel,

Quoted 10 lines · On 26/11/25 17:08, Jean-Michel Hautbois via B4 Relay wrote:

From: Jean-Michel Hautbois <[email protected]>

Add support for the hardware Random Number Generator (RNGB) found on MCF54418 ColdFire processors with clock enabled at platform initialization.

The RNGB block is compatible with the imx-rngc driver.

Quoted 7 lines

---
  arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++ arch/m68k/coldfire/m5441x.c       |  2 +- arch/m68k/include/asm/m5441xsim.h |  9 +++++++++ drivers/char/hw_random/Kconfig    |  3 ++- drivers/char/hw_random/imx-rngc.c |  7 +++++++

  5 files changed, 47 insertions(+), 2 deletions(-)

I am happy with the ColdFire arch parts, so from me:

I don't mind taking this commit via the m68knommu git tree if the hw_rng maintainers are ok with that. Otherwise if you break out the arch/m68k parts I can apply those on their own.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I think Herbert acked ?
Do you need another ack ?

I would like to see an acknowledgement that taking this patch via the m68knommu git tree (to Linus) is ok with the RNG maintainers.

I have no objections to this.

Thanks Herbert.

JM: I have applied this to the for-next branch of the m68knommu git tree. I didn't quite go on cleanly, so please double check it for me.

Regards
Greg

#14 lore raw

Hi Greg,

Le 11/10/2026 à 17:28, Greg Ungerer a écrit :

Quoted 47 lines

Hi JM,

Quoted 44 lines · Herbert Xu
Quoted 42 lines · Greg Ungerer

Hi JM,

Quoted 28 lines · Jean-Michel Hautbois

Hi Greg,

Sorry for the very long silence on this one, it fell off my radar...

Le 03/12/2025 à 13:15, Greg Ungerer a écrit :

Quoted 23 lines

Hi Jean-Michel,

Quoted 10 lines · On 26/11/25 17:08, Jean-Michel Hautbois via B4 Relay wrote:

From: Jean-Michel Hautbois <[email protected]>

Add support for the hardware Random Number Generator (RNGB) found on MCF54418 ColdFire processors with clock enabled at platform initialization.

The RNGB block is compatible with the imx-rngc driver.

Quoted 7 lines
---
   arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++
   arch/m68k/coldfire/m5441x.c       |  2 +-
   arch/m68k/include/asm/m5441xsim.h |  9 +++++++++
   drivers/char/hw_random/Kconfig    |  3 ++-
   drivers/char/hw_random/imx-rngc.c |  7 +++++++
   5 files changed, 47 insertions(+), 2 deletions(-)

I am happy with the ColdFire arch parts, so from me:

Quoted 8 lines
Quoted 5 lines

I don't mind taking this commit via the m68knommu git tree if the hw_rng maintainers are ok with that. Otherwise if you break out the arch/m68k parts I can apply those on their own.

I think Herbert acked ?
Do you need another ack ?

I would like to see an acknowledgement that taking this patch via the m68knommu git tree (to Linus) is ok with the RNG maintainers.

Quoted 6 lines
Quoted 1 line

I have no objections to this.

Thanks Herbert.

JM: I have applied this to the for-next branch of the m68knommu git tree. I didn't quite go on cleanly, so please double check it for me.

Thanks, I think you missed 1/2 ?
Or did I miss something ?

Thanks !
JM

Quoted 3 lines

Regards
Greg

maintainer
#15 lore raw

Hi JM,

Quoted 44 lines · Jean-Michel Hautbois

Le 11/10/2026 à 17:28, Greg Ungerer a écrit :

Quoted 43 lines · Herbert Xu
Quoted 41 lines · Greg Ungerer
Quoted 33 lines · Jean-Michel Hautbois
Quoted 32 lines

Sorry for the very long silence on this one, it fell off my radar...

Le 03/12/2025 à 13:15, Greg Ungerer a écrit :

Quoted 28 lines

Hi Jean-Michel,

Quoted 10 lines · On 26/11/25 17:08, Jean-Michel Hautbois via B4 Relay wrote:

From: Jean-Michel Hautbois <[email protected]>

Add support for the hardware Random Number Generator (RNGB) found on MCF54418 ColdFire processors with clock enabled at platform initialization.

The RNGB block is compatible with the imx-rngc driver.

Quoted 7 lines

---
   arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++ arch/m68k/coldfire/m5441x.c       |  2 +- arch/m68k/include/asm/m5441xsim.h |  9 +++++++++ drivers/char/hw_random/Kconfig    |  3 ++- drivers/char/hw_random/imx-rngc.c |  7 +++++++

   5 files changed, 47 insertions(+), 2 deletions(-)

I am happy with the ColdFire arch parts, so from me:

I don't mind taking this commit via the m68knommu git tree if the hw_rng maintainers are ok with that. Otherwise if you break out the arch/m68k parts I can apply those on their own.

Quoted 5 lines
Quoted 2 lines

I think Herbert acked ?
Do you need another ack ?

I would like to see an acknowledgement that taking this patch via the m68knommu git tree (to Linus) is ok with the RNG maintainers.

I have no objections to this.

Quoted 7 lines
Quoted 4 lines

Thanks Herbert.

JM: I have applied this to the for-next branch of the m68knommu git tree. I didn't quite go on cleanly, so please double check it for me.

Thanks, I think you missed 1/2 ?
Or did I miss something ?

I assumed patch 1/2 would go via the RNG maintainers directly since it has no dependency on, and contains no arch code for, m68knommu. Is the expectation that I should push that too?

Regards
Greg

maintainer Acked-by on v4 2/2
#16 lore raw
In reply to Jean-Michel Hautbois
Quoted 10 lines · On Wed, Nov 26, 2025 at 08:08:10AM +0100, Jean-Michel Hautbois via B4 Relay…

From: Jean-Michel Hautbois <[email protected]>

Add support for the hardware Random Number Generator (RNGB) found on MCF54418 ColdFire processors with clock enabled at platform initialization.

The RNGB block is compatible with the imx-rngc driver.

Quoted 7 lines
---
 arch/m68k/coldfire/device.c       | 28 ++++++++++++++++++++++++++++
 arch/m68k/coldfire/m5441x.c       |  2 +-
 arch/m68k/include/asm/m5441xsim.h |  9 +++++++++
 drivers/char/hw_random/Kconfig    |  3 ++-
 drivers/char/hw_random/imx-rngc.c |  7 +++++++
 5 files changed, 47 insertions(+), 2 deletions(-)
Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt