* [PATCH v4 0/2] m68k: coldfire: Add RNG support for MCF54418
@ 2025-11-26 7:08 Jean-Michel Hautbois via B4 Relay
2025-11-26 7:08 ` [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock Jean-Michel Hautbois via B4 Relay
2025-11-26 7:08 ` [PATCH v4 2/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois via B4 Relay
0 siblings, 2 replies; 7+ messages in thread
From: Jean-Michel Hautbois via B4 Relay @ 2025-11-26 7:08 UTC (permalink / raw)
To: Greg Ungerer, Geert Uytterhoeven, Olivia Mackall, Herbert Xu,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-m68k, linux-kernel, linux-crypto, imx, linux-arm-kernel,
Jean-Michel Hautbois, Frank Li
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
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
---
Changes in v4:
- Postpone const qualifiers for now
- Link to v3: https://lore.kernel.org/r/20251124-b4-m5441x-add-rng-support-v3-0-f447251dad27@yoseli.org
Changes in v3:
- Depend on COLDFIRE is enough
- Split the clock change in a dedicated commit
- Link to v2: https://lore.kernel.org/r/20251107-b4-m5441x-add-rng-support-v2-0-f91d685832b9@yoseli.org
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,
--
Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock 2025-11-26 7:08 [PATCH v4 0/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois via B4 Relay @ 2025-11-26 7:08 ` Jean-Michel Hautbois via B4 Relay 2025-11-26 20:30 ` Martin Kaiser 2025-11-26 7:08 ` [PATCH v4 2/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois via B4 Relay 1 sibling, 1 reply; 7+ messages in thread From: Jean-Michel Hautbois via B4 Relay @ 2025-11-26 7:08 UTC (permalink / raw) To: Greg Ungerer, Geert Uytterhoeven, Olivia Mackall, Herbert Xu, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam Cc: linux-m68k, linux-kernel, linux-crypto, imx, linux-arm-kernel, Jean-Michel Hautbois, Frank Li From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> 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). Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> --- drivers/char/hw_random/imx-rngc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index 241664a9b5d9..d6a847e48339 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -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"); -- 2.39.5 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock 2025-11-26 7:08 ` [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock Jean-Michel Hautbois via B4 Relay @ 2025-11-26 20:30 ` Martin Kaiser 2025-11-27 8:37 ` Geert Uytterhoeven 0 siblings, 1 reply; 7+ messages in thread From: Martin Kaiser @ 2025-11-26 20:30 UTC (permalink / raw) To: Jean-Michel Hautbois via B4 Relay Cc: Greg Ungerer, Geert Uytterhoeven, Olivia Mackall, Herbert Xu, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, linux-m68k, linux-kernel, linux-crypto, imx, linux-arm-kernel, Jean-Michel Hautbois, Frank Li Thus wrote Jean-Michel Hautbois via B4 Relay (devnull+jeanmichel.hautbois.yoseli.org@kernel.org): > From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > 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). > Reviewed-by: Frank Li <Frank.Li@nxp.com> > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > --- > drivers/char/hw_random/imx-rngc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c > index 241664a9b5d9..d6a847e48339 100644 > --- a/drivers/char/hw_random/imx-rngc.c > +++ b/drivers/char/hw_random/imx-rngc.c > @@ -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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock 2025-11-26 20:30 ` Martin Kaiser @ 2025-11-27 8:37 ` Geert Uytterhoeven 2025-11-27 13:22 ` Martin Kaiser 0 siblings, 1 reply; 7+ messages in thread From: Geert Uytterhoeven @ 2025-11-27 8:37 UTC (permalink / raw) To: Martin Kaiser Cc: Jean-Michel Hautbois via B4 Relay, Greg Ungerer, Olivia Mackall, Herbert Xu, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, linux-m68k, linux-kernel, linux-crypto, imx, linux-arm-kernel, Jean-Michel Hautbois, Frank Li Hi Martin, On Wed, 26 Nov 2025 at 21:30, Martin Kaiser <martin@kaiser.cx> wrote: > Thus wrote Jean-Michel Hautbois via B4 Relay (devnull+jeanmichel.hautbois.yoseli.org@kernel.org): > > > From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > > > 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). > > > Reviewed-by: Frank Li <Frank.Li@nxp.com> > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > > --- > > drivers/char/hw_random/imx-rngc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c > > index 241664a9b5d9..d6a847e48339 100644 > > --- a/drivers/char/hw_random/imx-rngc.c > > +++ b/drivers/char/hw_random/imx-rngc.c > > @@ -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. As the clocks property is marked required in Documentation/devicetree/bindings/rng/imx-rng.yaml, "make dtbs_check" should flag a missing clock. > 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 -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock 2025-11-27 8:37 ` Geert Uytterhoeven @ 2025-11-27 13:22 ` Martin Kaiser 0 siblings, 0 replies; 7+ messages in thread From: Martin Kaiser @ 2025-11-27 13:22 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Jean-Michel Hautbois via B4 Relay, Greg Ungerer, Olivia Mackall, Herbert Xu, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, linux-m68k, linux-kernel, linux-crypto, imx, linux-arm-kernel, Jean-Michel Hautbois, Frank Li Hi Geert, Thus wrote Geert Uytterhoeven (geert@linux-m68k.org): > Hi Martin, > On Wed, 26 Nov 2025 at 21:30, Martin Kaiser <martin@kaiser.cx> wrote: > > Thus wrote Jean-Michel Hautbois via B4 Relay (devnull+jeanmichel.hautbois.yoseli.org@kernel.org): > > > From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > > > 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). > > > Reviewed-by: Frank Li <Frank.Li@nxp.com> > > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > > > --- > > > drivers/char/hw_random/imx-rngc.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c > > > index 241664a9b5d9..d6a847e48339 100644 > > > --- a/drivers/char/hw_random/imx-rngc.c > > > +++ b/drivers/char/hw_random/imx-rngc.c > > > @@ -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. > As the clocks property is marked required in > Documentation/devicetree/bindings/rng/imx-rng.yaml, "make dtbs_check" > should flag a missing clock. > > 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. Reviewed-by: Martin Kaiser <martin@kaiser.cx> Thanks, Martin ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 2/2] m68k: coldfire: Add RNG support for MCF54418 2025-11-26 7:08 [PATCH v4 0/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois via B4 Relay 2025-11-26 7:08 ` [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock Jean-Michel Hautbois via B4 Relay @ 2025-11-26 7:08 ` Jean-Michel Hautbois via B4 Relay 2025-12-03 12:15 ` Greg Ungerer 1 sibling, 1 reply; 7+ messages in thread From: Jean-Michel Hautbois via B4 Relay @ 2025-11-26 7:08 UTC (permalink / raw) To: Greg Ungerer, Geert Uytterhoeven, Olivia Mackall, Herbert Xu, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam Cc: linux-m68k, linux-kernel, linux-crypto, imx, linux-arm-kernel, Jean-Michel Hautbois, Frank Li From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> 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. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> --- 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(-) diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c index b6958ec2a220..9d8f844e319a 100644 --- a/arch/m68k/coldfire/device.c +++ b/arch/m68k/coldfire/device.c @@ -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 }; /* diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c index 7a25cfc7ac07..ab5b00637237 100644 --- a/arch/m68k/coldfire/m5441x.c +++ b/arch/m68k/coldfire/m5441x.c @@ -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 */ diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m5441xsim.h index f48cf63bd782..dd64cdfcad3e 100644 --- a/arch/m68k/include/asm/m5441xsim.h +++ b/arch/m68k/include/asm/m5441xsim.h @@ -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. */ diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 492a2a61a65b..2f301e43db84 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig @@ -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. diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index d6a847e48339..44f20a05de0a 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -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); -- 2.39.5 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] m68k: coldfire: Add RNG support for MCF54418 2025-11-26 7:08 ` [PATCH v4 2/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois via B4 Relay @ 2025-12-03 12:15 ` Greg Ungerer 0 siblings, 0 replies; 7+ messages in thread From: Greg Ungerer @ 2025-12-03 12:15 UTC (permalink / raw) To: jeanmichel.hautbois, Geert Uytterhoeven, Olivia Mackall, Herbert Xu, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam Cc: linux-m68k, linux-kernel, linux-crypto, imx, linux-arm-kernel, Frank Li Hi Jean-Michel, On 26/11/25 17:08, Jean-Michel Hautbois via B4 Relay wrote: > From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > > 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. > > Reviewed-by: Frank Li <Frank.Li@nxp.com> > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > --- > 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: Acked-by: Greg Ungerer <gerg@linux-m68k.org> 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 > diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c > index b6958ec2a220..9d8f844e319a 100644 > --- a/arch/m68k/coldfire/device.c > +++ b/arch/m68k/coldfire/device.c > @@ -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 > }; > > /* > diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c > index 7a25cfc7ac07..ab5b00637237 100644 > --- a/arch/m68k/coldfire/m5441x.c > +++ b/arch/m68k/coldfire/m5441x.c > @@ -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 */ > diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m5441xsim.h > index f48cf63bd782..dd64cdfcad3e 100644 > --- a/arch/m68k/include/asm/m5441xsim.h > +++ b/arch/m68k/include/asm/m5441xsim.h > @@ -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. > */ > diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig > index 492a2a61a65b..2f301e43db84 100644 > --- a/drivers/char/hw_random/Kconfig > +++ b/drivers/char/hw_random/Kconfig > @@ -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. > diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c > index d6a847e48339..44f20a05de0a 100644 > --- a/drivers/char/hw_random/imx-rngc.c > +++ b/drivers/char/hw_random/imx-rngc.c > @@ -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); > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-12-03 12:15 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-26 7:08 [PATCH v4 0/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois via B4 Relay 2025-11-26 7:08 ` [PATCH v4 1/2] hwrng: imx-rngc: Use optional clock Jean-Michel Hautbois via B4 Relay 2025-11-26 20:30 ` Martin Kaiser 2025-11-27 8:37 ` Geert Uytterhoeven 2025-11-27 13:22 ` Martin Kaiser 2025-11-26 7:08 ` [PATCH v4 2/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois via B4 Relay 2025-12-03 12:15 ` Greg Ungerer
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).