Skip to contentSkip to conversation

imx9: various update

PATCH Superseded Peng Fan (OSS) 3 participants 37 messages Sep 17, 2024 – Sep 18, 2024

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover imx9: various update

Several updates to i.MX9 SOC and i.MX93 EVK, the related code has been in NXP downstream for some time and gone through several public releases. Some are directly cherry-picked(with R-b kept), some are modified from downtream.

This patchset includes:
power domain on fixes
TRDC cleanup and update
MAC address update
i.MX9301/9302 included.
runtime detection of voltage mode
PMIC update
generalize some code for i.MX8M and i.MX9
i.MX93 EVK update and misc.

CI passed.

---
Frank Li (1):
imx9: soc: Serial No align with rom setting

Jacky Bai (1):
imx9: soc: Mask the wdog reset in src by default on i.mx9

Peng Fan (11):
imx9: soc: wait ssar when power on power domain
imx9: soc: Change second Ethernet MAC fuse layout
imx8m: soc: Drop disable_pmu_cpu_nodes
imx: generialize disable_cpu_nodes
imx9: soc: Disable cpu1 for variants that only has one A55 core
imx: generalize fixup_thermal_trips
imx9: trdc: cleanup code
imx9: trdc: introduce trdc_mbc_blk_num
imx93_evk: spl: update pmic settings
imx93_evk: Remove CONFIG_IMX9_LOW_DRIVE_MODE and ld defconfig
imx93_evk: add back Low drive mode ddr timing file

Ye Li (8):
imx9: soc: Configure TRDC for M33 TCM access
imx9: soc: Print UID in big endian format for EL2GO
imx9: soc: Change FSB directly access to fuse API
imx9: soc: Add function to get target voltage mode
imx9: clock: Update clock init function and sequence
imx9: Add 233Mhz DDR PLL frequency
imx93: Add Low performance parts 9302/9301 support
imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

 arch/arm/include/asm/arch-imx/cpu.h                |    2 +
 arch/arm/include/asm/arch-imx9/clock.h             |    3 +-
 arch/arm/include/asm/arch-imx9/imx-regs.h          |    7 +
 arch/arm/include/asm/arch-imx9/sys_proto.h         |   11 +
 arch/arm/include/asm/mach-imx/sys_proto.h          |    8 +-
 arch/arm/mach-imx/Makefile                         |    6 +
 arch/arm/mach-imx/fdt.c                            |  129 ++
 arch/arm/mach-imx/imx8m/soc.c                      |  179 +-
 arch/arm/mach-imx/imx9/Kconfig                     |    6 +-
 arch/arm/mach-imx/imx9/clock.c                     |   40 +-
 arch/arm/mach-imx/imx9/soc.c                       |  246 ++-
 arch/arm/mach-imx/imx9/trdc.c                      |  175 +-
 board/freescale/imx93_evk/Makefile                 |    6 +-
 board/freescale/imx93_evk/imx93_evk.c              |   33 +
 board/freescale/imx93_evk/lpddr4x_timing_1866mts.c | 1995 ++++++++++++++++++++
 board/freescale/imx93_evk/lpddr4x_timing_ld.c      | 1496 ---------------
 board/freescale/imx93_evk/spl.c                    |   55 +-
 board/phytec/phycore_imx93/spl.c                   |    2 +-
 configs/imx93_11x11_evk_ld_defconfig               |  126 --
 drivers/cpu/imx8_cpu.c                             |    4 +
 drivers/ddr/imx/phy/ddrphy_utils.c                 |    4 +
 include/power/pca9450.h                            |    2 +
 22 files changed, 2602 insertions(+), 1933 deletions(-)

---
base-commit: 1630ff26cc960439b5949b80cfc604a2c8aa47dd
change-id: 20240916-imx9-update-0ce38f6ccd3d

Best regards,

Signature · 1 line
Peng Fan <[email protected]>
#1 lore raw

PATCH 1/21 imx9: soc: wait ssar when power on power domain

From: Peng Fan <[email protected]>

SSAR handshake done means power on finished, not ISO done. so correct the waiting mask.

Fixes 0256577a83b ("imx: imx9: Add MIX power init")
---
 arch/arm/include/asm/arch-imx9/imx-regs.h | 1 +
 arch/arm/mach-imx/imx9/soc.c              | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-imx9/imx-regs.h +1 -0
index 76d241eab09..9953c33b73b 100644
@@ -38,6 +38,7 @@
 #define SRC_MIX_SLICE_FUNC_STAT_PSW_STAT BIT(0)
 #define SRC_MIX_SLICE_FUNC_STAT_RST_STAT BIT(2)
 #define SRC_MIX_SLICE_FUNC_STAT_ISO_STAT BIT(4)
+#define SRC_MIX_SLICE_FUNC_STAT_SSAR_STAT BIT(8)
 #define SRC_MIX_SLICE_FUNC_STAT_MEM_STAT BIT(12)
 
 #define IMG_CONTAINER_BASE             (0x80000000UL)
arch/arm/mach-imx/imx9/soc.c +1 -1
index 32208220b20..9b6ba5609d2 100644
@@ -752,7 +752,7 @@ static int mix_power_init(enum mix_power_domain pd)
 	/* power on */
 	clrbits_le32(&mix_regs->slice_sw_ctrl, BIT(31));
 	val = readl(&mix_regs->func_stat);
-	while (val & SRC_MIX_SLICE_FUNC_STAT_ISO_STAT)
+	while (val & SRC_MIX_SLICE_FUNC_STAT_SSAR_STAT)
 		val = readl(&mix_regs->func_stat);
 
 	return 0;
Signature · 1 line
2.35.3
#2 lore raw

PATCH 2/21 imx9: soc: Configure TRDC for M33 TCM access

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

On OSCCA part, M33 TCM is used for ROM PATCH and protected by ELE ROM. So after release TRDC, we need to configure TRDC for M33 TCM, otherwise A55 can't access the TCM.

---
 arch/arm/include/asm/arch-imx9/imx-regs.h |  1 +
 arch/arm/mach-imx/imx9/soc.c              | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-imx9/imx-regs.h +1 -0
index 9953c33b73b..fb6de533d12 100644
@@ -25,6 +25,7 @@
 #define ANATOP_BASE_ADDR    0x44480000UL
 
 #define BLK_CTRL_WAKEUPMIX_BASE_ADDR 0x42420000
+#define BLK_CTRL_NS_ANOMIX_BASE_ADDR  0x44210000
 #define BLK_CTRL_S_ANOMIX_BASE_ADDR  0x444f0000
 
 #define SRC_IPS_BASE_ADDR	(0x44460000)
arch/arm/mach-imx/imx9/soc.c +13 -1
index 9b6ba5609d2..25b9116f2a6 100644
@@ -792,7 +792,7 @@ int m33_prepare(void)
 		(struct src_general_regs *)(ulong)SRC_GLOBAL_RBASE;
 	struct blk_ctrl_s_aonmix_regs *s_regs =
 			(struct blk_ctrl_s_aonmix_regs *)BLK_CTRL_S_ANOMIX_BASE_ADDR;
-	u32 val;
+	u32 val, i;
 
 	if (m33_is_rom_kicked())
 		return -EPERM;
@@ -817,6 +817,18 @@ int m33_prepare(void)
 	/* Set ELE LP handshake for M33 reset */
 	setbits_le32(&s_regs->lp_handshake[0], BIT(6));
 
+	/* OSCCA enabled, reconfigure TRDC for TCM access, otherwise ECC init will raise error */
+	val = readl(BLK_CTRL_NS_ANOMIX_BASE_ADDR + 0x28);
+	if (val & BIT(0)) {
+		trdc_mbc_set_control(0x44270000, 1, 0, 0x6600);
+
+		for (i = 0; i < 32; i++)
+			trdc_mbc_blk_config(0x44270000, 1, 3, 0, i, true, 0);
+
+		for (i = 0; i < 32; i++)
+			trdc_mbc_blk_config(0x44270000, 1, 3, 1, i, true, 0);
+	}
+
 	/* Clear M33 TCM for ECC */
 	memset((void *)(ulong)0x201e0000, 0, 0x40000);
 
Signature · 1 line
2.35.3
#3 lore raw

PATCH 3/21 imx9: soc: Serial No align with rom setting

In reply to Peng Fan (OSS)

From: Frank Li <[email protected]>

ROM use UID[0] and UID[1] as serial number with big endian when usb serial download.

After update this, uuu(>1.6) can use below command to filter out devices when multi boards connected.

uuu -ms <serial#> ...

[sudo] uuu -lsusb can list known devices with serial# informaiton.

---
 arch/arm/mach-imx/imx9/soc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx9/soc.c +2 -2
index 25b9116f2a6..f458fc0564e 100644
@@ -563,8 +563,8 @@ void get_board_serial(struct tag_serialnr *serialnr)
 	printf("UID: 0x%x 0x%x 0x%x 0x%x\n",
 	       gd->arch.uid[0], gd->arch.uid[1], gd->arch.uid[2], gd->arch.uid[3]);
 
-	serialnr->low = gd->arch.uid[0];
-	serialnr->high = gd->arch.uid[3];
+	serialnr->low = __be32_to_cpu(gd->arch.uid[1]);
+	serialnr->high = __be32_to_cpu(gd->arch.uid[0]);
 }
 #endif
 
Signature · 1 line
2.35.3
reviewer
#4 lore raw

Re: [PATCH 03/21] imx9: soc: Serial No align with rom setting

Subject could be improved:

imx9: soc: Align UID endianness with ROM

Quoted 5 lines · Peng Fan (OSS)

From: Frank Li <[email protected]>

ROM use UID[0] and UID[1] as serial number with big endian when usb serial download.

#5 lore raw

PATCH 4/21 imx9: soc: Print UID in big endian format for EL2GO

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

Print UID in big endian format and as one buffer of bytes, so customer can directly use it for EL2GO.

Before:
UID: 0xf6c8ae93 0x0f46b326 0x10d61eb3 0x0583c2d2

Become:
UID: 93aec8f626b3460fb31ed610d2c28305

---
 arch/arm/mach-imx/imx9/soc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx9/soc.c +3 -2
index f458fc0564e..7df3c686350 100644
@@ -560,8 +560,9 @@ int ft_system_setup(void *blob, struct bd_info *bd)
 #if defined(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)
 void get_board_serial(struct tag_serialnr *serialnr)
 {
-	printf("UID: 0x%x 0x%x 0x%x 0x%x\n",
-	       gd->arch.uid[0], gd->arch.uid[1], gd->arch.uid[2], gd->arch.uid[3]);
+	printf("UID: %08x%08x%08x%08x\n", __be32_to_cpu(gd->arch.uid[0]),
+	       __be32_to_cpu(gd->arch.uid[1]), __be32_to_cpu(gd->arch.uid[2]),
+	       __be32_to_cpu(gd->arch.uid[3]));
 
 	serialnr->low = __be32_to_cpu(gd->arch.uid[1]);
 	serialnr->high = __be32_to_cpu(gd->arch.uid[0]);
Signature · 1 line
2.35.3
reviewer
#6 lore raw

Re: [PATCH 04/21] imx9: soc: Print UID in big endian format for EL2GO

Quoted 5 lines · Peng Fan (OSS)

From: Ye Li <[email protected]>

Print UID in big endian format and as one buffer of bytes, so customer can directly use it for EL2GO.

What is EL2GO?

#7 lore raw

RE: [PATCH 04/21] imx9: soc: Print UID in big endian format for EL2GO

Quoted 6 lines

Subject: Re: [PATCH 04/21] imx9: soc: Print UID in big endian format for EL2GO

Quoted 1 line · Peng Fan (OSS)
Quoted 7 lines
Quoted 3 lines

From: Ye Li <[email protected]>

Print UID in big endian format and as one buffer of bytes, so

customer

Quoted 1 line

can directly use it for EL2GO.

What is EL2GO?

EdgeLock 2GO

https://www.nxp.com/products/security-and-authentication/secure-service-2go-platform/edgelock-2go:EDGELOCK-2GO

Thanks,
Peng.

#8 lore raw

PATCH 5/21 imx9: soc: Change FSB directly access to fuse API

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

To support OSCCA enabled part which has disabled FSB access from SOC, change directly read from FSB to use fuse_read API.

---
 arch/arm/mach-imx/imx9/soc.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)
arch/arm/mach-imx/imx9/soc.c +21 -5
index 7df3c686350..42c6deedbf2 100644
@@ -96,10 +96,14 @@ int mmc_get_env_dev(void)
  */
 u32 get_cpu_speed_grade_hz(void)
 {
+	int ret;
 	u32 speed, max_speed;
 	u32 val;
 
-	fuse_read(2, 3, &val);
+	ret = fuse_read(2, 3, &val);
+	if (ret)
+		val = 0; /* If read fuse failed, return as blank fuse */
+
 	val = FIELD_GET(SPEED_GRADING_MASK, val) & 0xF;
 
 	speed = MHZ(2300) - val * MHZ(100);
@@ -122,9 +126,13 @@ u32 get_cpu_speed_grade_hz(void)
  */
 u32 get_cpu_temp_grade(int *minc, int *maxc)
 {
+	int ret;
 	u32 val;
 
-	fuse_read(2, 3, &val);
+	ret = fuse_read(2, 3, &val);
+	if (ret)
+		val = 0; /* If read fuse failed, return as blank fuse */
+
 	val = FIELD_GET(MARKETING_GRADING_MASK, val);
 
 	if (minc && maxc) {
@@ -160,9 +168,17 @@ static void set_cpu_info(struct ele_get_info_data *info)
 
 static u32 get_cpu_variant_type(u32 type)
 {
-	/* word 19 */
-	u32 val = readl((ulong)FSB_BASE_ADDR + 0x8000 + (19 << 2));
-	u32 val2 = readl((ulong)FSB_BASE_ADDR + 0x8000 + (20 << 2));
+	u32 val, val2;
+	int ret;
+
+	ret = fuse_read(2, 3, &val);
+	if (ret)
+		val = 0; /* If read fuse failed, return as blank fuse */
+
+	ret = fuse_read(2, 4, &val2);
+	if (ret)
+		val2 = 0; /* If read fuse failed, return as blank fuse */
+
 	bool npu_disable = !!(val & BIT(13));
 	bool core1_disable = !!(val & BIT(15));
 	u32 pack_9x9_fused = BIT(4) | BIT(17) | BIT(19) | BIT(24);
Signature · 1 line
2.35.3
reviewer
#9 lore raw

Re: [PATCH 05/21] imx9: soc: Change FSB directly access to fuse API

Review

Quoted 2 lines · Peng Fan (OSS)
(quoted diff) +1 -1
-       fuse_read(2, 3, &val);
+       ret = fuse_read(2, 3, &val);

Please use proper definitions for the 2 and 3 here.

arch/arm/mach-imx/imx9/soc.c static void set_cpu_info(struct ele_get_info_data *info) · line 174

Quoted 2 lines
arch/arm/mach-imx/imx9/soc.c +2 -0
+
+       ret = fuse_read(2, 3, &val);

Same here.

arch/arm/mach-imx/imx9/soc.c static void set_cpu_info(struct ele_get_info_data *info) · line 178

Quoted 4 lines
arch/arm/mach-imx/imx9/soc.c +4 -0
+       if (ret)
+               val = 0; /* If read fuse failed, return as blank fuse */
+
+       ret = fuse_read(2, 4, &val2);

Same here.

#10 lore raw

PATCH 6/21 imx9: soc: Change second Ethernet MAC fuse layout

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

The second Ethernet MAC (eQOS) fuse layout is changed since i.MX93 A1 following other i.MX platforms, for example i.MX8MP.

Order for A0:
MAC1_ADDR[15:0]
MAC1_ADDR[31:16]
MAC1_ADDR[47:32]
MAC2_ADDR[47:32]
MAC2_ADDR[15:0]
MAC2_ADDR[31:16]

Order since A1:
MAC1_ADDR[15:0]
MAC1_ADDR[31:16]
MAC1_ADDR[47:32]
MAC2_ADDR[15:0]
MAC2_ADDR[31:16]
MAC2_ADDR[47:32]

---
 arch/arm/mach-imx/imx9/soc.c | 54 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 48 insertions(+), 6 deletions(-)
arch/arm/mach-imx/imx9/soc.c +48 -6
index 42c6deedbf2..5b0fada8295 100644
@@ -496,12 +496,21 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 		if (ret)
 			goto err;
 
-		mac[0] = val[1] >> 24;
-		mac[1] = val[1] >> 16;
-		mac[2] = val[0] >> 24;
-		mac[3] = val[0] >> 16;
-		mac[4] = val[0] >> 8;
-		mac[5] = val[0];
+		if (is_imx93() && is_soc_rev(CHIP_REV_1_0)) {
+			mac[0] = val[1] >> 24;
+			mac[1] = val[1] >> 16;
+			mac[2] = val[0] >> 24;
+			mac[3] = val[0] >> 16;
+			mac[4] = val[0] >> 8;
+			mac[5] = val[0];
+		} else {
+			mac[0] = val[0] >> 24;
+			mac[1] = val[0] >> 16;
+			mac[2] = val[0] >> 8;
+			mac[3] = val[0];
+			mac[4] = val[1] >> 24;
+			mac[5] = val[1] >> 16;
+		}
 	}
 
 	debug("%s: MAC%d: %02x.%02x.%02x.%02x.%02x.%02x\n",
@@ -565,6 +574,39 @@ static int fixup_thermal_trips(void *blob, const char *name)
 	return 0;
 }
 
+void build_info(void)
+{
+	u32 fw_version, sha1, res, status;
+	int ret;
+
+	printf("\nBuildInfo:\n");
+
+	ret = ele_get_fw_status(&status, &res);
+	if (ret) {
+		printf("  - ELE firmware status failed %d, 0x%x\n", ret, res);
+	} else if ((status & 0xff) == 1) {
+		ret = ele_get_fw_version(&fw_version, &sha1, &res);
+		if (ret) {
+			printf("  - ELE firmware version failed %d, 0x%x\n", ret, res);
+		} else {
+			printf("  - ELE firmware version %u.%u.%u-%x",
+			       (fw_version & (0x00ff0000)) >> 16,
+			       (fw_version & (0x0000fff0)) >> 4,
+			       (fw_version & (0x0000000f)), sha1);
+			((fw_version & (0x80000000)) >> 31) == 1 ? puts("-dirty\n") : puts("\n");
+		}
+	} else {
+		printf("  - ELE firmware not included\n");
+	}
+	puts("\n");
+}
+
+int arch_misc_init(void)
+{
+	build_info();
+	return 0;
+}
+
 int ft_system_setup(void *blob, struct bd_info *bd)
 {
 	if (fixup_thermal_trips(blob, "cpu-thermal"))
Signature · 1 line
2.35.3
reviewer
#11 lore raw

Re: [PATCH 06/21] imx9: soc: Change second Ethernet MAC fuse layout

Quoted 15 lines · Peng Fan (OSS)
arch/arm/mach-imx/imx9/soc.c +15 -0
+void build_info(void)
+{
+       u32 fw_version, sha1, res, status;
+       int ret;
+
+       printf("\nBuildInfo:\n");
+
+       ret = ele_get_fw_status(&status, &res);
+       if (ret) {
+               printf("  - ELE firmware status failed %d, 0x%x\n", ret, res);
+       } else if ((status & 0xff) == 1) {
+               ret = ele_get_fw_version(&fw_version, &sha1, &res);
+               if (ret) {
+                       printf("  - ELE firmware version failed %d, 0x%x\n", ret, res);
+               } else {

arch/arm/mach-imx/imx9/soc.c static int fixup_thermal_trips(void *blob, const char *name) · line 601

Quoted 10 lines
arch/arm/mach-imx/imx9/soc.c +10 -0
+                       printf("  - ELE firmware version %u.%u.%u-%x",
+                              (fw_version & (0x00ff0000)) >> 16,
+                              (fw_version & (0x0000fff0)) >> 4,
+                              (fw_version & (0x0000000f)), sha1);
+                       ((fw_version & (0x80000000)) >> 31) == 1 ? puts("-dirty\n") : puts("\n");
+               }
+       } else {
+               printf("  - ELE firmware not included\n");
+       }
+       puts("\n");

This build_info() is unrelated to changing the second MAC address layout.

It should be a separate patch.

#12 lore raw

RE: [PATCH 06/21] imx9: soc: Change second Ethernet MAC fuse layout

Quoted 34 lines

Subject: Re: [PATCH 06/21] imx9: soc: Change second Ethernet MAC fuse layout

Quoted 4 lines · Peng Fan (OSS)
arch/arm/mach-imx/imx9/soc.c +4 -0
+void build_info(void)
+{
+       u32 fw_version, sha1, res, status;
+       int ret;

arch/arm/mach-imx/imx9/soc.c static int fixup_thermal_trips(void *blob, const char *name)

Quoted 10 lines
arch/arm/mach-imx/imx9/soc.c +10 -0
+
+       printf("\nBuildInfo:\n");
+
+       ret = ele_get_fw_status(&status, &res);
+       if (ret) {
+               printf("  - ELE firmware status failed %d, 0x%x\n", ret, res);
+       } else if ((status & 0xff) == 1) {
+               ret = ele_get_fw_version(&fw_version, &sha1, &res);
+               if (ret) {
+                       printf("  - ELE firmware version failed %d, 0x%x\n", ret,

res);

arch/arm/mach-imx/imx9/soc.c static int fixup_thermal_trips(void *blob, const char *name)

Quoted 6 lines
arch/arm/mach-imx/imx9/soc.c +6 -0
+               } else {
+                       printf("  - ELE firmware version %u.%u.%u-%x",
+                              (fw_version & (0x00ff0000)) >> 16,
+                              (fw_version & (0x0000fff0)) >> 4,
+                              (fw_version & (0x0000000f)), sha1);
+                       ((fw_version & (0x80000000)) >> 31) == 1 ? puts("-

dirty\n") : puts("\n");

arch/arm/mach-imx/imx9/soc.c static int fixup_thermal_trips(void *blob, const char *name) · line 601

Quoted 5 lines
arch/arm/mach-imx/imx9/soc.c +5 -0
+               }
+       } else {
+               printf("  - ELE firmware not included\n");
+       }
+       puts("\n");
Quoted 4 lines

This build_info() is unrelated to changing the second MAC address layout.

It should be a separate patch.

Ah. This is a mistaken when I do git rebase to resolve errors.

I will fix.

Thanks,
Peng.

#13 lore raw

PATCH 7/21 imx9: soc: Add function to get target voltage mode

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

Replace the static CONFIG_IMX9_LOW_DRIVE_MODE with runtime target voltage mode by checking the part's SPEED GRADE fuse.
SPL will configure to highest A55 speed which is indicated by the SPEED fuse and select corresponding voltage mode.

---
 arch/arm/include/asm/arch-imx9/sys_proto.h |  11 +++
 arch/arm/mach-imx/imx9/clock.c             |  31 +++++++--
 arch/arm/mach-imx/imx9/soc.c               | 107 +++++++++++++++++++++++++++++
 board/freescale/imx93_evk/spl.c            |   2 +-
 4 files changed, 143 insertions(+), 8 deletions(-)
arch/arm/include/asm/arch-imx9/sys_proto.h +11 -0
index 2f7a1292758..e4bf6a63424 100644
@@ -8,7 +8,18 @@
 
 #include <asm/mach-imx/sys_proto.h>
 
+enum imx9_soc_voltage_mode {
+	VOLT_LOW_DRIVE = 0,
+	VOLT_NOMINAL_DRIVE,
+	VOLT_OVER_DRIVE,
+};
+
 void soc_power_init(void);
 bool m33_is_rom_kicked(void);
 int m33_prepare(void);
+
+enum imx9_soc_voltage_mode soc_target_voltage_mode(void);
+
+#define is_voltage_mode(mode) (soc_target_voltage_mode() == (mode))
+
 #endif
arch/arm/mach-imx/imx9/clock.c +24 -7
index 0abf4579a1e..1433e68874d 100644
@@ -603,7 +603,7 @@ void init_clk_usdhc(u32 index)
 {
 	u32 div;
 
-	if (IS_ENABLED(CONFIG_IMX9_LOW_DRIVE_MODE))
+	if (is_voltage_mode(VOLT_LOW_DRIVE))
 		div = 3; /* 266.67 Mhz */
 	else
 		div = 2; /* 400 Mhz */
@@ -700,8 +700,7 @@ void set_arm_core_max_clk(void)
 
 #endif
 
-#if IS_ENABLED(CONFIG_IMX9_LOW_DRIVE_MODE)
-struct imx_clk_setting imx_clk_settings[] = {
+struct imx_clk_setting imx_clk_ld_settings[] = {
 	/* Set A55 clk to 500M */
 	{ARM_A55_CLK_ROOT, SYS_PLL_PFD0, 2},
 	/* Set A55 periphal to 200M */
@@ -728,7 +727,7 @@ struct imx_clk_setting imx_clk_settings[] = {
 	/* NIC_APB to 133M */
 	{NIC_APB_CLK_ROOT, SYS_PLL_PFD1_DIV2, 3}
 };
-#else
+
 struct imx_clk_setting imx_clk_settings[] = {
 	/*
 	 * Set A55 clk to 500M. This clock root is normally used as intermediate
@@ -762,9 +761,18 @@ struct imx_clk_setting imx_clk_settings[] = {
 	/* NIC_APB to 133M */
 	{NIC_APB_CLK_ROOT, SYS_PLL_PFD1_DIV2, 3}
 };
-#endif
 
-int clock_init(void)
+void bus_clock_init_low_drive(void)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(imx_clk_ld_settings); i++) {
+		ccm_clk_root_cfg(imx_clk_ld_settings[i].clk_root,
+				 imx_clk_ld_settings[i].src, imx_clk_ld_settings[i].div);
+	}
+}
+
+void bus_clock_init(void)
 {
 	int i;
 
@@ -772,9 +780,18 @@ int clock_init(void)
 		ccm_clk_root_cfg(imx_clk_settings[i].clk_root,
 				 imx_clk_settings[i].src, imx_clk_settings[i].div);
 	}
+}
 
-	if (IS_ENABLED(CONFIG_IMX9_LOW_DRIVE_MODE))
+int clock_init(void)
+{
+	int i;
+
+	if (is_voltage_mode(VOLT_LOW_DRIVE)) {
+		bus_clock_init_low_drive();
 		set_arm_clk(MHZ(900));
+	} else {
+		bus_clock_init();
+	}
 
 	/* allow for non-secure access */
 	for (i = 0; i < OSCPLL_END; i++)
arch/arm/mach-imx/imx9/soc.c +107 -0

121 lines not on this page · raw message

board/freescale/imx93_evk/spl.c +1 -1
index e5807134bb2..e4999baa95f 100644
@@ -77,7 +77,7 @@ int power_init_board(void)
 	/* enable DVS control through PMIC_STBY_REQ */
 	pmic_reg_write(dev, PCA9450_BUCK1CTRL, 0x59);
 
-	if (IS_ENABLED(CONFIG_IMX9_LOW_DRIVE_MODE)) {
+	if (is_voltage_mode(VOLT_LOW_DRIVE))
 		/* 0.75v for Low drive mode
 		 */
 		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS0, 0x0c);
Signature · 1 line
2.35.3
reviewer
#14 lore raw

Re: [PATCH 07/21] imx9: soc: Add function to get target voltage mode

Quoted 4 lines · Peng Fan (OSS)

From: Ye Li <[email protected]>

Replace the static CONFIG_IMX9_LOW_DRIVE_MODE with runtime target

Should the IMX9_LOW_DRIVE_MODE symbol be deleted then?

reviewer
#15 lore raw

Re: [PATCH 07/21] imx9: soc: Add function to get target voltage mode

Quoted 1 line · Fabio Estevam

Should the IMX9_LOW_DRIVE_MODE symbol be deleted then?

Ah, I see it gets removed in patch 19.

#16 lore raw

PATCH 8/21 imx9: clock: Update clock init function and sequence

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

Since we use SPEED GRADE fuse to set A55 frequency, remove the set_arm_core_low_drive_clk function which has hard coded frequency. And adjust clock_init called sequence and split it to early and late functions.
Set the authen register in early function, because CCF driver checks NS bit.
Set bus and core clock in late function, because the fuse read and SoC type/rev depend on ELE.

---
 arch/arm/include/asm/arch-imx9/clock.h |  3 ++-
 arch/arm/mach-imx/imx9/clock.c         | 22 ++++++++++++++--------
 arch/arm/mach-imx/imx9/soc.c           |  2 +-
 board/freescale/imx93_evk/spl.c        |  4 +++-
 board/phytec/phycore_imx93/spl.c       |  2 +-
 5 files changed, 21 insertions(+), 12 deletions(-)
arch/arm/include/asm/arch-imx9/clock.h +2 -1
index 1ce6ac4c3a8..76f12118592 100644
@@ -211,7 +211,8 @@ struct imx_clk_setting {
 	u32 div;
 };
 
-int clock_init(void);
+int clock_init_early(void);
+int clock_init_late(void);
 u32 get_clk_src_rate(enum ccm_clk_src source);
 u32 get_lpuart_clk(void);
 void init_uart_clk(u32 index);
arch/arm/mach-imx/imx9/clock.c +14 -8
index 1433e68874d..76d19f1cba3 100644
@@ -782,17 +782,10 @@ void bus_clock_init(void)
 	}
 }
 
-int clock_init(void)
+int clock_init_early(void)
 {
 	int i;
 
-	if (is_voltage_mode(VOLT_LOW_DRIVE)) {
-		bus_clock_init_low_drive();
-		set_arm_clk(MHZ(900));
-	} else {
-		bus_clock_init();
-	}
-
 	/* allow for non-secure access */
 	for (i = 0; i < OSCPLL_END; i++)
 		ccm_clk_src_tz_access(i, true, false, false);
@@ -809,6 +802,19 @@ int clock_init(void)
 	return 0;
 }
 
+/* Set bus and A55 core clock per voltage mode */
+int clock_init_late(void)
+{
+	if (is_voltage_mode(VOLT_LOW_DRIVE)) {
+		bus_clock_init_low_drive();
+		set_arm_core_max_clk();
+	} else {
+		bus_clock_init();
+	}
+
+	return 0;
+}
+
 int set_clk_eqos(enum enet_freq type)
 {
 	u32 eqos_post_div;
arch/arm/mach-imx/imx9/soc.c +1 -1
index a55863bf456..8a577b98255 100644
@@ -733,7 +733,7 @@ int arch_cpu_init(void)
 		/* Disable wdog */
 		init_wdog();
 
-		clock_init();
+		clock_init_early();
 
 		trdc_early_init();
 
board/freescale/imx93_evk/spl.c +3 -1
index e4999baa95f..2ad7489ada7 100644
@@ -123,9 +123,11 @@ void board_init_f(ulong dummy)
 		debug("LC: 0x%x\n", gd->arch.lifecycle);
 	}
 
+	clock_init_late();
+
 	power_init_board();
 
-	if (!IS_ENABLED(CONFIG_IMX9_LOW_DRIVE_MODE))
+	if (!is_voltage_mode(VOLT_LOW_DRIVE))
 		set_arm_clk(get_cpu_speed_grade_hz());
 
 	/* Init power of mix */
board/phytec/phycore_imx93/spl.c +1 -1
index 5efa38a1442..17a8736c73f 100644
@@ -130,7 +130,7 @@ void board_init_f(ulong dummy)
 		debug("LC: 0x%x\n", gd->arch.lifecycle);
 	}
 
-	clock_init();
+	clock_init_late();
 
 	power_init_board();
 
Signature · 1 line
2.35.3
#17 lore raw

PATCH 9/21 imx9: soc: Mask the wdog reset in src by default on i.mx9

In reply to Peng Fan (OSS)

From: Jacky Bai <[email protected]>

Normally, the wdog will be used for trigger external PMIC reset through the WDOG_ANY pin. If the PMIC chip has debounce logic for the reset signal, in some corner case the wdog can NOT trigger external PMIC reset if the SoC has been reset internal before the PMIC captures the WDOG_ANY pin reset, so need to keep the WDOG3-5 reset masked in the SRC to let the PMIC to do the reset safely.

---
 arch/arm/mach-imx/imx9/soc.c | 6 ------
 1 file changed, 6 deletions(-)
arch/arm/mach-imx/imx9/soc.c +0 -6
index 8a577b98255..a73e73adfe6 100644
@@ -232,15 +232,9 @@ static void disable_wdog(void __iomem *wdog_base)
 
 void init_wdog(void)
 {
-	u32 src_val;
-
 	disable_wdog((void __iomem *)WDG3_BASE_ADDR);
 	disable_wdog((void __iomem *)WDG4_BASE_ADDR);
 	disable_wdog((void __iomem *)WDG5_BASE_ADDR);
-
-	src_val = readl(0x54460018); /* reset mask */
-	src_val &= ~0x1c;
-	writel(src_val, 0x54460018);
 }
 
 static struct mm_region imx93_mem_map[] = {
Signature · 1 line
2.35.3
#18 lore raw

PATCH 10/21 imx9: Add 233Mhz DDR PLL frequency

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

To support 1.866GTS LPDDR4x timing script, need to add 233Mhz freq to DDR PLL for second mission point at 933MTS. Otherwise DDR training will fail.

---
 arch/arm/mach-imx/imx9/clock.c     | 1 +
 drivers/ddr/imx/phy/ddrphy_utils.c | 4 ++++
 2 files changed, 5 insertions(+)
arch/arm/mach-imx/imx9/clock.c +1 -0
index 76d19f1cba3..12685f970de 100644
@@ -41,6 +41,7 @@ static struct imx_fracpll_rate_table imx9_fracpll_tbl[] = {
 	FRAC_PLL_RATE(466000000U, 1, 155, 8, 1, 3), /* 466Mhz */
 	FRAC_PLL_RATE(400000000U, 1, 200, 12, 0, 1), /* 400Mhz */
 	FRAC_PLL_RATE(300000000U, 1, 150, 12, 0, 1),
+	FRAC_PLL_RATE(233000000U, 1, 174, 18, 3, 4), /* 233Mhz */
 };
 
 /* return in khz */
drivers/ddr/imx/phy/ddrphy_utils.c +4 -0
index cf5bdad7abe..14278f5ad8f 100644
@@ -148,6 +148,10 @@ void ddrphy_init_set_dfi_clk(unsigned int drate)
 		dram_pll_init(MHZ(266));
 		dram_disable_bypass();
 		break;
+	case 933:
+		dram_pll_init(MHZ(233));
+		dram_disable_bypass();
+		break;
 	case 667:
 		dram_pll_init(MHZ(167));
 		dram_disable_bypass();
Signature · 1 line
2.35.3
#19 lore raw

PATCH 11/21 imx8m: soc: Drop disable_pmu_cpu_nodes

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use PPI for PMU interrupts, there is no reason to update interrupt-affinity for PMU even interrupt-affinity was wrongly added to device tree before.

---
 arch/arm/mach-imx/imx8m/soc.c | 38 --------------------------------------
 1 file changed, 38 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +0 -38
index be38ca52885..9ed27b59303 100644
@@ -1171,43 +1171,6 @@ static void disable_thermal_cpu_nodes(void *blob, u32 disabled_cores)
 	}
 }
 
-static void disable_pmu_cpu_nodes(void *blob, u32 disabled_cores)
-{
-	static const char * const pmu_path[] = {
-		"/pmu"
-	};
-
-	int nodeoff, cnt, i, ret, j;
-	u32 irq_affinity[4];
-
-	for (i = 0; i < ARRAY_SIZE(pmu_path); i++) {
-		nodeoff = fdt_path_offset(blob, pmu_path[i]);
-		if (nodeoff < 0)
-			continue; /* Not found, skip it */
-
-		cnt = fdtdec_get_int_array_count(blob, nodeoff, "interrupt-affinity",
-						 irq_affinity, 4);
-		if (cnt < 0)
-			continue;
-
-		if (cnt != 4)
-			printf("Warning: %s, interrupt-affinity count %d\n", pmu_path[i], cnt);
-
-		for (j = 0; j < cnt; j++)
-			irq_affinity[j] = cpu_to_fdt32(irq_affinity[j]);
-
-		ret = fdt_setprop(blob, nodeoff, "interrupt-affinity", &irq_affinity,
-				 sizeof(u32) * (4 - disabled_cores));
-		if (ret < 0) {
-			printf("Warning: %s, interrupt-affinity setprop failed %d\n",
-			       pmu_path[i], ret);
-			continue;
-		}
-
-		printf("Update node %s, interrupt-affinity prop\n", pmu_path[i]);
-	}
-}
-
 static int disable_cpu_nodes(void *blob, u32 disabled_cores)
 {
 	static const char * const nodes_path[] = {
@@ -1241,7 +1204,6 @@ static int disable_cpu_nodes(void *blob, u32 disabled_cores)
 	}
 
 	disable_thermal_cpu_nodes(blob, disabled_cores);
-	disable_pmu_cpu_nodes(blob, disabled_cores);
 
 	return 0;
 }
Signature · 1 line
2.35.3
#20 lore raw

PATCH 12/21 imx: generialize disable_cpu_nodes

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

disable_cpu_nodes could be reused by i.MX9, so move disable_cpu_nodes out from mach-imx/imx8m/soc.c to mach-imx/fdt.c and update disable_cpu_nodes to make it easy to support different socs.

---
 arch/arm/include/asm/mach-imx/sys_proto.h |  2 +
 arch/arm/mach-imx/Makefile                |  1 +
 arch/arm/mach-imx/fdt.c                   | 87 +++++++++++++++++++++++++++
 arch/arm/mach-imx/imx8m/soc.c             | 99 ++++---------------------------
 4 files changed, 103 insertions(+), 86 deletions(-)
arch/arm/include/asm/mach-imx/sys_proto.h +2 -0
index 31ae179b211..d93e095e191 100644
@@ -275,4 +275,6 @@ void enable_ca7_smp(void);
 
 enum boot_device get_boot_device(void);
 
+int disable_cpu_nodes(void *blob, const char * const *nodes_path,
+		      u32 num_disabled_cores, u32 max_cores);
 #endif
arch/arm/mach-imx/Makefile +1 -0
index 5262dca4ffd..47e2cb8d943 100644
@@ -12,6 +12,7 @@ endif
 ifeq ($(SOC),$(filter $(SOC),imx8m))
 ifneq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
+obj-y += fdt.o
 endif
 obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o
 obj-$(CONFIG_FEC_MXC) += mac.o
arch/arm/mach-imx/fdt.c new file +87 -0

87 lines not on this page · raw message

arch/arm/mach-imx/imx8m/soc.c +13 -86

143 lines not on this page · raw message

Signature · 1 line
2.35.3
reviewer
#21 lore raw

Re: [PATCH 12/21] imx: generialize disable_cpu_nodes

Typo in the Subject: Generalize

Quoted 6 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

disable_cpu_nodes could be reused by i.MX9, so move disable_cpu_nodes out from mach-imx/imx8m/soc.c to mach-imx/fdt.c and update disable_cpu_nodes to make it easy to support different socs.

#22 lore raw

PATCH 13/21 imx9: soc: Disable cpu1 for variants that only has one A55 core

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Disale CPU1 for i.MX93 variants that only has one A55 core and update cooling maps.

---
 arch/arm/mach-imx/Makefile   | 7 ++++++-
 arch/arm/mach-imx/imx9/soc.c | 8 ++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
arch/arm/mach-imx/Makefile +6 -1
index 47e2cb8d943..f8903afc92e 100644
@@ -12,7 +12,6 @@ endif
 ifeq ($(SOC),$(filter $(SOC),imx8m))
 ifneq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
-obj-y += fdt.o
 endif
 obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o
 obj-$(CONFIG_FEC_MXC) += mac.o
@@ -22,6 +21,12 @@ obj-$(CONFIG_IMX_HAB) += hab.o
 obj-y += cpu.o
 endif
 
+ifeq ($(SOC),$(filter $(SOC),imx8m imx9))
+ifneq ($(CONFIG_SPL_BUILD),y)
+obj-y += fdt.o
+endif
+endif
+
 ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
 obj-y	+= cpu.o speed.o
 ifneq ($(CONFIG_MX51),y)
arch/arm/mach-imx/imx9/soc.c +8 -0
index a73e73adfe6..0f8ea55eb51 100644
@@ -688,9 +688,17 @@ int board_fix_fdt(void *fdt)
 
 int ft_system_setup(void *blob, struct bd_info *bd)
 {
+	static const char * const nodes_path[] = {
+		"/cpus/cpu@0",
+		"/cpus/cpu@100",
+	};
+
 	if (fixup_thermal_trips(blob, "cpu-thermal"))
 		printf("Failed to update cpu-thermal trip(s)");
 
+	if (is_imx9351() || is_imx9331() || is_imx9321() || is_imx9311())
+		disable_cpu_nodes(blob, nodes_path, 1, 2);
+
 	if (is_voltage_mode(VOLT_LOW_DRIVE))
 		low_drive_freq_update(blob);
 
Signature · 1 line
2.35.3
#23 lore raw

PATCH 14/21 imx93: Add Low performance parts 9302/9301 support

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

Add support for iMX93 low performance parts 9302 and 9301 which restrict to low drive voltage only.
The parts run A55 max speed at 900Mhz and M33 at 133Mhz, have NPU and A55 core1 (9301) disabled.

---
 arch/arm/include/asm/arch-imx/cpu.h       | 2 ++
 arch/arm/include/asm/mach-imx/sys_proto.h | 5 ++++-
 arch/arm/mach-imx/imx9/Kconfig            | 1 +
 arch/arm/mach-imx/imx9/soc.c              | 6 +++++-
 drivers/cpu/imx8_cpu.c                    | 4 ++++
 5 files changed, 16 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-imx/cpu.h +2 -0
index cbd2717f97c..b0468a1a136 100644
@@ -68,6 +68,8 @@
 #define MXC_CPU_IMX9321		0xC6 /* dummy ID */
 #define MXC_CPU_IMX9312		0xC7 /* dummy ID */
 #define MXC_CPU_IMX9311		0xC8 /* dummy ID */
+#define MXC_CPU_IMX9302		0xC9 /* dummy ID */
+#define MXC_CPU_IMX9301		0xCA /* dummy ID */
 
 #define MXC_SOC_MX6		0x60
 #define MXC_SOC_MX7		0x70
arch/arm/include/asm/mach-imx/sys_proto.h +4 -1
index d93e095e191..c146a223b71 100644
@@ -85,7 +85,8 @@ struct bd_info;
 #define is_imx93() (is_cpu_type(MXC_CPU_IMX93) || is_cpu_type(MXC_CPU_IMX9331) || \
 	is_cpu_type(MXC_CPU_IMX9332) || is_cpu_type(MXC_CPU_IMX9351) || \
 	is_cpu_type(MXC_CPU_IMX9322) || is_cpu_type(MXC_CPU_IMX9321) || \
-	is_cpu_type(MXC_CPU_IMX9312) || is_cpu_type(MXC_CPU_IMX9311))
+	is_cpu_type(MXC_CPU_IMX9312) || is_cpu_type(MXC_CPU_IMX9311) || \
+	is_cpu_type(MXC_CPU_IMX9302) || is_cpu_type(MXC_CPU_IMX9301))
 #define is_imx9351() (is_cpu_type(MXC_CPU_IMX9351))
 #define is_imx9332() (is_cpu_type(MXC_CPU_IMX9332))
 #define is_imx9331() (is_cpu_type(MXC_CPU_IMX9331))
@@ -93,6 +94,8 @@ struct bd_info;
 #define is_imx9321() (is_cpu_type(MXC_CPU_IMX9321))
 #define is_imx9312() (is_cpu_type(MXC_CPU_IMX9312))
 #define is_imx9311() (is_cpu_type(MXC_CPU_IMX9311))
+#define is_imx9302() (is_cpu_type(MXC_CPU_IMX9302))
+#define is_imx9301() (is_cpu_type(MXC_CPU_IMX9301))
 
 #define is_imxrt1020() (is_cpu_type(MXC_CPU_IMXRT1020))
 #define is_imxrt1050() (is_cpu_type(MXC_CPU_IMXRT1050))
arch/arm/mach-imx/imx9/Kconfig +1 -0
index e892da80fe8..63e75b6806e 100644
@@ -30,6 +30,7 @@ choice
 
 config TARGET_IMX93_11X11_EVK
 	bool "imx93_11x11_evk"
+	select OF_BOARD_FIXUP
 	select IMX93
 	imply OF_UPSTREAM
 
arch/arm/mach-imx/imx9/soc.c +5 -1
index 0f8ea55eb51..d00162c6fdf 100644
@@ -183,6 +183,10 @@ static u32 get_cpu_variant_type(u32 type)
 	bool core1_disable = !!(val & BIT(15));
 	u32 pack_9x9_fused = BIT(4) | BIT(17) | BIT(19) | BIT(24);
 
+	/* Low performance 93 part */
+	if (((val >> 6) & 0x3F) == 0xE && npu_disable)
+		return core1_disable ? MXC_CPU_IMX9301 : MXC_CPU_IMX9302;
+
 	if ((val2 & pack_9x9_fused) == pack_9x9_fused)
 		type = MXC_CPU_IMX9322;
 
@@ -696,7 +700,7 @@ int ft_system_setup(void *blob, struct bd_info *bd)
 	if (fixup_thermal_trips(blob, "cpu-thermal"))
 		printf("Failed to update cpu-thermal trip(s)");
 
-	if (is_imx9351() || is_imx9331() || is_imx9321() || is_imx9311())
+	if (is_imx9351() || is_imx9331() || is_imx9321() || is_imx9311() || is_imx9301())
 		disable_cpu_nodes(blob, nodes_path, 1, 2);
 
 	if (is_voltage_mode(VOLT_LOW_DRIVE))
drivers/cpu/imx8_cpu.c +4 -0
index 60deca963a6..6c0a8c0cbe4 100644
@@ -60,6 +60,10 @@ static const char *get_imx_type_str(u32 imxtype)
 		return "93(12)";/* iMX93 9x9 Dual core without NPU */
 	case MXC_CPU_IMX9311:
 		return "93(11)";/* iMX93 9x9 Single core without NPU */
+	case MXC_CPU_IMX9302:
+		return "93(02)";/* iMX93 900Mhz Low performance Dual core without NPU */
+	case MXC_CPU_IMX9301:
+		return "93(01)";/* iMX93 900Mhz Low performance Single core without NPU */
 	default:
 		return "??";
 	}
Signature · 1 line
2.35.3
#24 lore raw

PATCH 15/21 imx: generalize fixup_thermal_trips

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M and i.MX9 have duplicated fixup_thermal_trips, so move it to arch/arm/mach-imx/fdt.c to avoid duplicated code.

---
 arch/arm/include/asm/mach-imx/sys_proto.h |  1 +
 arch/arm/mach-imx/fdt.c                   | 42 +++++++++++++++++++++++++++++++
 arch/arm/mach-imx/imx8m/soc.c             | 42 -------------------------------
 arch/arm/mach-imx/imx9/soc.c              | 42 -------------------------------
 4 files changed, 43 insertions(+), 84 deletions(-)
arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
index c146a223b71..31ace977d2b 100644
@@ -280,4 +280,5 @@ enum boot_device get_boot_device(void);
 
 int disable_cpu_nodes(void *blob, const char * const *nodes_path,
 		      u32 num_disabled_cores, u32 max_cores);
+int fixup_thermal_trips(void *blob, const char *name);
 #endif
arch/arm/mach-imx/fdt.c +42 -0

45 lines not on this page · raw message

arch/arm/mach-imx/imx8m/soc.c +0 -42

48 lines not on this page · raw message

arch/arm/mach-imx/imx9/soc.c +0 -42

48 lines not on this page · raw message

Signature · 1 line
2.35.3
#25 lore raw

PATCH 16/21 imx9: trdc: cleanup code

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Replace magic number with meaningful macros.

---
 arch/arm/include/asm/arch-imx9/imx-regs.h |   5 +
 arch/arm/mach-imx/imx9/trdc.c             | 156 ++++++++++++++++++------------
 2 files changed, 101 insertions(+), 60 deletions(-)
arch/arm/include/asm/arch-imx9/imx-regs.h +5 -0
index fb6de533d12..44f6a95f23b 100644
@@ -50,6 +50,11 @@
 #define BCTRL_GPR_ENET_QOS_INTF_SEL_RGMII        (0x1 << 1)
 #define BCTRL_GPR_ENET_QOS_CLK_GEN_EN            (0x1 << 0)
 
+#define TRDC_AON_BASE		(0x44270000UL)
+#define TRDC_WAKEUP_BASE	(0x42460000UL)
+#define TRDC_MEGA_BASE		(0x42810000UL)
+#define TRDC_NIC_BASE		(0x49010000UL)
+
 #define MARKETING_GRADING_MASK	GENMASK(5, 4)
 #define SPEED_GRADING_MASK	GENMASK(11, 6)
 
arch/arm/mach-imx/imx9/trdc.c +96 -60

260 lines not on this page · raw message

Signature · 1 line
2.35.3
#26 lore raw

PATCH 17/21 imx9: trdc: introduce trdc_mbc_blk_num

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Add trdc_mbc_blk_num to get num blks in a MBC mem slot, then drop the hardcoded value '40' for NIC OCRAM configuration.

---
 arch/arm/mach-imx/imx9/trdc.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
arch/arm/mach-imx/imx9/trdc.c +20 -1
index ae1a46d1331..ef0f8b52a4d 100644
@@ -19,6 +19,7 @@
 #define MRC_MAX_NUM 2
 #define MBC_NUM(HWCFG) (((HWCFG) >> 16) & 0xF)
 #define MRC_NUM(HWCFG) (((HWCFG) >> 24) & 0x1F)
+#define MBC_BLK_NUM(GLBCFG)	((GLBCFG) & 0x3FF)
 
 enum {
 	/* Order following ELE API Spec, not change */
@@ -154,6 +155,22 @@ static ulong trdc_get_mrc_base(ulong trdc_reg, u32 mrc_x)
 	return trdc_reg + 0x10000 + 0x2000 * mbc_num + 0x1000 * mrc_x;
 }
 
+static u32 trdc_mbc_blk_num(ulong trdc_reg, u32 mbc_x, u32 mem_x)
+{
+	struct trdc_mbc *mbc_base = (struct trdc_mbc *)trdc_get_mbc_base(trdc_reg, mbc_x);
+	struct mbc_mem_dom *mbc_dom;
+	u32 glbcfg;
+
+	if (mbc_base == 0)
+		return 0;
+
+	/* only first dom has the glbcfg */
+	mbc_dom = &mbc_base->mem_dom[0];
+	glbcfg = readl((uintptr_t)&mbc_dom->mem_glbcfg[mem_x]);
+
+	return MBC_BLK_NUM(glbcfg);
+}
+
 int trdc_mbc_set_control(ulong trdc_reg, u32 mbc_x, u32 glbac_id, u32 glbac_val)
 {
 	struct trdc_mbc *mbc_base = (struct trdc_mbc *)trdc_get_mbc_base(trdc_reg, mbc_x);
@@ -383,6 +400,7 @@ int release_rdc(u8 xrdc)
 void trdc_early_init(void)
 {
 	int ret = 0, i;
+	u32 blks;
 
 	ret |= release_rdc(TRDC_A);
 	ret |= release_rdc(TRDC_M);
@@ -397,7 +415,8 @@ void trdc_early_init(void)
 	/* Set OCRAM to RWX for secure, when OEM_CLOSE, the image is RX only */
 	trdc_mbc_set_control(TRDC_NIC_BASE, MBC(3), GLOBAL_ID(0), PERM(0x7700));
 
-	for (i = 0; i < 40; i++) {
+	blks = trdc_mbc_blk_num(TRDC_NIC_BASE, MBC(3), MEM(0));
+	for (i = 0; i < blks; i++) {
 		trdc_mbc_blk_config(TRDC_NIC_BASE, MBC(3), DOM(3), MEM(0), i,
 				    true, GLOBAL_ID(0));
 
Signature · 1 line
2.35.3
#27 lore raw

PATCH 18/21 imx93_evk: spl: update pmic settings

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

1. Use runtime voltage selection for LD/OD/ND mode.
2. According to latest PE/TE report, the voltages of VDD_SOC for LD and ND mode need add 50mv margin, so LD voltage is 0.75v->0.8v, ND voltage is 0.8v->0.85v.
3. Use TOFF_DEB to differentiate new trimmed pmic and old pmic

---
 board/freescale/imx93_evk/spl.c | 42 +++++++++++++++++++++++++++++++----------
 include/power/pca9450.h         |  2 ++
 2 files changed, 34 insertions(+), 10 deletions(-)
board/freescale/imx93_evk/spl.c +32 -10
index 2ad7489ada7..503286ce3af 100644
@@ -62,6 +62,7 @@ int power_init_board(void)
 {
 	struct udevice *dev;
 	int ret;
+	unsigned int val = 0, buck_val;
 
 	ret = pmic_get("pmic@25", &dev);
 	if (ret == -ENODEV) {
@@ -77,20 +78,41 @@ int power_init_board(void)
 	/* enable DVS control through PMIC_STBY_REQ */
 	pmic_reg_write(dev, PCA9450_BUCK1CTRL, 0x59);
 
-	if (is_voltage_mode(VOLT_LOW_DRIVE))
-		/* 0.75v for Low drive mode
-		 */
-		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS0, 0x0c);
-		pmic_reg_write(dev, PCA9450_BUCK3OUT_DVS0, 0x0c);
+	ret = pmic_reg_read(dev, PCA9450_PWR_CTRL);
+	if (ret < 0)
+		return ret;
+
+	val = ret;
+
+	if (is_voltage_mode(VOLT_LOW_DRIVE)) {
+		buck_val = 0x0c; /* 0.8v for Low drive mode */
+		printf("PMIC: Low Drive Voltage Mode\n");
+	} else if (is_voltage_mode(VOLT_NOMINAL_DRIVE)) {
+		buck_val = 0x10; /* 0.85v for Nominal drive mode */
+		printf("PMIC: Nominal Voltage Mode\n");
+	} else {
+		buck_val = 0x14; /* 0.9v for Over drive mode */
+		printf("PMIC: Over Drive Voltage Mode\n");
+	}
+
+	if (val & PCA9450_REG_PWRCTRL_TOFF_DEB) {
+		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS0, buck_val);
+		pmic_reg_write(dev, PCA9450_BUCK3OUT_DVS0, buck_val);
 	} else {
-		/* 0.9v for Over drive mode
-		 */
-		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS0, 0x18);
-		pmic_reg_write(dev, PCA9450_BUCK3OUT_DVS0, 0x18);
+		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS0, buck_val + 0x4);
+		pmic_reg_write(dev, PCA9450_BUCK3OUT_DVS0, buck_val + 0x4);
+	}
+
+	if (IS_ENABLED(CONFIG_IMX93_EVK_LPDDR4X)) {
+		/* Set VDDQ to 1.1V from buck2 */
+		pmic_reg_write(dev, PCA9450_BUCK2OUT_DVS0, 0x28);
 	}
 
 	/* set standby voltage to 0.65v */
-	pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS1, 0x4);
+	if (val & PCA9450_REG_PWRCTRL_TOFF_DEB)
+		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS1, 0x0);
+	else
+		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS1, 0x4);
 
 	/* I2C_LT_EN*/
 	pmic_reg_write(dev, 0xa, 0x3);
include/power/pca9450.h +2 -0
index b8219d535ad..f896d829d37 100644
@@ -54,6 +54,8 @@ enum {
 	PCA9450_REG_NUM,
 };
 
+#define PCA9450_REG_PWRCTRL_TOFF_DEB    BIT(5)
+
 int power_pca9450_init(unsigned char bus, unsigned char addr);
 
 enum {
Signature · 1 line
2.35.3
#28 lore raw

PATCH 19/21 imx93_evk: Remove CONFIG_IMX9_LOW_DRIVE_MODE and ld defconfig

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Remove unused CONFIG_IMX9_LOW_DRIVE_MODE kconfig and imx93_11x11_evk_ld_defconfig.
Remove the ld timing file.
The LD mode support will be added back with runtime detection later.

---
 arch/arm/mach-imx/imx9/Kconfig                |    5 -
 board/freescale/imx93_evk/Makefile            |    4 -
 board/freescale/imx93_evk/lpddr4x_timing_ld.c | 1496 -------------------------
 configs/imx93_11x11_evk_ld_defconfig          |  126 ---
 4 files changed, 1631 deletions(-)
arch/arm/mach-imx/imx9/Kconfig +0 -5
index 63e75b6806e..4d32c28670d 100644
@@ -5,11 +5,6 @@ config AHAB_BOOT
     help
     This option enables the support for AHAB secure boot.
 
-config IMX9_LOW_DRIVE_MODE
-    bool "Configure to i.MX9 low drive mode"
-    help
-    This option enables the settings for iMX9 low drive mode.
-
 config IMX9
 	bool
 	select BINMAN
board/freescale/imx93_evk/Makefile +0 -4
index 17956d24bf7..575f8e94604 100644
@@ -8,9 +8,5 @@ obj-y += imx93_evk.o
 
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
-ifdef CONFIG_IMX9_LOW_DRIVE_MODE
-obj-$(CONFIG_IMX93_EVK_LPDDR4X) += lpddr4x_timing_ld.o
-else
 obj-$(CONFIG_IMX93_EVK_LPDDR4X) += lpddr4x_timing.o
 endif
-endif
board/freescale/imx93_evk/lpddr4x_timing_ld.c deleted +0 -1496

1,496 lines not on this page · raw message

configs/imx93_11x11_evk_ld_defconfig deleted +0 -126

126 lines not on this page · raw message

Signature · 1 line
2.35.3
#29 lore raw

PATCH 20/21 imx93_evk: add back Low drive mode ddr timing file

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Add back low drive mode 1866mts ddr timing file, no need CONFIG_IMX9_LOW_DRIVE_MODE anymore, using runtime selection.

---
 board/freescale/imx93_evk/Makefile                 |    2 +-
 board/freescale/imx93_evk/lpddr4x_timing_1866mts.c | 1995 ++++++++++++++++++++
 board/freescale/imx93_evk/spl.c                    |    9 +-
 3 files changed, 2004 insertions(+), 2 deletions(-)
board/freescale/imx93_evk/Makefile +1 -1
index 575f8e94604..ede8d20ff5c 100644
@@ -8,5 +8,5 @@ obj-y += imx93_evk.o
 
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
-obj-$(CONFIG_IMX93_EVK_LPDDR4X) += lpddr4x_timing.o
+obj-$(CONFIG_IMX93_EVK_LPDDR4X) += lpddr4x_timing.o lpddr4x_timing_1866mts.o
 endif
board/freescale/imx93_evk/lpddr4x_timing_1866mts.c new file +1995 -0

1,995 lines not on this page · raw message

board/freescale/imx93_evk/spl.c +8 -1
index 503286ce3af..a214c04ddad 100644
@@ -52,9 +52,16 @@ void spl_board_init(void)
 	puts("Normal Boot\n");
 }
 
+extern struct dram_timing_info dram_timing_1866mts;
 void spl_dram_init(void)
 {
-	ddr_init(&dram_timing);
+	struct dram_timing_info *ptiming = &dram_timing;
+
+	if (is_voltage_mode(VOLT_LOW_DRIVE))
+		ptiming = &dram_timing_1866mts;
+
+	printf("DDR: %uMTS\n", ptiming->fsp_msg[0].drate);
+	ddr_init(ptiming);
 }
 
 #if CONFIG_IS_ENABLED(DM_PMIC_PCA9450)
Signature · 1 line
2.35.3
#30 lore raw

PATCH 21/21 imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

VPCIe_3V3 is used to supply the power to M.2 card, we must enable it before using the flash.
The SD3_nRST is connected to reset pin of flash, must deassert (pull up) it.

---
 board/freescale/imx93_evk/imx93_evk.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
board/freescale/imx93_evk/imx93_evk.c +33 -0
index 341831a7d30..08da1563f03 100644
@@ -17,6 +17,7 @@
 #include <dm/uclass.h>
 #include <usb.h>
 #include <dwc3-uboot.h>
+#include <asm/gpio.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -48,11 +49,43 @@ int board_phy_config(struct phy_device *phydev)
 	return 0;
 }
 
+static void board_gpio_init(void)
+{
+	struct gpio_desc desc;
+	int ret;
+
+	/* Enable EXT1_PWREN for PCIE_3.3V */
+	ret = dm_gpio_lookup_name("gpio@22_13", &desc);
+	if (ret)
+		return;
+
+	ret = dm_gpio_request(&desc, "EXT1_PWREN");
+	if (ret)
+		return;
+
+	dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
+	dm_gpio_set_value(&desc, 1);
+
+	/* Deassert SD3_nRST */
+	ret = dm_gpio_lookup_name("gpio@22_12", &desc);
+	if (ret)
+		return;
+
+	ret = dm_gpio_request(&desc, "SD3_nRST");
+	if (ret)
+		return;
+
+	dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
+	dm_gpio_set_value(&desc, 1);
+}
+
 int board_init(void)
 {
 	if (IS_ENABLED(CONFIG_FEC_MXC))
 		setup_fec();
 
+	board_gpio_init();
+
 	return 0;
 }
 
Signature · 1 line
2.35.3
reviewer
#31 lore raw

Re: [PATCH 21/21] imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

Hi Peng,

Quoted 5 lines · Peng Fan (OSS)

From: Ye Li <[email protected]>

VPCIe_3V3 is used to supply the power to M.2 card, we must enable it before using the flash.

Flash? Which flash are you referring to?

#32 lore raw

RE: [PATCH 21/21] imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

Quoted 8 lines

Subject: Re: [PATCH 21/21] imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

Hi Peng,

Quoted 1 line · Peng Fan (OSS)
Quoted 7 lines
Quoted 3 lines

From: Ye Li <[email protected]>

VPCIe_3V3 is used to supply the power to M.2 card, we must enable

it

Quoted 1 line

before using the flash.

Flash? Which flash are you referring to?

There is a mt25qu512abb8e12 flash connected with flexspi interface.

Regards,
Peng.

reviewer
#33 lore raw

Re: [PATCH 21/21] imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

In reply to Peng Fan (OSS)

Hi Peng,

Quoted 13 lines · Peng Fan (OSS)
board/freescale/imx93_evk/imx93_evk.c +13 -0
+       /* Enable EXT1_PWREN for PCIE_3.3V */
+       ret = dm_gpio_lookup_name("gpio@22_13", &desc);
+       if (ret)
+               return;
+
+       ret = dm_gpio_request(&desc, "EXT1_PWREN");
+       if (ret)
+               return;
+
+       dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
+       dm_gpio_set_value(&desc, 1);
+
+       /* Deassert SD3_nRST */

board/freescale/imx93_evk/imx93_evk.c int board_phy_config(struct phy_device *phydev) · line 79

Quoted 10 lines
board/freescale/imx93_evk/imx93_evk.c +10 -0
+       ret = dm_gpio_lookup_name("gpio@22_12", &desc);
+       if (ret)
+               return;
+
+       ret = dm_gpio_request(&desc, "SD3_nRST");
+       if (ret)
+               return;
+
+       dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
+       dm_gpio_set_value(&desc, 1);

Why do we need all this board code? This should be properly described in the devicetree.

How does Linux deal with it?

#34 lore raw

RE: [PATCH 21/21] imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

Hi Fabio,

Quoted 26 lines

Subject: Re: [PATCH 21/21] imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

Hi Peng,

Quoted 18 lines · Peng Fan (OSS)
board/freescale/imx93_evk/imx93_evk.c +18 -0
+       /* Enable EXT1_PWREN for PCIE_3.3V */
+       ret = dm_gpio_lookup_name("gpio@22_13", &desc);
+       if (ret)
+               return;
+
+       ret = dm_gpio_request(&desc, "EXT1_PWREN");
+       if (ret)
+               return;
+
+       dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
+       dm_gpio_set_value(&desc, 1);
+
+       /* Deassert SD3_nRST */
+       ret = dm_gpio_lookup_name("gpio@22_12", &desc);
+       if (ret)
+               return;
+
+       ret = dm_gpio_request(&desc, "SD3_nRST");
Quoted 8 lines

board/freescale/imx93_evk/imx93_evk.c int board_phy_config(struct phy_device *phydev) · line 67

Quoted 5 lines
board/freescale/imx93_evk/imx93_evk.c +5 -0
+       if (ret)
+               return;
+
+       dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
+       dm_gpio_set_value(&desc, 1);

Why do we need all this board code? This should be properly described in the devicetree.

I just cherry-picked the patches from imx v2024.04, I agree your point that the board code should be dropped.

Quoted 2 lines

How does Linux deal with it?

The linux changes still in downstream as below:
/*
* For this spi-nor on M.2 card, need first enable the VPCIe_3.3v.
* Note, VPCIe_3.3v need about 1.74ms to change from 0v to 3.3v.
* U-boot already enable VPCIe_3.3v, so in linux, can ignore this
* 1.7ms, if u-boot do not eanble VPCIe_3.3v first, then need to
* take care of the 1.74ms delay, better to build the flexspi driver
* as module in driver to avoid spi-nor probe fail.
*/
pinctrl-assert-gpios = <&pcal6524 13 GPIO_ACTIVE_HIGH>, /* enable VPCIe_3v3 */
<&pcal6524 20 GPIO_ACTIVE_HIGH>, /* enable SPI-NOR VCC 1.8v */ <&pcal6524 12 GPIO_ACTIVE_HIGH>; /* put SPI-NOR RST pin to 1.8v */

To use device tree, need use reset-gpios property I think.

Regards,
Peng.

reviewer
#35 lore raw

Re: [PATCH 21/21] imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

Quoted 10 lines · Peng Fan

The linux changes still in downstream as below:
/*
* For this spi-nor on M.2 card, need first enable the VPCIe_3.3v.
* Note, VPCIe_3.3v need about 1.74ms to change from 0v to 3.3v.
* U-boot already enable VPCIe_3.3v, so in linux, can ignore this
* 1.7ms, if u-boot do not eanble VPCIe_3.3v first, then need to
* take care of the 1.74ms delay, better to build the flexspi driver
* as module in driver to avoid spi-nor probe fail.
*/
pinctrl-assert-gpios = <&pcal6524 13 GPIO_ACTIVE_HIGH>, /* enable VPCIe_3v3 */

This 'pinctrl-assert-gpios' is a NXP hack. It only exists in the NXP kernel.

#36 lore raw

RE: [PATCH 21/21] imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

Quoted 17 lines

Subject: Re: [PATCH 21/21] imx93_evk: Enable M.2 VPCIe_3V3 and deassert SD3_nRST

Quoted 4 lines · Peng Fan

The linux changes still in downstream as below:
/*
* For this spi-nor on M.2 card, need first enable the VPCIe_3.3v.
* Note, VPCIe_3.3v need about 1.74ms to change from 0v to

3.3v.

Quoted 6 lines

* U-boot already enable VPCIe_3.3v, so in linux, can ignore this
* 1.7ms, if u-boot do not eanble VPCIe_3.3v first, then need to
* take care of the 1.74ms delay, better to build the flexspi driver
* as module in driver to avoid spi-nor probe fail.
*/
pinctrl-assert-gpios = <&pcal6524 13 GPIO_ACTIVE_HIGH>, /*

Quoted 3 lines

enable VPCIe_3v3 */

This 'pinctrl-assert-gpios' is a NXP hack. It only exists in the NXP kernel.

Yeah, reset-gpios should be used here.

Regards,
Peng.