Some versions of the AM62A processors have reduced CPU counts. To avoid boot stalls while Linux tries to probe these missing CPUs use the DEVICE_ID field in the JTAG_USER_ID register know if we need to remove these CPUs from the DT before booting into Linux.
Signed-off-by: Bryan Brattlof <[email protected]> --- arch/arm/mach-k3/am62ax/am62a7_fdt.c | 23 +++++++++++++++++++++++ arch/arm/mach-k3/include/mach/am62a_hardware.h | 10 ++++++++++ 2 files changed, 33 insertions(+) diff --git a/arch/arm/mach-k3/am62ax/am62a7_fdt.c b/arch/arm/mach-k3/am62ax/am62a7_fdt.c index bdc1747fd75c..d9e0a7b65efd 100644 --- a/arch/arm/mach-k3/am62ax/am62a7_fdt.c +++ b/arch/arm/mach-k3/am62ax/am62a7_fdt.c @@ -7,7 +7,30 @@ #include <asm/hardware.h> #include <fdt_support.h> +static int fdt_fixup_a53_nodes(void *dt) +{ + int nr = k3_get_core_nr(); + char path[32]; + + /* remove the fused out cpus */ + for (; nr < 4; nr++) { + snprintf(path, sizeof(path), "/cpus/cpu@%d", nr); + fdt_del_node_path(dt, path); + + /* remove the cpu from the cluster */ + snprintf(path, sizeof(path), "/cpus/cpu-map/cluster0/core%d", nr); + fdt_del_node_path(dt, path); + + /* remove the watchdog for the cpu */ + snprintf(path, sizeof(path), "/bus@f0000/watchdog@e0%d0000", nr); + fdt_del_node_path(dt, path); + } + + return 0; +} + int ft_system_setup(void *blob, struct bd_info *bd) { + fdt_fixup_a53_nodes(blob); return fdt_fixup_reserved(blob); } diff --git a/arch/arm/mach-k3/include/mach/am62a_hardware.h b/arch/arm/mach-k3/include/mach/am62a_hardware.h index 21bed6e2c6e3..23bfb3eda68a 100644 --- a/arch/arm/mach-k3/include/mach/am62a_hardware.h +++ b/arch/arm/mach-k3/include/mach/am62a_hardware.h @@ -20,6 +20,8 @@ #define WKUP_CTRL_MMR0_BASE 0x43000000 #define CTRLMMR_WKUP_JTAG_DEVICE_ID (WKUP_CTRL_MMR0_BASE + 0x18) +#define JTAG_DEV_CORE_NR_MASK GENMASK(19, 18) +#define JTAG_DEV_CORE_NR_SHIFT 18 #define JTAG_DEV_SPEED_MASK GENMASK(10, 6) #define JTAG_DEV_SPEED_SHIFT 6 @@ -99,3 +101,11 @@ static const u32 put_device_ids[] = {}; static const u32 put_core_ids[] = {}; #endif /* __ASM_ARCH_AM62A_HARDWARE_H */ + +static inline int k3_get_core_nr(void) +{ + u32 devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID); + u8 nr = (devid & JTAG_DEV_CORE_NR_MASK) >> JTAG_DEV_CORE_NR_SHIFT; + + return nr + 1; +} -- 2.55.0
