Skip to contentSkip to conversation

Migrate IMX8, IMX8M and IMX9 to use imx8_cpu

PATCH In review Adam Ford 4 participants 17 messages Mar 25, 2025 – Mar 26, 2025

Subsystems (3)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

v4 cover Migrate IMX8, IMX8M and IMX9 to use imx8_cpu

The imx8_cpu driver uses the driver model to represent the processor cores in the dm tree as well as display the processor type and speed on boot. Currently, the imx8_cpu driver only displays the temperature grade of the processor if the processor is IMX9, so in order to display that info, the check in imx8_cpu is changed to check for IMX_TMU and IMX_TMU is implied for IMX8, IMX8M and IMX9 SoC familes. If users want to fall back to the older method to display the SoC type or remove the temperature grade information, they can. Doing this at the SoC family level reduces the number of duplicated config options for each board, and was done at the request of the IMX U-Boot custodian.

V4: Make IMX9 select CPU_IMX instead of imply since it appears to be
required for all in the platform.
Fixed some whitespace in imx8_cpu around the temperature grade message. Re-ordered some items in Kconfig to keep them alphabetical Added more CPU items to the list inside imx8_cpu to match what was done from arch/arm/mach-imx/cpu.c.

V3: Added the imply IMX_TMU for the 8M family and added the imply for
CPU and CPU_IMX to IMX8, IMX8M and IMX9 families. CPU_IMX depends on CPU, so both have to be selected.

V2: Changed the check in imx8_cpu to drop the IMX9 check and instead
imply IMX_TMU in the IMX9 family

Adam Ford (7):
imx: imx9: Imply IMX_TMU
cpu: imx8_cpu: Expand get_imx_type_str list of supported CPUs
imx: imx8m: Imply IMX_TMU
cpu: imx8_cpu: Print Speed grade if IMX_TMU.
imx: imx8m: Imply CPU_IMX by default
imx: imx8: Imply CPU_IMX by default
imx: imx9: Imply CPU_IMX by default

 arch/arm/mach-imx/imx8/Kconfig  |  2 ++
 arch/arm/mach-imx/imx8m/Kconfig |  3 ++
 arch/arm/mach-imx/imx9/Kconfig  |  3 ++
 drivers/cpu/imx8_cpu.c          | 54 ++++++++++++++++++++++++++++-----
 4 files changed, 54 insertions(+), 8 deletions(-)
Signature · 1 line
2.45.2
author
#1 lore raw

PATCH v4 1/7 imx: imx9: Imply IMX_TMU

If the CPU Information is displayed from imx8_cpu, it displays the cpu temperature grade and operating temperature if CONFIG_IMX9 is defined. This behavior is similar to what happens arch/arm/mach-imx/cpu.c except that the latter checks for CONFIG_IMX_THERMAL or CONFIG_IMX_TMU.
In preparation to make imx8_cpu act like the previous implementation for any CPU, make IMX9 imply IMX_TMU, so it will be always displayed unless a user decides to disable it.

---
 arch/arm/mach-imx/imx9/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-imx/imx9/Kconfig +1 -0
index 49220c0955e..c3e758e103a 100644
@@ -10,6 +10,7 @@ config IMX9
 	select BINMAN
 	select HAS_CAAM
 	select ROM_UNIFIED_SECTIONS
+	imply IMX_TMU
 
 config IMX93
 	bool
Signature · 1 line
2.45.2
author
#2 lore raw

PATCH v4 2/7 cpu: imx8_cpu: Expand get_imx_type_str list of supported CPUs

In reply to Adam Ford

The imx8_cpu is capable of running on IMX8, IMX8M, and IMX9 families, but the CPU list is limited on the 8M variants. Expand this list to show more variants and their respective names.

---
 drivers/cpu/imx8_cpu.c | 44 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 3 deletions(-)
drivers/cpu/imx8_cpu.c +41 -3
index 53d31b3c0bf..39b3c194131 100644
@@ -35,11 +35,49 @@ static const char *get_imx_type_str(u32 imxtype)
 {
 	switch (imxtype) {
 	case MXC_CPU_IMX8MM:
-		return "8MM";
+		return "8MMQ";	/* Quad-core version of the imx8mm */
+	case MXC_CPU_IMX8MML:
+		return "8MMQL";	/* Quad-core Lite version of the imx8mm */
+	case MXC_CPU_IMX8MMD:
+		return "8MMD";	/* Dual-core version of the imx8mm */
+	case MXC_CPU_IMX8MMDL:
+		return "8MMDL";	/* Dual-core Lite version of the imx8mm */
+	case MXC_CPU_IMX8MMS:
+		return "8MMS";	/* Single-core version of the imx8mm */
+	case MXC_CPU_IMX8MMSL:
+		return "8MMSL";	/* Single-core Lite version of the imx8mm */
 	case MXC_CPU_IMX8MN:
-		return "8MN";
+		return "8MNano Quad"; /* Quad-core version */
+	case MXC_CPU_IMX8MND:
+		return "8MNano Dual"; /* Dual-core version */
+	case MXC_CPU_IMX8MNS:
+		return "8MNano Solo"; /* Single-core version */
+	case MXC_CPU_IMX8MNL:
+		return "8MNano QuadLite"; /* Quad-core Lite version */
+	case MXC_CPU_IMX8MNDL:
+		return "8MNano DualLite"; /* Dual-core Lite version */
+	case MXC_CPU_IMX8MNSL:
+		return "8MNano SoloLite";/* Single-core Lite version of the imx8mn */
+	case MXC_CPU_IMX8MNUQ:
+		return "8MNano UltraLite Quad";/* Quad-core UltraLite version of the imx8mn */
+	case MXC_CPU_IMX8MNUD:
+		return "8MNano UltraLite Dual";/* Dual-core UltraLite version of the imx8mn */
+	case MXC_CPU_IMX8MNUS:
+		return "8MNano UltraLite Solo";/* Single-core UltraLite version of the imx8mn */
 	case MXC_CPU_IMX8MP:
-		return "8MP";
+		return "8MP[8]";	/* Quad-core version of the imx8mp */
+	case MXC_CPU_IMX8MPD:
+		return "8MP Dual[3]";	/* Dual-core version of the imx8mp */
+	case MXC_CPU_IMX8MPL:
+		return "8MP Lite[4]";	/* Quad-core Lite version of the imx8mp */
+	case MXC_CPU_IMX8MP6:
+		return "8MP[6]";	/* Quad-core version of the imx8mp, NPU fused */
+	case MXC_CPU_IMX8MQ:
+		return "8MQ";	/* Quad-core version of the imx8mq */
+	case MXC_CPU_IMX8MQL:
+		return "8MQLite";	/* Quad-core Lite version of the imx8mq */
+	case MXC_CPU_IMX8MD:
+		return "8MD";	/* Dual-core version of the imx8mq */
 	case MXC_CPU_IMX8QXP:
 	case MXC_CPU_IMX8QXP_A0:
 		return "8QXP";
Signature · 1 line
2.45.2
author
#3 lore raw

PATCH v4 3/7 imx: imx8m: Imply IMX_TMU

In reply to Adam Ford

If the CPU Information is displayed from imx8_cpu, it displays the cpu temperature grade and operating temperature if CONFIG_IMX9 is defined. This behavior is similar to what happens mach-imx/cpu.c, except that the latter checks for IMX_THERMAL or IMX_TMU.

In preparation to make imx8_cpu act like the previous implementation for any CPU, make IMX8M imply IMX_TMU so it will be always displayed unless a user decides to disable it.

---
 arch/arm/mach-imx/imx8m/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-imx/imx8m/Kconfig +1 -0
index 89f2b50c8a2..8ee699a343c 100644
@@ -8,6 +8,7 @@ config IMX8M
 	select LTO
 	select ROM_UNIFIED_SECTIONS
 	select ARMV8_CRYPTO
+	imply IMX_TMU
 
 config IMX8MQ
 	bool
Signature · 1 line
2.45.2
author
#4 lore raw

PATCH v4 4/7 cpu: imx8_cpu: Print Speed grade if IMX_TMU.

In reply to Adam Ford

Much of the data that is display by imx8_cpu.c is also displayed from arch/arm/mach-imx/cpu.c, except the temperature grade and active temperature are only displayed when SoC is an i.MX9. Since IMX9 now implies IMX_TMU, change this to check for IMX_TMU in the same way it's done in mach-imx/cpu.c to enable displaying this information for any SoC with either of this config enabled.
Since additional text may appear due to this commit, remove the extra space in the message displaying the temperature grade.

Before:

CPU:   NXP i.MX8MP Rev1.1 A53 at 1200 MHz
Model: Beacon EmbeddedWorks i.MX8MPlus Development kit

After:

CPU:   NXP i.MX8MP Rev1.1 A53 at 1200 MHz
CPU:   Industrial temperature grade (-40C to 105C) at 28C
Model: Beacon EmbeddedWorks i.MX8MPlus Development kit
---
 drivers/cpu/imx8_cpu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/cpu/imx8_cpu.c +5 -5
index 39b3c194131..4e1eccaa5b0 100644
@@ -215,19 +215,19 @@ static int cpu_imx_get_desc(const struct udevice *dev, char *buf, int size)
 	ret = snprintf(buf, size, "NXP i.MX%s Rev%s %s at %u MHz",
 		       plat->type, plat->rev, plat->name, plat->freq_mhz);
 
-	if (IS_ENABLED(CONFIG_IMX9)) {
+	if (IS_ENABLED(CONFIG_IMX_TMU)) {
 		switch (get_cpu_temp_grade(&minc, &maxc)) {
 		case TEMP_AUTOMOTIVE:
-			grade = "Automotive temperature grade ";
+			grade = "Automotive temperature grade";
 			break;
 		case TEMP_INDUSTRIAL:
-			grade = "Industrial temperature grade ";
+			grade = "Industrial temperature grade";
 			break;
 		case TEMP_EXTCOMMERCIAL:
-			grade = "Extended Consumer temperature grade ";
+			grade = "Extended Consumer temperature grade";
 			break;
 		default:
-			grade = "Consumer temperature grade ";
+			grade = "Consumer temperature grade";
 			break;
 		}
 
Signature · 1 line
2.45.2
Reviewed-by on v4 4/7
#5 lore raw

Re: [PATCH V4 4/7] cpu: imx8_cpu: Print Speed grade if IMX_TMU.

Quoted 14 lines · Adam Ford

Much of the data that is display by imx8_cpu.c is also displayed from arch/arm/mach-imx/cpu.c, except the temperature grade and active temperature are only displayed when SoC is an i.MX9. Since IMX9 now implies IMX_TMU, change this to check for IMX_TMU in the same way it's done in mach-imx/cpu.c to enable displaying this information for any SoC with either of this config enabled.
Since additional text may appear due to this commit, remove the extra space in the message displaying the temperature grade.

Before:

CPU:   NXP i.MX8MP Rev1.1 A53 at 1200 MHz
Model: Beacon EmbeddedWorks i.MX8MPlus Development kit
Quoted 6 lines

After:

CPU:   NXP i.MX8MP Rev1.1 A53 at 1200 MHz
CPU:   Industrial temperature grade (-40C to 105C) at 28C
Model: Beacon EmbeddedWorks i.MX8MPlus Development kit

Please drop the fullstop at the end of Subject and then add

To the whole series.

Thanks !

reviewer
#6 lore raw

Re: [PATCH V4 4/7] cpu: imx8_cpu: Print Speed grade if IMX_TMU.

Quoted 5 lines · Marek Vasut

Please drop the fullstop at the end of Subject and then add

To the whole series.

Adam, no need to resend. I will take care of it, thanks.

author
#7 lore raw

Re: [PATCH V4 4/7] cpu: imx8_cpu: Print Speed grade if IMX_TMU.

Quoted 10 lines · Fabio Estevam
Quoted 5 lines · Marek Vasut

Please drop the fullstop at the end of Subject and then add

To the whole series.

Adam, no need to resend. I will take care of it, thanks.

Sorry about that...again. Thanks.

Once this is complete, I'll have a smaller patch series which shrinks my 8MP SPL code by around 4k by #ifdef'ing out dead code. Hopefully it's not too cluttered, but that smaller series depends on both the UART clock and the CPU_IMX updates.

adam

#8 lore raw

Re: [PATCH V4 4/7] cpu: imx8_cpu: Print Speed grade if IMX_TMU.

Quoted 10 lines · Adam Ford
Quoted 9 lines · Fabio Estevam
Quoted 5 lines · Marek Vasut

Please drop the fullstop at the end of Subject and then add

To the whole series.

Quoted 8 lines
Quoted 1 line

Adam, no need to resend. I will take care of it, thanks.

Sorry about that...again. Thanks.

Once this is complete, I'll have a smaller patch series which shrinks my 8MP SPL code by around 4k by #ifdef'ing out dead code. Hopefully it's not too cluttered, but that smaller series depends on both the UART clock and the CPU_IMX updates.

Nice, thanks !

author
#9 lore raw

Re: [PATCH V4 4/7] cpu: imx8_cpu: Print Speed grade if IMX_TMU.

Quoted 14 lines · Marek Vasut
Quoted 12 lines · Adam Ford
Quoted 10 lines · Fabio Estevam
Quoted 5 lines · Marek Vasut

Please drop the fullstop at the end of Subject and then add

To the whole series.

Adam, no need to resend. I will take care of it, thanks.

Quoted 7 lines
Quoted 6 lines

Sorry about that...again. Thanks.

Once this is complete, I'll have a smaller patch series which shrinks my 8MP SPL code by around 4k by #ifdef'ing out dead code. Hopefully it's not too cluttered, but that smaller series depends on both the UART clock and the CPU_IMX updates.

Nice, thanks !

Don't thank me yet. It's going to increase the ifdef-ery, and it gets a bit ugly. I'm tempted to throw in some To-Do's, because I can see some more improvement possibilities as I dig into some of this code, but I am not prepared to touch them yet.

adam

reviewer
#10 lore raw

Re: [PATCH V4 4/7] cpu: imx8_cpu: Print Speed grade if IMX_TMU.

In reply to Adam Ford

Hi Adam,

Quoted 4 lines · Adam Ford

Once this is complete, I'll have a smaller patch series which shrinks my 8MP SPL code by around 4k by #ifdef'ing out dead code. Hopefully it's not too cluttered, but that smaller series depends on both the UART clock and the CPU_IMX updates.

The two series are present in the next branch now.

Feel free to post the additional improvements.

author
#11 lore raw

Re: [PATCH V4 4/7] cpu: imx8_cpu: Print Speed grade if IMX_TMU.

Quoted 5 lines · Fabio Estevam

Hi Adam,

On Tue, Mar 25, 2025 at 9:37 AM Adam Ford <[email protected]> wrote:

Quoted 8 lines
Quoted 4 lines

Once this is complete, I'll have a smaller patch series which shrinks my 8MP SPL code by around 4k by #ifdef'ing out dead code. Hopefully it's not too cluttered, but that smaller series depends on both the UART clock and the CPU_IMX updates.

The two series are present in the next branch now.

Feel free to post the additional improvements.

Well, I am not sure if it's good news or bad, but after rebasing my changes on top of U-Boot-Next, the SPL size delta goes away, so I am not sure if I even have anything to push, since it makes no difference anymore. :-( Part of me wants to bisect it to see what made the difference.

adam

author
#12 lore raw

PATCH v4 5/7 imx: imx8m: Imply CPU_IMX by default

In reply to Adam Ford

The imx8_cpu driver is a CPU Driver that supports the i.MX8M family, and when it is enabled, it acts as an alternative to arch/arm/mach-imx/cpu.c, but the imx8_cpu supports the driver model where cpu.c does not. Imply this newer driver by default.

---
 arch/arm/mach-imx/imx8m/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-imx/imx8m/Kconfig +2 -0
index 8ee699a343c..31f2f003d35 100644
@@ -8,6 +8,8 @@ config IMX8M
 	select LTO
 	select ROM_UNIFIED_SECTIONS
 	select ARMV8_CRYPTO
+	imply CPU
+	imply CPU_IMX
 	imply IMX_TMU
 
 config IMX8MQ
Signature · 1 line
2.45.2
author
#13 lore raw

PATCH v4 6/7 imx: imx8: Imply CPU_IMX by default

In reply to Adam Ford

The imx8_cpu driver is a CPU Driver that supports the i.MX8Q family. When it is enabled, it acts as an alternative to arch/arm/mach-imx/cpu.c, but the imx8_cpu supports the driver model where cpu.c does not. Imply this newer driver by default.

---
 arch/arm/mach-imx/imx8/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-imx/imx8/Kconfig +2 -0
index 9a43beda6fa..257c14e61b6 100644
@@ -9,6 +9,8 @@ config AHAB_BOOT
 config IMX8
 	bool
 	select HAS_CAAM
+	imply CPU
+	imply CPU_IMX
 
 config MU_BASE_SPL
 	hex "MU base address used in SPL"
Signature · 1 line
2.45.2
author
#14 lore raw

PATCH v4 7/7 imx: imx9: Imply CPU_IMX by default

In reply to Adam Ford

The imx8_cpu driver is a CPU Driver that supports the i.MX9 family to display the CPU type, temperature grade and current operating temperature. The older file, arch/arm/mach-imx/cpu.c, does not support i.MX9, so this config is enabled in various IMX9 boards. Instead of having this option enabled in every IMX9, select this driver by default for the platform.

---
 arch/arm/mach-imx/imx9/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-imx/imx9/Kconfig +2 -0
index c3e758e103a..1ccdb1cf64f 100644
@@ -8,6 +8,8 @@ config AHAB_BOOT
 config IMX9
 	bool
 	select BINMAN
+	select CPU
+	select CPU_IMX
 	select HAS_CAAM
 	select ROM_UNIFIED_SECTIONS
 	imply IMX_TMU
Signature · 1 line
2.45.2
Reviewed-by on the v4 series
#15 lore raw
In reply to Adam Ford
Quoted 34 lines · Adam Ford

The imx8_cpu driver uses the driver model to represent the processor cores in the dm tree as well as display the processor type and speed on boot. Currently, the imx8_cpu driver only displays the temperature grade of the processor if the processor is IMX9, so in order to display that info, the check in imx8_cpu is changed to check for IMX_TMU and IMX_TMU is implied for IMX8, IMX8M and IMX9 SoC familes. If users want to fall back to the older method to display the SoC type or remove the temperature grade information, they can. Doing this at the SoC family level reduces the number of duplicated config options for each board, and was done at the request of the IMX U-Boot custodian.

V4: Make IMX9 select CPU_IMX instead of imply since it appears to be
required for all in the platform.
Fixed some whitespace in imx8_cpu around the temperature grade message. Re-ordered some items in Kconfig to keep them alphabetical Added more CPU items to the list inside imx8_cpu to match what was done from arch/arm/mach-imx/cpu.c.

V3: Added the imply IMX_TMU for the 8M family and added the imply for
CPU and CPU_IMX to IMX8, IMX8M and IMX9 families. CPU_IMX depends on CPU, so both have to be selected.

V2: Changed the check in imx8_cpu to drop the IMX9 check and instead
imply IMX_TMU in the IMX9 family

Adam Ford (7):
imx: imx9: Imply IMX_TMU
cpu: imx8_cpu: Expand get_imx_type_str list of supported CPUs
imx: imx8m: Imply IMX_TMU
cpu: imx8_cpu: Print Speed grade if IMX_TMU.
imx: imx8m: Imply CPU_IMX by default
imx: imx8: Imply CPU_IMX by default
imx: imx9: Imply CPU_IMX by default

Quoted 6 lines
arch/arm/mach-imx/imx8/Kconfig  |  2 ++
arch/arm/mach-imx/imx8m/Kconfig |  3 ++
arch/arm/mach-imx/imx9/Kconfig  |  3 ++
drivers/cpu/imx8_cpu.c          | 54 ++++++++++++++++++++++++++++-----
4 files changed, 54 insertions(+), 8 deletions(-)
Quoted 3 lines
Signature · 1 line
2.45.2
reviewer
#16 lore raw
In reply to Adam Ford
Quoted 12 lines · Adam Ford

The imx8_cpu driver uses the driver model to represent the processor cores in the dm tree as well as display the processor type and speed on boot. Currently, the imx8_cpu driver only displays the temperature grade of the processor if the processor is IMX9, so in order to display that info, the check in imx8_cpu is changed to check for IMX_TMU and IMX_TMU is implied for IMX8, IMX8M and IMX9 SoC familes. If users want to fall back to the older method to display the SoC type or remove the temperature grade information, they can. Doing this at the SoC family level reduces the number of duplicated config options for each board, and was done at the request of the IMX U-Boot custodian.

Quoted 6 lines

V4: Make IMX9 select CPU_IMX instead of imply since it appears to be
required for all in the platform.
Fixed some whitespace in imx8_cpu around the temperature grade message. Re-ordered some items in Kconfig to keep them alphabetical Added more CPU items to the list inside imx8_cpu to match what was done from arch/arm/mach-imx/cpu.c.

Applied to u-boot-imx/next, thanks.