* [PATCH v2 0/2] m68k: coldfire: Add RNG support and const qualifiers for MCF54418
@ 2025-11-07 10:29 Jean-Michel Hautbois
2025-11-07 10:29 ` [PATCH v2 1/2] m68k: coldfire: Mark platform device resource arrays as const Jean-Michel Hautbois
2025-11-07 10:29 ` [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois
0 siblings, 2 replies; 10+ messages in thread
From: Jean-Michel Hautbois @ 2025-11-07 10:29 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) and improves type safety for platform device resources.
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()
Additionally, following Frank Li's suggestion, all static resource array
in arch/m68k/coldfire/device.c are marked const, moving them to read-only
memory and aligning with kernel API expectations.
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 since v1:
- 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
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
---
Jean-Michel Hautbois (2):
m68k: coldfire: Mark platform device resource arrays as const
m68k: coldfire: Add RNG support for MCF54418
arch/m68k/coldfire/device.c | 52 ++++++++++++++++++++++++++++++---------
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, 60 insertions(+), 15 deletions(-)
---
base-commit: 5e5629c7ce42cfa1da9c6aaaa6d7aff0d396c46e
change-id: 20251107-b4-m5441x-add-rng-support-0fdb8d40210a
Best regards,
--
Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v2 1/2] m68k: coldfire: Mark platform device resource arrays as const 2025-11-07 10:29 [PATCH v2 0/2] m68k: coldfire: Add RNG support and const qualifiers for MCF54418 Jean-Michel Hautbois @ 2025-11-07 10:29 ` Jean-Michel Hautbois 2025-11-07 16:02 ` Frank Li 2025-11-07 10:29 ` [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois 1 sibling, 1 reply; 10+ messages in thread From: Jean-Michel Hautbois @ 2025-11-07 10:29 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 Add 'const' qualifier to all static resource arrays in device.c. These arrays are never modified at runtime, they are only read by platform device registration functions. Suggested-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> --- arch/m68k/coldfire/device.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c index b6958ec2a220cf91a78a14fc7fa18749451412f7..20adba27a687029ef53249bad71b342d563d612b 100644 --- a/arch/m68k/coldfire/device.c +++ b/arch/m68k/coldfire/device.c @@ -111,7 +111,7 @@ static struct fec_platform_data fec_pdata = { * block. It is Freescale's own hardware block. Some ColdFires * have 2 of these. */ -static struct resource mcf_fec0_resources[] = { +static const struct resource mcf_fec0_resources[] = { { .start = MCFFEC_BASE0, .end = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1, @@ -148,7 +148,7 @@ static struct platform_device mcf_fec0 = { #endif /* MCFFEC_BASE0 */ #ifdef MCFFEC_BASE1 -static struct resource mcf_fec1_resources[] = { +static const struct resource mcf_fec1_resources[] = { { .start = MCFFEC_BASE1, .end = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1, @@ -189,7 +189,7 @@ static struct platform_device mcf_fec1 = { * The ColdFire QSPI module is an SPI protocol hardware block used * on a number of different ColdFire CPUs. */ -static struct resource mcf_qspi_resources[] = { +static const struct resource mcf_qspi_resources[] = { { .start = MCFQSPI_BASE, .end = MCFQSPI_BASE + MCFQSPI_SIZE - 1, @@ -340,7 +340,7 @@ static struct platform_device mcf_qspi = { #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ #if IS_ENABLED(CONFIG_I2C_IMX) -static struct resource mcf_i2c0_resources[] = { +static const struct resource mcf_i2c0_resources[] = { { .start = MCFI2C_BASE0, .end = MCFI2C_BASE0 + MCFI2C_SIZE0 - 1, @@ -361,7 +361,7 @@ static struct platform_device mcf_i2c0 = { }; #ifdef MCFI2C_BASE1 -static struct resource mcf_i2c1_resources[] = { +static const struct resource mcf_i2c1_resources[] = { { .start = MCFI2C_BASE1, .end = MCFI2C_BASE1 + MCFI2C_SIZE1 - 1, @@ -385,7 +385,7 @@ static struct platform_device mcf_i2c1 = { #ifdef MCFI2C_BASE2 -static struct resource mcf_i2c2_resources[] = { +static const struct resource mcf_i2c2_resources[] = { { .start = MCFI2C_BASE2, .end = MCFI2C_BASE2 + MCFI2C_SIZE2 - 1, @@ -409,7 +409,7 @@ static struct platform_device mcf_i2c2 = { #ifdef MCFI2C_BASE3 -static struct resource mcf_i2c3_resources[] = { +static const struct resource mcf_i2c3_resources[] = { { .start = MCFI2C_BASE3, .end = MCFI2C_BASE3 + MCFI2C_SIZE3 - 1, @@ -433,7 +433,7 @@ static struct platform_device mcf_i2c3 = { #ifdef MCFI2C_BASE4 -static struct resource mcf_i2c4_resources[] = { +static const struct resource mcf_i2c4_resources[] = { { .start = MCFI2C_BASE4, .end = MCFI2C_BASE4 + MCFI2C_SIZE4 - 1, @@ -457,7 +457,7 @@ static struct platform_device mcf_i2c4 = { #ifdef MCFI2C_BASE5 -static struct resource mcf_i2c5_resources[] = { +static const struct resource mcf_i2c5_resources[] = { { .start = MCFI2C_BASE5, .end = MCFI2C_BASE5 + MCFI2C_SIZE5 - 1, @@ -507,7 +507,7 @@ static struct mcf_edma_platform_data mcf_edma_data = { .slavecnt = ARRAY_SIZE(mcf_edma_map), }; -static struct resource mcf_edma_resources[] = { +static const struct resource mcf_edma_resources[] = { { .start = MCFEDMA_BASE, .end = MCFEDMA_BASE + MCFEDMA_SIZE - 1, @@ -560,7 +560,7 @@ static struct mcf_esdhc_platform_data mcf_esdhc_data = { .cd_type = ESDHC_CD_NONE, }; -static struct resource mcf_esdhc_resources[] = { +static const struct resource mcf_esdhc_resources[] = { { .start = MCFSDHC_BASE, .end = MCFSDHC_BASE + MCFSDHC_SIZE - 1, @@ -590,7 +590,7 @@ static struct flexcan_platform_data mcf5441x_flexcan_info = { .clock_frequency = 120000000, }; -static struct resource mcf5441x_flexcan0_resource[] = { +static const struct resource mcf5441x_flexcan0_resource[] = { { .start = MCFFLEXCAN_BASE0, .end = MCFFLEXCAN_BASE0 + MCFFLEXCAN_SIZE, -- 2.39.5 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] m68k: coldfire: Mark platform device resource arrays as const 2025-11-07 10:29 ` [PATCH v2 1/2] m68k: coldfire: Mark platform device resource arrays as const Jean-Michel Hautbois @ 2025-11-07 16:02 ` Frank Li 2025-11-08 8:43 ` Jean-Michel Hautbois 0 siblings, 1 reply; 10+ messages in thread From: Frank Li @ 2025-11-07 16:02 UTC (permalink / raw) To: Jean-Michel Hautbois 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 On Fri, Nov 07, 2025 at 11:29:43AM +0100, Jean-Michel Hautbois wrote: > Add 'const' qualifier to all static resource arrays in device.c. > These arrays are never modified at runtime, they are only read by > platform device registration functions. > > Suggested-by: Frank Li <Frank.Li@nxp.com> > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> > --- > arch/m68k/coldfire/device.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c > index b6958ec2a220cf91a78a14fc7fa18749451412f7..20adba27a687029ef53249bad71b342d563d612b 100644 > --- a/arch/m68k/coldfire/device.c > +++ b/arch/m68k/coldfire/device.c > @@ -111,7 +111,7 @@ static struct fec_platform_data fec_pdata = { > * block. It is Freescale's own hardware block. Some ColdFires > * have 2 of these. > */ > -static struct resource mcf_fec0_resources[] = { > +static const struct resource mcf_fec0_resources[] = { > { > .start = MCFFEC_BASE0, > .end = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1, > @@ -148,7 +148,7 @@ static struct platform_device mcf_fec0 = { > #endif /* MCFFEC_BASE0 */ > > #ifdef MCFFEC_BASE1 > -static struct resource mcf_fec1_resources[] = { > +static const struct resource mcf_fec1_resources[] = { > { > .start = MCFFEC_BASE1, > .end = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1, > @@ -189,7 +189,7 @@ static struct platform_device mcf_fec1 = { > * The ColdFire QSPI module is an SPI protocol hardware block used > * on a number of different ColdFire CPUs. > */ > -static struct resource mcf_qspi_resources[] = { > +static const struct resource mcf_qspi_resources[] = { > { > .start = MCFQSPI_BASE, > .end = MCFQSPI_BASE + MCFQSPI_SIZE - 1, > @@ -340,7 +340,7 @@ static struct platform_device mcf_qspi = { > #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ > > #if IS_ENABLED(CONFIG_I2C_IMX) > -static struct resource mcf_i2c0_resources[] = { > +static const struct resource mcf_i2c0_resources[] = { > { > .start = MCFI2C_BASE0, > .end = MCFI2C_BASE0 + MCFI2C_SIZE0 - 1, > @@ -361,7 +361,7 @@ static struct platform_device mcf_i2c0 = { > }; > #ifdef MCFI2C_BASE1 > > -static struct resource mcf_i2c1_resources[] = { > +static const struct resource mcf_i2c1_resources[] = { > { > .start = MCFI2C_BASE1, > .end = MCFI2C_BASE1 + MCFI2C_SIZE1 - 1, > @@ -385,7 +385,7 @@ static struct platform_device mcf_i2c1 = { > > #ifdef MCFI2C_BASE2 > > -static struct resource mcf_i2c2_resources[] = { > +static const struct resource mcf_i2c2_resources[] = { > { > .start = MCFI2C_BASE2, > .end = MCFI2C_BASE2 + MCFI2C_SIZE2 - 1, > @@ -409,7 +409,7 @@ static struct platform_device mcf_i2c2 = { > > #ifdef MCFI2C_BASE3 > > -static struct resource mcf_i2c3_resources[] = { > +static const struct resource mcf_i2c3_resources[] = { > { > .start = MCFI2C_BASE3, > .end = MCFI2C_BASE3 + MCFI2C_SIZE3 - 1, > @@ -433,7 +433,7 @@ static struct platform_device mcf_i2c3 = { > > #ifdef MCFI2C_BASE4 > > -static struct resource mcf_i2c4_resources[] = { > +static const struct resource mcf_i2c4_resources[] = { > { > .start = MCFI2C_BASE4, > .end = MCFI2C_BASE4 + MCFI2C_SIZE4 - 1, > @@ -457,7 +457,7 @@ static struct platform_device mcf_i2c4 = { > > #ifdef MCFI2C_BASE5 > > -static struct resource mcf_i2c5_resources[] = { > +static const struct resource mcf_i2c5_resources[] = { > { > .start = MCFI2C_BASE5, > .end = MCFI2C_BASE5 + MCFI2C_SIZE5 - 1, > @@ -507,7 +507,7 @@ static struct mcf_edma_platform_data mcf_edma_data = { > .slavecnt = ARRAY_SIZE(mcf_edma_map), > }; > > -static struct resource mcf_edma_resources[] = { > +static const struct resource mcf_edma_resources[] = { > { > .start = MCFEDMA_BASE, > .end = MCFEDMA_BASE + MCFEDMA_SIZE - 1, > @@ -560,7 +560,7 @@ static struct mcf_esdhc_platform_data mcf_esdhc_data = { > .cd_type = ESDHC_CD_NONE, > }; > > -static struct resource mcf_esdhc_resources[] = { > +static const struct resource mcf_esdhc_resources[] = { > { > .start = MCFSDHC_BASE, > .end = MCFSDHC_BASE + MCFSDHC_SIZE - 1, > @@ -590,7 +590,7 @@ static struct flexcan_platform_data mcf5441x_flexcan_info = { > .clock_frequency = 120000000, > }; > > -static struct resource mcf5441x_flexcan0_resource[] = { > +static const struct resource mcf5441x_flexcan0_resource[] = { > { > .start = MCFFLEXCAN_BASE0, > .end = MCFFLEXCAN_BASE0 + MCFFLEXCAN_SIZE, > > -- > 2.39.5 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] m68k: coldfire: Mark platform device resource arrays as const 2025-11-07 16:02 ` Frank Li @ 2025-11-08 8:43 ` Jean-Michel Hautbois 0 siblings, 0 replies; 10+ messages in thread From: Jean-Michel Hautbois @ 2025-11-08 8:43 UTC (permalink / raw) To: Frank Li 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 Hi Frank, Le vendredi 7 novembre 2025, 17:02:24 heure normale d’Europe centrale Frank Li a écrit : > On Fri, Nov 07, 2025 at 11:29:43AM +0100, Jean-Michel Hautbois wrote: > > Add 'const' qualifier to all static resource arrays in device.c. > > These arrays are never modified at runtime, they are only read by > > platform device registration functions. > > > > Suggested-by: Frank Li <Frank.Li@nxp.com> > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > > Reviewed-by: Frank Li <Frank.Li@nxp.com> Thanks. It must be noted though that it generates warnings when building: CC arch/m68k/coldfire/device.o arch/m68k/coldfire/device.c:141:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 141 | .resource = mcf_fec0_resources, | ^~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:178:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 178 | .resource = mcf_fec1_resources, | ^~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:360:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 360 | .resource = mcf_i2c0_resources, | ^~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:381:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 381 | .resource = mcf_i2c1_resources, | ^~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:405:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 405 | .resource = mcf_i2c2_resources, | ^~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:429:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 429 | .resource = mcf_i2c3_resources, | ^~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:453:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 453 | .resource = mcf_i2c4_resources, | ^~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:477:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 477 | .resource = mcf_i2c5_resources, | ^~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:548:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 548 | .resource = mcf_edma_resources, | ^~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:579:35: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 579 | .resource = mcf_esdhc_resources, | ^~~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/device.c:620:21: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 620 | .resource = mcf5441x_flexcan0_resource, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ JM > > > --- > > > > arch/m68k/coldfire/device.c | 24 ++++++++++++------------ > > 1 file changed, 12 insertions(+), 12 deletions(-) > > > > diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c > > index > > b6958ec2a220cf91a78a14fc7fa18749451412f7..20adba27a687029ef53249bad71b342 > > d563d612b 100644 --- a/arch/m68k/coldfire/device.c > > +++ b/arch/m68k/coldfire/device.c > > @@ -111,7 +111,7 @@ static struct fec_platform_data fec_pdata = { > > > > * block. It is Freescale's own hardware block. Some ColdFires > > * have 2 of these. > > */ > > > > -static struct resource mcf_fec0_resources[] = { > > +static const struct resource mcf_fec0_resources[] = { > > > > { > > > > .start = MCFFEC_BASE0, > > .end = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1, > > > > @@ -148,7 +148,7 @@ static struct platform_device mcf_fec0 = { > > > > #endif /* MCFFEC_BASE0 */ > > > > #ifdef MCFFEC_BASE1 > > > > -static struct resource mcf_fec1_resources[] = { > > +static const struct resource mcf_fec1_resources[] = { > > > > { > > > > .start = MCFFEC_BASE1, > > .end = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1, > > > > @@ -189,7 +189,7 @@ static struct platform_device mcf_fec1 = { > > > > * The ColdFire QSPI module is an SPI protocol hardware block used > > * on a number of different ColdFire CPUs. > > */ > > > > -static struct resource mcf_qspi_resources[] = { > > +static const struct resource mcf_qspi_resources[] = { > > > > { > > > > .start = MCFQSPI_BASE, > > .end = MCFQSPI_BASE + MCFQSPI_SIZE - 1, > > > > @@ -340,7 +340,7 @@ static struct platform_device mcf_qspi = { > > > > #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ > > > > #if IS_ENABLED(CONFIG_I2C_IMX) > > > > -static struct resource mcf_i2c0_resources[] = { > > +static const struct resource mcf_i2c0_resources[] = { > > > > { > > > > .start = MCFI2C_BASE0, > > .end = MCFI2C_BASE0 + MCFI2C_SIZE0 - 1, > > > > @@ -361,7 +361,7 @@ static struct platform_device mcf_i2c0 = { > > > > }; > > #ifdef MCFI2C_BASE1 > > > > -static struct resource mcf_i2c1_resources[] = { > > +static const struct resource mcf_i2c1_resources[] = { > > > > { > > > > .start = MCFI2C_BASE1, > > .end = MCFI2C_BASE1 + MCFI2C_SIZE1 - 1, > > > > @@ -385,7 +385,7 @@ static struct platform_device mcf_i2c1 = { > > > > #ifdef MCFI2C_BASE2 > > > > -static struct resource mcf_i2c2_resources[] = { > > +static const struct resource mcf_i2c2_resources[] = { > > > > { > > > > .start = MCFI2C_BASE2, > > .end = MCFI2C_BASE2 + MCFI2C_SIZE2 - 1, > > > > @@ -409,7 +409,7 @@ static struct platform_device mcf_i2c2 = { > > > > #ifdef MCFI2C_BASE3 > > > > -static struct resource mcf_i2c3_resources[] = { > > +static const struct resource mcf_i2c3_resources[] = { > > > > { > > > > .start = MCFI2C_BASE3, > > .end = MCFI2C_BASE3 + MCFI2C_SIZE3 - 1, > > > > @@ -433,7 +433,7 @@ static struct platform_device mcf_i2c3 = { > > > > #ifdef MCFI2C_BASE4 > > > > -static struct resource mcf_i2c4_resources[] = { > > +static const struct resource mcf_i2c4_resources[] = { > > > > { > > > > .start = MCFI2C_BASE4, > > .end = MCFI2C_BASE4 + MCFI2C_SIZE4 - 1, > > > > @@ -457,7 +457,7 @@ static struct platform_device mcf_i2c4 = { > > > > #ifdef MCFI2C_BASE5 > > > > -static struct resource mcf_i2c5_resources[] = { > > +static const struct resource mcf_i2c5_resources[] = { > > > > { > > > > .start = MCFI2C_BASE5, > > .end = MCFI2C_BASE5 + MCFI2C_SIZE5 - 1, > > > > @@ -507,7 +507,7 @@ static struct mcf_edma_platform_data mcf_edma_data = { > > > > .slavecnt = ARRAY_SIZE(mcf_edma_map), > > > > }; > > > > -static struct resource mcf_edma_resources[] = { > > +static const struct resource mcf_edma_resources[] = { > > > > { > > > > .start = MCFEDMA_BASE, > > .end = MCFEDMA_BASE + MCFEDMA_SIZE - 1, > > > > @@ -560,7 +560,7 @@ static struct mcf_esdhc_platform_data mcf_esdhc_data = > > {> > > .cd_type = ESDHC_CD_NONE, > > > > }; > > > > -static struct resource mcf_esdhc_resources[] = { > > +static const struct resource mcf_esdhc_resources[] = { > > > > { > > > > .start = MCFSDHC_BASE, > > .end = MCFSDHC_BASE + MCFSDHC_SIZE - 1, > > > > @@ -590,7 +590,7 @@ static struct flexcan_platform_data > > mcf5441x_flexcan_info = {> > > .clock_frequency = 120000000, > > > > }; > > > > -static struct resource mcf5441x_flexcan0_resource[] = { > > +static const struct resource mcf5441x_flexcan0_resource[] = { > > > > { > > > > .start = MCFFLEXCAN_BASE0, > > .end = MCFFLEXCAN_BASE0 + MCFFLEXCAN_SIZE, > > > > -- > > 2.39.5 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 2025-11-07 10:29 [PATCH v2 0/2] m68k: coldfire: Add RNG support and const qualifiers for MCF54418 Jean-Michel Hautbois 2025-11-07 10:29 ` [PATCH v2 1/2] m68k: coldfire: Mark platform device resource arrays as const Jean-Michel Hautbois @ 2025-11-07 10:29 ` Jean-Michel Hautbois 2025-11-07 16:07 ` Frank Li 2025-11-10 8:15 ` Geert Uytterhoeven 1 sibling, 2 replies; 10+ messages in thread From: Jean-Michel Hautbois @ 2025-11-07 10:29 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 Add platform device support for the MCF54418 RNGB hardware with clock enabled at platform initialization. The imx-rngc driver now uses devm_clk_get_optional() to support both Coldfire (always-on clock) and i.MX platforms (managed clock). 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 | 9 ++++++++- 5 files changed, 48 insertions(+), 3 deletions(-) diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c index 20adba27a687029ef53249bad71b342d563d612b..4183929b0b501459da25d1b4cde7d77f19c3dc16 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 const 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 7a25cfc7ac07570ff15da3c55d080a717cf93a06..ab5b006372379294db3b522820de88137bfb7e78 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 f48cf63bd7822fd53c33788128f984585c0c421a..dd64cdfcad3e810254c6854b9de5b6bbeb67b950 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 492a2a61a65be8bd9e46b0a70f3e43703973512e..e046eabaac2d9053a5a4a98c6e3733bb19258e54 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 || M5441x || 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 241664a9b5d9ac7244f15cbe5d5302ca3787ebea..44f20a05de0a425cb6ff7b2a347b111750ac3702 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"); @@ -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] 10+ messages in thread
* Re: [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 2025-11-07 10:29 ` [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois @ 2025-11-07 16:07 ` Frank Li 2025-11-08 8:44 ` Jean-Michel Hautbois 2025-11-10 8:15 ` Geert Uytterhoeven 1 sibling, 1 reply; 10+ messages in thread From: Frank Li @ 2025-11-07 16:07 UTC (permalink / raw) To: Jean-Michel Hautbois 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 On Fri, Nov 07, 2025 at 11:29:44AM +0100, Jean-Michel Hautbois wrote: > Add platform device support for the MCF54418 RNGB hardware with clock > enabled at platform initialization. > > The imx-rngc driver now uses devm_clk_get_optional() to support both > Coldfire (always-on clock) and i.MX platforms (managed clock). > > 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 | 9 ++++++++- > 5 files changed, 48 insertions(+), 3 deletions(-) Most likely need two patches, one patch change rngc use devm_clk_get_optional(). one patch update arch/m68k/coldfire. so difference mantainer can pick up easily. Frank > > diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c > index 20adba27a687029ef53249bad71b342d563d612b..4183929b0b501459da25d1b4cde7d77f19c3dc16 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 const 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 7a25cfc7ac07570ff15da3c55d080a717cf93a06..ab5b006372379294db3b522820de88137bfb7e78 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 f48cf63bd7822fd53c33788128f984585c0c421a..dd64cdfcad3e810254c6854b9de5b6bbeb67b950 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 492a2a61a65be8bd9e46b0a70f3e43703973512e..e046eabaac2d9053a5a4a98c6e3733bb19258e54 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 || M5441x || 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 241664a9b5d9ac7244f15cbe5d5302ca3787ebea..44f20a05de0a425cb6ff7b2a347b111750ac3702 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"); > > @@ -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 [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 2025-11-07 16:07 ` Frank Li @ 2025-11-08 8:44 ` Jean-Michel Hautbois 0 siblings, 0 replies; 10+ messages in thread From: Jean-Michel Hautbois @ 2025-11-08 8:44 UTC (permalink / raw) To: Frank Li 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 Hi Frank, Le vendredi 7 novembre 2025, 17:07:10 heure normale d’Europe centrale Frank Li a écrit : > On Fri, Nov 07, 2025 at 11:29:44AM +0100, Jean-Michel Hautbois wrote: > > Add platform device support for the MCF54418 RNGB hardware with clock > > enabled at platform initialization. > > > > The imx-rngc driver now uses devm_clk_get_optional() to support both > > Coldfire (always-on clock) and i.MX platforms (managed clock). > > > > 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 | 9 ++++++++- > > 5 files changed, 48 insertions(+), 3 deletions(-) > > Most likely need two patches, one patch change rngc use > devm_clk_get_optional(). one patch update arch/m68k/coldfire. > > so difference mantainer can pick up easily. Thanks for this suggestion, I will split this into two for v3. I am just waiting a bit to see if other remarks are emerging, in order to not spam with multiple versions :-). Thanks, JM > > Frank > > > diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c > > index > > 20adba27a687029ef53249bad71b342d563d612b..4183929b0b501459da25d1b4cde7d77 > > f19c3dc16 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 const 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 > > 7a25cfc7ac07570ff15da3c55d080a717cf93a06..ab5b006372379294db3b522820de881 > > 37bfb7e78 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 > > f48cf63bd7822fd53c33788128f984585c0c421a..dd64cdfcad3e810254c6854b9de5b6b > > beb67b950 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 > > 492a2a61a65be8bd9e46b0a70f3e43703973512e..e046eabaac2d9053a5a4a98c6e3733b > > b19258e54 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 || M5441x || 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 > > 241664a9b5d9ac7244f15cbe5d5302ca3787ebea..44f20a05de0a425cb6ff7b2a347b111 > > 750ac3702 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");> > > @@ -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 [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 2025-11-07 10:29 ` [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois 2025-11-07 16:07 ` Frank Li @ 2025-11-10 8:15 ` Geert Uytterhoeven 2025-11-10 8:34 ` Jean-Michel Hautbois 1 sibling, 1 reply; 10+ messages in thread From: Geert Uytterhoeven @ 2025-11-10 8:15 UTC (permalink / raw) To: Jean-Michel Hautbois Cc: 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 Hi Jean-Michel, On Fri, 7 Nov 2025 at 11:29, Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> wrote: > Add platform device support for the MCF54418 RNGB hardware with clock > enabled at platform initialization. > > The imx-rngc driver now uses devm_clk_get_optional() to support both > Coldfire (always-on clock) and i.MX platforms (managed clock). > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> Thanks for your patch! > --- 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 || M5441x || COMPILE_TEST Is the same RNG present in other Coldfire SoCs? > 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 241664a9b5d9ac7244f15cbe5d5302ca3787ebea..44f20a05de0a425cb6ff7b2a347b111750ac3702 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" }, I believe this is identical to KBUILD_MODNAME, so the .name below should be sufficient for binding? > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(platform, imx_rngc_devtype); Or do you need this mainly for the addition of MODULE_DEVICE_TABLE(), i.e. the module is not auto-loaded based on just KBUILD_MODNAME? > + > 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); 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] 10+ messages in thread
* Re: [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 2025-11-10 8:15 ` Geert Uytterhoeven @ 2025-11-10 8:34 ` Jean-Michel Hautbois 2025-11-10 9:31 ` Geert Uytterhoeven 0 siblings, 1 reply; 10+ messages in thread From: Jean-Michel Hautbois @ 2025-11-10 8:34 UTC (permalink / raw) To: Geert Uytterhoeven Cc: 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 Hi Geert, Le lundi 10 novembre 2025, 09:15:11 heure normale d’Europe centrale Geert Uytterhoeven a écrit : > Hi Jean-Michel, > > On Fri, 7 Nov 2025 at 11:29, Jean-Michel Hautbois > > <jeanmichel.hautbois@yoseli.org> wrote: > > Add platform device support for the MCF54418 RNGB hardware with clock > > enabled at platform initialization. > > > > The imx-rngc driver now uses devm_clk_get_optional() to support both > > Coldfire (always-on clock) and i.MX platforms (managed clock). > > > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > > Thanks for your patch! > > > --- 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 || M5441x || COMPILE_TEST > Is the same RNG present in other Coldfire SoCs? According to the RM, it is only present in MCF54416 and MCF54418. > > > 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 > > 241664a9b5d9ac7244f15cbe5d5302ca3787ebea..44f20a05de0a425cb6ff7b2a347b111 > > 750ac3702 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" }, > > I believe this is identical to KBUILD_MODNAME, so the .name below > should be sufficient for binding? > > > + { /* sentinel */ } > > +}; > > +MODULE_DEVICE_TABLE(platform, imx_rngc_devtype); > > Or do you need this mainly for the addition of MODULE_DEVICE_TABLE(), > i.e. the module is not auto-loaded based on just KBUILD_MODNAME? Yes, exactly. If you have a better way, I will happily apply it :-). Thanks ! JM > > > + > > > > 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); > > Gr{oetje,eeting}s, > > Geert ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 2025-11-10 8:34 ` Jean-Michel Hautbois @ 2025-11-10 9:31 ` Geert Uytterhoeven 0 siblings, 0 replies; 10+ messages in thread From: Geert Uytterhoeven @ 2025-11-10 9:31 UTC (permalink / raw) To: Jean-Michel Hautbois Cc: 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 Hi Jean-Michel, On Mon, 10 Nov 2025 at 09:34, Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> wrote: > Le lundi 10 novembre 2025, 09:15:11 heure normale d’Europe centrale Geert > Uytterhoeven a écrit : > > On Fri, 7 Nov 2025 at 11:29, Jean-Michel Hautbois > > <jeanmichel.hautbois@yoseli.org> wrote: > > > Add platform device support for the MCF54418 RNGB hardware with clock > > > enabled at platform initialization. > > > > > > The imx-rngc driver now uses devm_clk_get_optional() to support both > > > Coldfire (always-on clock) and i.MX platforms (managed clock). > > > > > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> > > > > Thanks for your patch! > > > > > --- 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 || M5441x || COMPILE_TEST > > Is the same RNG present in other Coldfire SoCs? > > According to the RM, it is only present in MCF54416 and MCF54418. I guess that is sufficient to make it depend on COLDFIRE? 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] 10+ messages in thread
end of thread, other threads:[~2025-11-10 9:31 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-07 10:29 [PATCH v2 0/2] m68k: coldfire: Add RNG support and const qualifiers for MCF54418 Jean-Michel Hautbois 2025-11-07 10:29 ` [PATCH v2 1/2] m68k: coldfire: Mark platform device resource arrays as const Jean-Michel Hautbois 2025-11-07 16:02 ` Frank Li 2025-11-08 8:43 ` Jean-Michel Hautbois 2025-11-07 10:29 ` [PATCH v2 2/2] m68k: coldfire: Add RNG support for MCF54418 Jean-Michel Hautbois 2025-11-07 16:07 ` Frank Li 2025-11-08 8:44 ` Jean-Michel Hautbois 2025-11-10 8:15 ` Geert Uytterhoeven 2025-11-10 8:34 ` Jean-Michel Hautbois 2025-11-10 9:31 ` Geert Uytterhoeven
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).