Skip to contentSkip to conversation

j721s2: j784s4: Add workaround for errata i2437

PATCH In review Udit Kumar 2 participants 5 messages Apr 15 – May 11

Subsystems (2)
lore
Share & tools
lore

Udit Kumar

author
#0 lore raw

v2 cover j721s2: j784s4: Add workaround for errata i2437

Add a necessary hardware errata workaround for J721S2 and J784S4.

Bootlogs
https://gist.github.com/uditkumarti/da2a489a78d3241ecd2791c9df1c1317

Changelog:
Changes in v2:
1- Added verified macro (this is new patch)
2- updated macro from ERRATA2437 to ERRATA_2437
3- instead of using hardcoded write, used verified write macro

Link to v1:
https://lore.kernel.org/u-boot/[email protected]/

Neha Malcom Francis (2):
arch: mach-k3: j721s2_init: Add workaround for errata i2437
arch: mach-k3: j784s4_init: Add workaround for errata i2437

Udit Kumar (1):
arm: mach-k3: arm: mach-k3: Add writel_verify macro for register write
verification

 arch/arm/mach-k3/include/mach/hardware.h | 10 ++++++
 arch/arm/mach-k3/j721s2/j721s2_init.c    | 39 ++++++++++++++++++++++++
 arch/arm/mach-k3/j784s4/j784s4_init.c    | 39 ++++++++++++++++++++++++
 3 files changed, 88 insertions(+)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/3 arm: mach-k3: arm: mach-k3: Add writel_verify macro for register write verification

Add a helper macro to write and verify a 32-bit value to a memory-mapped register. This is essential for hardware errata workarounds that require confirmation that register writes have taken effect before proceeding with initialization.

---
 arch/arm/mach-k3/include/mach/hardware.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/mach-k3/include/mach/hardware.h +10 -0
index 81b5f1fa45e..b337a71956f 100644
@@ -126,4 +126,14 @@ struct rom_extended_boot_data {
 
 u32 get_boot_device(void);
 const char *get_reset_reason(void);
+
+#define writel_verify(val, addr) \
+do { \
+	u32 readback; \
+	writel(val, addr); \
+	readback = readl(addr); \
+	if (readback != val) \
+		printf("writel_verify failed: addr=0x%p, expected=0x%x, got=0x%x\n", \
+		       (void *)(addr), (val), readback); \
+} while (0)
 #endif /* _ASM_ARCH_HARDWARE_H_ */
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v2 3/3 arch: mach-k3: j784s4_init: Add workaround for errata i2437

In reply to Udit Kumar

From: Neha Malcom Francis <[email protected]>

Add the workaround proposed for J784S4 errata i2437 (link) for SE clock-gating turning off too early. Without this, a hardware bug present in C7120 leads to C7120 CPU hanging.

---
 arch/arm/mach-k3/j784s4/j784s4_init.c | 39 +++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
arch/arm/mach-k3/j784s4/j784s4_init.c +39 -0
index 53f152ccd9c..507b7ab685a 100644
@@ -45,6 +45,15 @@
 #define NB_THREADMAP_BIT1				BIT(1)
 #define NB_THREADMAP_BIT2				BIT(2)
 
+/*
+ * RAT mapping for errata ID: i2437
+ */
+#define RAT_ERRATA_2437_BASE_REGION0		0x40f90000
+#define RAT_ERRATA_2437_IN_ADDR			0xc0000000
+#define RAT_ERRATA_2437_OUT_ADDR_U		0x0000004d
+#define RAT_ERRATA_2437_OUT_ADDR_L		0x21000000
+#define RAT_ERRATA_2437_CTRL			0x80000010
+
 struct fwl_data infra_cbass0_fwls[] = {
 	{ "PSC0", 5, 1 },
 	{ "PLL_CTRL0", 6, 1 },
@@ -322,6 +331,36 @@ void board_init_f(ulong dummy)
 		setup_navss_nb();
 
 	setup_qos();
+
+	if (IS_ENABLED(CONFIG_CPU_V7R)) {
+		/*
+		 * Errata ID i2437 SE Clock-Gating Turning Off Too Early
+		 *
+		 * A hardware bug is present in the C7120 Streaming Engine top level
+		 * clock gating logic that can lead to the C7120 CPU hanging.
+
+		 * Workaround: The DSP_<COREID>_DEBUG_CLKEN_OVERRIDE fields of the
+		 * COMPUTE_CLUSTER_CFG_WRAP_0_CC_CNTRL register (where COREID is the
+		 * name of the specific C7120 core) must be enabled before power-up
+		 * of the C7120 core to override all clock-gating.
+		 */
+
+		/* Setup RAT mapping */
+		debug("Errata i2437: Use RAT for COMPUTE_CLUSTER_CFG_WRAP_0_CC_CNTRL register\n");
+		writel_verify(RAT_ERRATA_2437_IN_ADDR, RAT_ERRATA_2437_BASE_REGION0 + 0x24);
+		writel_verify(RAT_ERRATA_2437_OUT_ADDR_L, RAT_ERRATA_2437_BASE_REGION0 + 0x28);
+		writel_verify(RAT_ERRATA_2437_OUT_ADDR_U, RAT_ERRATA_2437_BASE_REGION0 + 0x2c);
+		writel_verify(RAT_ERRATA_2437_CTRL, RAT_ERRATA_2437_BASE_REGION0 + 0x20);
+
+		/* Enable DSP_X_DEBUG_CLKEN_OVERRIDE for C71x cores */
+		writel_verify(0xF00, RAT_ERRATA_2437_IN_ADDR + 0x200);
+
+		/* Clear RAT mapping */
+		writel_verify(0, RAT_ERRATA_2437_BASE_REGION0 + 0x20);
+		writel_verify(0, RAT_ERRATA_2437_BASE_REGION0 + 0x24);
+		writel_verify(0, RAT_ERRATA_2437_BASE_REGION0 + 0x28);
+		writel_verify(0, RAT_ERRATA_2437_BASE_REGION0 + 0x2c);
+	}
 }
 
 u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v2 2/3 arch: mach-k3: j721s2_init: Add workaround for errata i2437

In reply to Udit Kumar

From: Neha Malcom Francis <[email protected]>

Add the workaround proposed for J721S2 errata i2437 (link) for SE clock-gating turning off too early. Without this, a hardware bug present in C7120 leads to C7120 CPU hanging.

---
 arch/arm/mach-k3/j721s2/j721s2_init.c | 39 +++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
arch/arm/mach-k3/j721s2/j721s2_init.c +39 -0
index b5453d8895d..780d853423f 100644
@@ -40,6 +40,15 @@
 #define NB_THREADMAP_BIT1				BIT(1)
 #define NB_THREADMAP_BIT2				BIT(2)
 
+/*
+ * RAT mapping for errata ID: i2437
+ */
+#define RAT_ERRATA_2437_BASE_REGION0		0x40f90000
+#define RAT_ERRATA_2437_IN_ADDR			0xc0000000
+#define RAT_ERRATA_2437_OUT_ADDR_U		0x0000004d
+#define RAT_ERRATA_2437_OUT_ADDR_L		0x21000000
+#define RAT_ERRATA_2437_CTRL			0x80000010
+
 struct fwl_data cbass_hc_cfg0_fwls[] = {
 	{ "PCIE0_CFG", 2577, 7 },
 	{ "EMMC8SS0_CFG", 2579, 4 },
@@ -346,6 +355,36 @@ void board_init_f(ulong dummy)
 		if (ret)
 			printf("AVS init failed: %d\n", ret);
 	}
+
+	if (IS_ENABLED(CONFIG_CPU_V7R)) {
+		/*
+		 * Errata ID i2437: SE Clock-Gating Turning Off Too Early
+		 *
+		 * A hardware bug is present in the C7120 Streaming Engine top level
+		 * clock gating logic that can lead to the C7120 CPU hanging.
+
+		 * Workaround: The DSP_<COREID>_DEBUG_CLKEN_OVERRIDE fields of the
+		 * COMPUTE_CLUSTER_CFG_WRAP_0_CC_CNTRL register (where COREID is the
+		 * name of the specific C7120 core) must be enabled before power-up
+		 * of the C7120 core to override all clock-gating.
+		 */
+
+		/* Setup RAT mapping */
+		debug("Errata i2437: Use RAT for COMPUTE_CLUSTER_CFG_WRAP_0_CC_CNTRL register\n");
+		writel_verify(RAT_ERRATA_2437_IN_ADDR, RAT_ERRATA_2437_BASE_REGION0 + 0x24);
+		writel_verify(RAT_ERRATA_2437_OUT_ADDR_L, RAT_ERRATA_2437_BASE_REGION0 + 0x28);
+		writel_verify(RAT_ERRATA_2437_OUT_ADDR_U, RAT_ERRATA_2437_BASE_REGION0 + 0x2c);
+		writel_verify(RAT_ERRATA_2437_CTRL, RAT_ERRATA_2437_BASE_REGION0 + 0x20);
+
+		/* Enable DSP_X_DEBUG_CLKEN_OVERRIDE for C71x cores */
+		writel_verify(0x300, RAT_ERRATA_2437_IN_ADDR + 0x200);
+
+		/* Clear RAT mapping */
+		writel_verify(0, RAT_ERRATA_2437_BASE_REGION0 + 0x20);
+		writel_verify(0, RAT_ERRATA_2437_BASE_REGION0 + 0x24);
+		writel_verify(0, RAT_ERRATA_2437_BASE_REGION0 + 0x28);
+		writel_verify(0, RAT_ERRATA_2437_BASE_REGION0 + 0x2c);
+	}
 }
 #endif
 
Signature · 1 line
2.34.1
#4 lore raw
In reply to Udit Kumar
Quoted 5 lines · Udit Kumar

Add a necessary hardware errata workaround for J721S2 and J784S4.

Bootlogs
https://gist.github.com/uditkumarti/da2a489a78d3241ecd2791c9df1c1317

Quoted 7 lines

Changelog:
Changes in v2:
1- Added verified macro (this is new patch)
2- updated macro from ERRATA2437 to ERRATA_2437
3- instead of using hardcoded write, used verified write macro

[...]

Applied to u-boot/master, thanks!

[1/3] arm: mach-k3: arm: mach-k3: Add writel_verify macro for register write verification

      commit: ad681c816484c2246b4803de64553f760c0f44cd
[2/3] arch: mach-k3: j721s2_init: Add workaround for errata i2437
      commit: d99cb46a2cc4d735aea125e315d6ee257077b516
[3/3] arch: mach-k3: j784s4_init: Add workaround for errata i2437
      commit: c5c3b2787383e25b1882f7e8cf3db54eaf318b41
Signature · 1 line
Tom