Skip to contentSkip to conversation

imx9: scmi: Fix temperature range for Extended industrial parts

PATCH Applied Ye Li 2 participants 9 messages Jun 3 – Jun 9

Subsystems (3)
lore
Share & tools
lore

Ye Li

author
#0 lore raw

PATCH 1/4 imx9: scmi: Fix temperature range for Extended industrial parts

The value '01' in MARKET_SEGMENT fuse is Extended industrial on iMX95/952/94. Fix its temperature range to -40C to 125C

01` - Ext. Industrial -40C to 125C

---
 arch/arm/mach-imx/imx9/scmi/soc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx9/scmi/soc.c +3 -2
index fbee435786c..76b6870620b 100644
@@ -186,8 +186,9 @@ u32 get_cpu_temp_grade(int *minc, int *maxc)
 			*minc = -40;
 			*maxc = 105;
 		} else if (val == TEMP_EXTCOMMERCIAL) {
-			*minc = -20;
-			*maxc = 105;
+			/* Map to Ext industrial */
+			*minc = -40;
+			*maxc = 125;
 		} else {
 			*minc = 0;
 			*maxc = 95;
Signature · 1 line
2.50.1
author
#1 lore raw

PATCH 2/4 imx9: scmi: Print CPU part number name

Decode the CPU part number from PART_NUM fuse and print it in CPU name.

For iMX95 and iMX952 Part number fuse is defined as:
[7:6] : Package description
[5:2] : Segment
[1:0] : Number of A55 cores

For iMX94, the PART_NUM[7:0] fuse directly reflects the part number value.

---
 arch/arm/mach-imx/imx9/scmi/soc.c | 88 ++++++++++++++++++++++++++++---
 drivers/cpu/imx8_cpu.c            | 12 ++++-
 2 files changed, 92 insertions(+), 8 deletions(-)
arch/arm/mach-imx/imx9/scmi/soc.c +81 -7
index 76b6870620b..aedaa0d4bca 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2025 NXP
+ * Copyright 2025-2026 NXP
  *
  * Peng Fan <[email protected]>
  */
@@ -709,14 +709,88 @@ int get_reset_reason(bool sys, bool lm)
 	return 0;
 }
 
-const char *get_imx_type(u32 imxtype)
+const char *get_cpu_variant_type_name(u32 type)
 {
-	switch (imxtype) {
-	case SCMI_CPU:
-		return IMX_PLAT_STR;
-	default:
-		return "??";
+	u32 val, core_num, part_num;
+	int ret;
+
+	ret = fuse_read(2, 1, &val);
+	if (ret)
+		return NULL;
+
+	/* Get part num */
+	part_num = (val >> 4) & 0xff;
+	if (!part_num)
+		return NULL;
+
+	if (type == MXC_CPU_IMX95 || type == MXC_CPU_IMX952) {
+		u32 segment;
+		static char name[8] = "95294";
+		char pn[2];
+
+		core_num = part_num & 0x3;
+		segment = (part_num >> 2) & 0xf;
+
+		switch (segment) {
+		case 0xa:
+			pn[0] = 'T';
+			break;
+		case 0xb:
+			pn[0] = 'V';
+			break;
+		case 0xc:
+			pn[0] = 'C';
+			break;
+		case 0xd:
+			pn[0] = 'G';
+			break;
+		case 0xe:
+			pn[0] = 'I';
+			break;
+		case 0xf:
+			pn[0] = 'N';
+			break;
+		default:
+			pn[0] = segment + '0';
+			break;
+		}
+
+		pn[1] = core_num * 2 + '0';
+
+		if (type == MXC_CPU_IMX95)
+			sprintf(name, "95%c%c", pn[0], pn[1]);
+		else
+			sprintf(name, "952%c%c", pn[0], pn[1]);
+
+		return name;
+	} else if (type == MXC_CPU_IMX94) {
+		static char *name = "94398";
+
+		core_num = 8;
+
+		ret = fuse_read(2, 2, &val);
+		if (ret)
+			return NULL;
+
+		if (part_num > 30) { /* 943 */
+			/* A55 2 & 3 disabled */
+			if ((val & 0x18) == 0x18)
+				core_num = 6;
+		} else if (part_num > 20) { /* 942 */
+			core_num = 5;
+
+			/* m7_0 disabled */
+			if ((val & 0x200) == 0x200)
+				core_num = 4;
+		} else if (part_num > 10) { /* 941 */
+			core_num = 5;
+		}
+		sprintf(name, "94%u%u", part_num, core_num);
+
+		return name;
 	}
+
+	return NULL;
 }
 
 void build_info(void)
drivers/cpu/imx8_cpu.c +11 -1
index 2bd76ffa739..7bb7b420176 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2019, 2024 NXP
+ * Copyright 2019, 2024-2026 NXP
  */
 
 #include <cpu.h>
@@ -28,8 +28,18 @@ struct cpu_imx_plat {
 	u32 mpidr;
 };
 
+__weak const char *get_cpu_variant_type_name(u32 type)
+{
+	return NULL;
+}
+
 static const char *get_imx_type_str(u32 imxtype)
 {
+	const char *name = get_cpu_variant_type_name(imxtype);
+
+	if (name)
+		return name;
+
 	switch (imxtype) {
 	case MXC_CPU_IMX8MM:
 		return "8MMQ";	/* Quad-core version of the imx8mm */
Signature · 1 line
2.50.1
author
#3 lore raw

PATCH 3/4 iMX9: scmi: Disable fused modules for iMX95/94/952

In reply to Ye Li

Disable relevant modules in kernel FDT and u-boot FDT according to fuse settings on iMX95/94/952.
For u-boot FDT fixup, introduce a common function that each board needs this fixup could select OF_BOARD_FIXUP and implement board_fix_fdt to call imx9_uboot_fixup_by_fuse.

---
 arch/arm/include/asm/arch-imx9/sys_proto.h |   1 +
 arch/arm/mach-imx/imx9/scmi/Makefile       |   2 +-
 arch/arm/mach-imx/imx9/scmi/fdt.c          | 644 +++++++++++++++++++++
 arch/arm/mach-imx/imx9/scmi/soc.c          |  12 -
 4 files changed, 646 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/mach-imx/imx9/scmi/fdt.c
arch/arm/include/asm/arch-imx9/sys_proto.h +1 -0
index dead7a99a66..6843e81f3f7 100644
@@ -22,6 +22,7 @@ int low_drive_freq_update(void *blob);
 
 enum imx9_soc_voltage_mode soc_target_voltage_mode(void);
 int get_reset_reason(bool sys, bool lm);
+int imx9_uboot_fixup_by_fuse(void *fdt);
 
 #define is_voltage_mode(mode) (soc_target_voltage_mode() == (mode))
 
arch/arm/mach-imx/imx9/scmi/Makefile +1 -1
index b98744e1ecb..e83d27327cb 100644
@@ -5,5 +5,5 @@
 # Add include path for NXP device tree header files from Linux.
 ccflags-y += -I$(srctree)/dts/upstream/src/arm64/freescale/
 
-obj-y += soc.o
+obj-y += soc.o fdt.o
 obj-y += clock_scmi.o clock.o
arch/arm/mach-imx/imx9/scmi/fdt.c new file +644 -0

644 lines not on this page · raw message

arch/arm/mach-imx/imx9/scmi/soc.c +0 -12
index aedaa0d4bca..b75e29c99b6 100644
@@ -826,18 +826,6 @@ int arch_misc_init(void)
 	return 0;
 }
 
-#if defined(CONFIG_OF_BOARD_FIXUP) && !defined(CONFIG_SPL_BUILD)
-int board_fix_fdt(void *fdt)
-{
-	return 0;
-}
-#endif
-
-int ft_system_setup(void *blob, struct bd_info *bd)
-{
-	return 0;
-}
-
 #if IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)
 void get_board_serial(struct tag_serialnr *serialnr)
 {
Signature · 1 line
2.50.1
author
#5 lore raw

PATCH 4/4 nxp: imx[95,94,952]_evk: Implement board_fix_fdt

In reply to Ye Li

Select the OF_BOARD_FIXUP and implement board_fix_fdt in board codes of iMX95/952/94 EVK to handle fuse setting on various part numbers.

---
 arch/arm/mach-imx/imx9/Kconfig    |  4 ++++
 board/nxp/imx94_evk/imx94_evk.c   | 10 +++++++++-
 board/nxp/imx952_evk/imx952_evk.c |  8 ++++++++
 board/nxp/imx95_evk/imx95_evk.c   | 10 +++++++++-
 configs/imx943_evk_defconfig      |  1 -
 configs/imx952_evk_defconfig      |  1 -
 6 files changed, 30 insertions(+), 4 deletions(-)
arch/arm/mach-imx/imx9/Kconfig +4 -0
index f072e6a9e3d..1e7245c74e0 100644
@@ -146,6 +146,7 @@ config TARGET_PHYCORE_IMX93
 
 config TARGET_IMX95_19X19_EVK
 	bool "imx95_19x19_evk"
+	select OF_BOARD_FIXUP
 	select IMX95
 	imply BOOTSTD_BOOTCOMMAND
 	imply BOOTSTD_FULL
@@ -153,6 +154,7 @@ config TARGET_IMX95_19X19_EVK
 
 config TARGET_IMX95_15X15_EVK
 	bool "imx95_15x15_evk"
+	select OF_BOARD_FIXUP
 	select IMX95
 	imply BOOTSTD_BOOTCOMMAND
 	imply BOOTSTD_FULL
@@ -160,6 +162,7 @@ config TARGET_IMX95_15X15_EVK
 
 config TARGET_IMX943_EVK
 	bool "imx943_evk"
+	select OF_BOARD_FIXUP
 	select IMX94
 	imply BOOTSTD_BOOTCOMMAND
 	imply BOOTSTD_FULL
@@ -176,6 +179,7 @@ config TARGET_VERDIN_IMX95
 
 config TARGET_IMX952_EVK
 	bool "imx952_evk"
+	select OF_BOARD_FIXUP
 	select IMX_SM_CPU
 	select IMX_SM_LMM
 	select IMX952
board/nxp/imx94_evk/imx94_evk.c +9 -1
index 4731b79b55d..02149afae87 100644
@@ -7,7 +7,7 @@
 #include <fdt_support.h>
 #include <asm/gpio.h>
 #include <asm/arch/clock.h>
-#include <asm/mach-imx/sys_proto.h>
+#include <asm/arch/sys_proto.h>
 
 int board_init(void)
 {
@@ -26,3 +26,11 @@ int board_late_init(void)
 
 	return 0;
 }
+
+#if IS_ENABLED(CONFIG_OF_BOARD_FIXUP)
+int board_fix_fdt(void *fdt)
+{
+	/* Remove nodes based on fuses. */
+	return imx9_uboot_fixup_by_fuse(fdt);
+}
+#endif
board/nxp/imx952_evk/imx952_evk.c +8 -0
index 2a61817939e..b5c2da032a8 100644
@@ -24,3 +24,11 @@ int board_late_init(void)
 
 	return 0;
 }
+
+#if IS_ENABLED(CONFIG_OF_BOARD_FIXUP)
+int board_fix_fdt(void *fdt)
+{
+	/* Remove nodes based on fuses. */
+	return imx9_uboot_fixup_by_fuse(fdt);
+}
+#endif
board/nxp/imx95_evk/imx95_evk.c +9 -1
index 99a37e0593f..394d6fd459c 100644
@@ -5,7 +5,7 @@
 
 #include <asm/gpio.h>
 #include <asm/arch/clock.h>
-#include <asm/mach-imx/sys_proto.h>
+#include <asm/arch/sys_proto.h>
 
 int board_late_init(void)
 {
@@ -14,3 +14,11 @@ int board_late_init(void)
 
 	return 0;
 }
+
+#if IS_ENABLED(CONFIG_OF_BOARD_FIXUP)
+int board_fix_fdt(void *fdt)
+{
+	/* Remove nodes based on fuses. */
+	return imx9_uboot_fixup_by_fuse(fdt);
+}
+#endif
configs/imx943_evk_defconfig +0 -1
index 70265f13bba..6fca85a3242 100644
@@ -26,7 +26,6 @@ CONFIG_SYS_LOAD_ADDR=0x90400000
 CONFIG_SPL=y
 CONFIG_SPL_RECOVER_DATA_SECTION=y
 CONFIG_PCI=y
-CONFIG_OF_BOARD_FIXUP=y
 CONFIG_SYS_MEMTEST_START=0x90000000
 CONFIG_SYS_MEMTEST_END=0xA0000000
 CONFIG_REMAKE_ELF=y
configs/imx952_evk_defconfig +0 -1
index 66a56ddb879..b74df3a5d5f 100644
@@ -28,7 +28,6 @@ CONFIG_SPL_OF_LIBFDT_ASSUME_MASK=0x0
 CONFIG_SPL=y
 CONFIG_SPL_RECOVER_DATA_SECTION=y
 CONFIG_PCI=y
-CONFIG_OF_BOARD_FIXUP=y
 CONFIG_SYS_MEMTEST_START=0x90000000
 CONFIG_SYS_MEMTEST_END=0xA0000000
 CONFIG_REMAKE_ELF=y
Signature · 1 line
2.50.1
Acked-by on v1 2/4
#2 lore raw

Re: [PATCH 2/4] imx9: scmi: Print CPU part number name

In reply to Ye Li
Quoted 11 lines · Ye Li

Decode the CPU part number from PART_NUM fuse and print it in CPU name.

For iMX95 and iMX952 Part number fuse is defined as:
[7:6] : Package description
[5:2] : Segment
[1:0] : Number of A55 cores

For iMX94, the PART_NUM[7:0] fuse directly reflects the part number value.

Acked-by on v1 3/4
#4 lore raw

Re: [PATCH 3/4] iMX9: scmi: Disable fused modules for iMX95/94/952

In reply to Ye Li
Quoted 7 lines · Ye Li

Disable relevant modules in kernel FDT and u-boot FDT according to fuse settings on iMX95/94/952.
For u-boot FDT fixup, introduce a common function that each board needs this fixup could select OF_BOARD_FIXUP and implement board_fix_fdt to call imx9_uboot_fixup_by_fuse.

Applied
#8 lore raw
In reply to Ye Li
Quoted 6 lines · Ye Li

The value '01' in MARKET_SEGMENT fuse is Extended industrial on iMX95/952/94. Fix its temperature range to -40C to 125C

01` - Ext. Industrial -40C to 125C

Applied to fsl-qoirq/next.

Thanks,
Peng