arm: mach-k3: intoduce system dt fixups
Subsystems (2)
cover arm: mach-k3: intoduce system dt fixups
Hello Everyone,
The AM6* family of processors come in a number of flavors (62, 62A, 62P) to fit effecently in a varaty of markets. Inside these processor families there can be a number of configurations like number CPU and DSP core counts to fit even closer to the power or cost their usecase needs.
To avoid the explotion of the number DTs for the different combinations of processor flavors and configurations needed in Linux, use OF_SYSTEM_SETUP to remove nodes in DT which are missing from the processor's configuration.
Happy Hacking
~Bryan
---
Bryan Brattlof (2):
arm: mach-k3: am62a: remove dt nodes not backed by hardware
arm: mach-k3: am64: remove dt nodes not backed by hardware
arch/arm/mach-k3/am62ax/am62a7_fdt.c | 23 ++++++++++++++++ arch/arm/mach-k3/am64x/Kconfig | 1 + arch/arm/mach-k3/am64x/Makefile | 1 + arch/arm/mach-k3/am64x/am642_fdt.c | 36 ++++++++++++++++++++++++++ arch/arm/mach-k3/include/mach/am62a_hardware.h | 10 +++++++ arch/arm/mach-k3/include/mach/am64_hardware.h | 9 +++++++ 6 files changed, 80 insertions(+)
---
base-commit: fed92546960a92177d67c0b8d7b22385f50fed29
change-id: 20261001-cutdowns-1f5f92365925
Best regards,
Signature · 1 line
Bryan Brattlof <[email protected]>
PATCH 1/2 arm: mach-k3: am62a: remove dt nodes not backed by hardware
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.
--- arch/arm/mach-k3/am62ax/am62a7_fdt.c | 23 +++++++++++++++++++++++ arch/arm/mach-k3/include/mach/am62a_hardware.h | 10 ++++++++++ 2 files changed, 33 insertions(+)
arch/arm/mach-k3/am62ax/am62a7_fdt.c +23 -0
@@ -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); }
arch/arm/mach-k3/include/mach/am62a_hardware.h +10 -0
@@ -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 ; +}
Signature · 1 line
2.55.0
PATCH 2/2 arm: mach-k3: am64: remove dt nodes not backed by hardware
In reply to Bryan BrattlofSome version of the AM64 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 to know if we need to remove these CPUs from the DT before booting into Linux.
--- arch/arm/mach-k3/am64x/Kconfig | 1 + arch/arm/mach-k3/am64x/Makefile | 1 + arch/arm/mach-k3/am64x/am642_fdt.c | 36 +++++++++++++++++++++++++++ arch/arm/mach-k3/include/mach/am64_hardware.h | 9 +++++++ 4 files changed, 47 insertions(+)
arch/arm/mach-k3/am64x/Kconfig +1 -0
@@ -16,6 +16,7 @@ config TARGET_AM642_A53_EVM imply BOARD imply SPL_BOARD imply TI_I2C_BOARD_DETECT + imply OF_SYSTEM_SETUP config TARGET_AM642_R5_EVM bool "TI K3 based AM642 EVM running on R5"
arch/arm/mach-k3/am64x/Makefile +1 -0
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0+ +obj-$(CONFIG_OF_SYSTEM_SETUP) += am642_fdt.o obj-$(CONFIG_XPL_BUILD) += am642_init.o obj-y += boot.o
arch/arm/mach-k3/am64x/am642_fdt.c new file +36 -0
@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2026 Texas Instruments Incorporated - https://www.ti.com/ +*/ + +#include <asm/arch/k3-common-fdt.h> +#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 <2 ; 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); +}
arch/arm/mach-k3/include/mach/am64_hardware.h +9 -0
@@ -19,6 +19,8 @@#define CTRL_MMR0_BASE 0x43000000#define CTRLMMR_WKUP_JTAG_DEVICE_ID (WKUP_CTRL_MMR0_BASE + 0x18) +#define JTAG_DEV_CORE_NR_MASK GENMASK(23, 22) +#define JTAG_DEV_CORE_NR_SHIFT 22#define JTAG_DEV_SPEED_MASK GENMASK(10, 6)#define JTAG_DEV_SPEED_SHIFT 6
@@ -89,3 +91,10 @@ static const u32 put_core_ids[] = { };#endif /* __ASM_ARCH_DRA8_HARDWARE_H */ + +static inline int k3_get_core_nr (void ) +{ +u32 devid =readl (CTRLMMR_WKUP_JTAG_DEVICE_ID ); + +return (devid &JTAG_DEV_CORE_NR_MASK ) >>JTAG_DEV_CORE_NR_SHIFT ; +}
Signature · 1 line
2.55.0
Quoted 11 lines · Bryan Brattlof
The AM6* family of processors come in a number of flavors (62, 62A, 62P) to fit effecently in a varaty of markets. Inside these processor families there can be a number of configurations like number CPU and DSP core counts to fit even closer to the power or cost their usecase needs.
To avoid the explotion of the number DTs for the different combinations of processor flavors and configurations needed in Linux, use
OF_SYSTEM_SETUPto remove nodes in DT which are missing from the processor's configuration.[...]
Applied to u-boot/main, thanks!
[1/2] arm: mach-k3: am62a: remove dt nodes not backed by hardware
commit: 2c1826f91d5e0f3e560aac790813d86c31c34892
[2/2] arm: mach-k3: am64: remove dt nodes not backed by hardware
commit: e0ca8e2227e8a95cb91719778a4d2c0e25227fbdSignature · 1 line
Tom