u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level
@ 2023-03-30 20:28 Andrew Davis
  2023-03-30 20:28 ` [PATCH 02/12] arm: mach-k3: Move J721e SoC detection out of common section Andrew Davis
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

The MSMC fixup is something we do based on SoC, not based on the board.
So this fixup does not belong in the board files. Move this to the
mach-k3 common file so that it does not have to be done in each board
that uses these SoCs.

We use ft_system_setup() here instead of ft_board_setup() since it is no
longer board level. Enable OF_SYSTEM_SETUP in the configurations that use
this to keep functionality the same.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/common.c                 | 16 ++++++++++++++++
 arch/arm/mach-k3/include/mach/sys_proto.h |  1 -
 board/siemens/iot2050/board.c             | 16 ----------------
 board/ti/am65x/evm.c                      | 18 ------------------
 board/ti/j721e/evm.c                      | 11 +----------
 board/ti/j721s2/evm.c                     | 16 ----------------
 configs/am65x_evm_a53_defconfig           |  2 +-
 configs/am65x_hs_evm_a53_defconfig        |  2 +-
 configs/iot2050_defconfig                 |  2 +-
 configs/j7200_evm_a72_defconfig           |  1 +
 configs/j7200_hs_evm_a72_defconfig        |  1 +
 configs/j721e_evm_a72_defconfig           |  1 +
 configs/j721e_hs_evm_a72_defconfig        |  1 +
 configs/j721s2_evm_a72_defconfig          |  2 +-
 configs/j721s2_hs_evm_a72_defconfig       |  2 +-
 15 files changed, 26 insertions(+), 66 deletions(-)

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index a2adb791f6c..6870f13c520 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -386,6 +386,22 @@ int fdt_disable_node(void *blob, char *node_path)
 	return 0;
 }
 
+#if defined(CONFIG_OF_SYSTEM_SETUP)
+int ft_system_setup(void *blob, struct bd_info *bd)
+{
+	int ret;
+
+	ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
+	if (ret < 0)
+		ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
+					 "sram@70000000");
+	if (ret)
+		printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
+
+	return ret;
+}
+#endif
+
 #endif
 
 #ifndef CONFIG_SYSRESET
diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
index 3d3d90d02d6..0b5d606eaa2 100644
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ b/arch/arm/mach-k3/include/mach/sys_proto.h
@@ -11,7 +11,6 @@ void sdelay(unsigned long loops);
 u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
 		  u32 bound);
 struct ti_sci_handle *get_ti_sci_handle(void);
-int fdt_fixup_msmc_ram(void *blob, char *parent_path, char *node_name);
 int do_board_detect(void);
 void release_resources_for_core_shutdown(void);
 int fdt_disable_node(void *blob, char *node_path);
diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c
index 8f4b0eae495..8b0506e4cb9 100644
--- a/board/siemens/iot2050/board.c
+++ b/board/siemens/iot2050/board.c
@@ -230,22 +230,6 @@ int board_late_init(void)
 	return 0;
 }
 
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-int ft_board_setup(void *blob, struct bd_info *bd)
-{
-	int ret;
-
-	ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
-	if (ret < 0)
-		ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
-					 "sram@70000000");
-	if (ret)
-		pr_err("%s: fixing up msmc ram failed %d\n", __func__, ret);
-
-	return ret;
-}
-#endif
-
 void spl_board_init(void)
 {
 }
diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
index b266ccb4b82..4053b8333cf 100644
--- a/board/ti/am65x/evm.c
+++ b/board/ti/am65x/evm.c
@@ -101,24 +101,6 @@ int board_fit_config_name_match(const char *name)
 }
 #endif
 
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-int ft_board_setup(void *blob, struct bd_info *bd)
-{
-	int ret;
-
-	ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
-	if (ret < 0)
-		ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
-					 "sram@70000000");
-	if (ret) {
-		printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
-		return ret;
-	}
-
-	return 0;
-}
-#endif
-
 #ifdef CONFIG_TI_I2C_BOARD_DETECT
 int do_board_detect(void)
 {
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index d4e672a7acd..00ce009d3e8 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -144,18 +144,9 @@ void spl_perform_fixups(struct spl_image_info *spl_image)
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
-	int ret;
-
-	ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
-	if (ret < 0)
-		ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
-					 "sram@70000000");
-	if (ret)
-		printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
-
 	detect_enable_hyperflash(blob);
 
-	return ret;
+	return 0;
 }
 #endif
 
diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c
index c86715fa211..9b130c141ac 100644
--- a/board/ti/j721s2/evm.c
+++ b/board/ti/j721s2/evm.c
@@ -73,22 +73,6 @@ int dram_init_banksize(void)
 	return 0;
 }
 
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-int ft_board_setup(void *blob, struct bd_info *bd)
-{
-	int ret;
-
-	ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
-	if (ret < 0)
-		ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
-					 "sram@70000000");
-	if (ret)
-		printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
-
-	return ret;
-}
-#endif
-
 #ifdef CONFIG_TI_I2C_BOARD_DETECT
 /*
  * Functions specific to EVM and SK designs of J721S2/AM68 family.
diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
index bddd94ce80e..4af274e06d6 100644
--- a/configs/am65x_evm_a53_defconfig
+++ b/configs/am65x_evm_a53_defconfig
@@ -30,7 +30,7 @@ CONFIG_SPL_SPI=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 CONFIG_LOGLEVEL=7
diff --git a/configs/am65x_hs_evm_a53_defconfig b/configs/am65x_hs_evm_a53_defconfig
index 898403aad98..bdd4b6420dd 100644
--- a/configs/am65x_hs_evm_a53_defconfig
+++ b/configs/am65x_hs_evm_a53_defconfig
@@ -30,7 +30,7 @@ CONFIG_SPL_SPI=y
 # CONFIG_PSCI_RESET is not set
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_fit_${boot}; run get_overlaystring; run run_fit"
 CONFIG_LOGLEVEL=7
diff --git a/configs/iot2050_defconfig b/configs/iot2050_defconfig
index 57387edcb41..95a6418d0ae 100644
--- a/configs/iot2050_defconfig
+++ b/configs/iot2050_defconfig
@@ -27,7 +27,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTSTAGE=y
 CONFIG_SHOW_BOOT_PROGRESS=y
diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig
index 9b6512bacba..f9299780f71 100644
--- a/configs/j7200_evm_a72_defconfig
+++ b/configs/j7200_evm_a72_defconfig
@@ -31,6 +31,7 @@ CONFIG_SPL_SPI=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
 CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 CONFIG_LOGLEVEL=7
diff --git a/configs/j7200_hs_evm_a72_defconfig b/configs/j7200_hs_evm_a72_defconfig
index cfd2e80aded..e83525bcb5e 100644
--- a/configs/j7200_hs_evm_a72_defconfig
+++ b/configs/j7200_hs_evm_a72_defconfig
@@ -32,6 +32,7 @@ CONFIG_SPL_SPI=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
 CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_fit_${boot}; run get_overlaystring; run run_fit"
 CONFIG_LOGLEVEL=7
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 452e4b9695d..46ad1b7d1a1 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -29,6 +29,7 @@ CONFIG_SPL_SPI=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
 CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run main_cpsw0_qsgmii_phyinit; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 CONFIG_LOGLEVEL=7
diff --git a/configs/j721e_hs_evm_a72_defconfig b/configs/j721e_hs_evm_a72_defconfig
index 651df4a4865..df4bf01daf9 100644
--- a/configs/j721e_hs_evm_a72_defconfig
+++ b/configs/j721e_hs_evm_a72_defconfig
@@ -30,6 +30,7 @@ CONFIG_SPL_SPI=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
 CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run main_cpsw0_qsgmii_phyinit; run boot_rprocs; run get_fit_${boot}; run get_overlay_${boot}; run run_fit"
 CONFIG_LOGLEVEL=7
diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig
index 3a91df71d37..9889e1bd523 100644
--- a/configs/j721s2_evm_a72_defconfig
+++ b/configs/j721s2_evm_a72_defconfig
@@ -28,7 +28,7 @@ CONFIG_SPL_SPI=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 CONFIG_LOGLEVEL=7
diff --git a/configs/j721s2_hs_evm_a72_defconfig b/configs/j721s2_hs_evm_a72_defconfig
index 453f2aabbfc..035d87b49f1 100644
--- a/configs/j721s2_hs_evm_a72_defconfig
+++ b/configs/j721s2_hs_evm_a72_defconfig
@@ -31,7 +31,7 @@ CONFIG_SPL_SPI=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_fit_${boot}; run get_overlaystring; run run_fit"
 CONFIG_LOGLEVEL=7
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 02/12] arm: mach-k3: Move J721e SoC detection out of common section
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-03-30 20:28 ` [PATCH 03/12] soc: soc_ti_k3: Use hardware.h to remove definition duplication Andrew Davis
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

This belongs in the J721e specific file as it is the only place
this is used. Any board level users should use the SOC driver.

While here, move the J721e and J7200 SoC IDs out of sys_proto.h
and into hardware.h. Add the rest of the SoC IDs for completeness
and later use.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/common.c                 | 20 --------------------
 arch/arm/mach-k3/common.h                 |  3 ---
 arch/arm/mach-k3/include/mach/hardware.h  |  8 ++++++++
 arch/arm/mach-k3/include/mach/sys_proto.h |  3 ---
 arch/arm/mach-k3/j721e_init.c             | 20 ++++++++++++++++++++
 5 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 6870f13c520..6e084de692c 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -488,26 +488,6 @@ int print_cpuinfo(void)
 }
 #endif
 
-bool soc_is_j721e(void)
-{
-	u32 soc;
-
-	soc = (readl(CTRLMMR_WKUP_JTAG_ID) &
-		JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
-
-	return soc == J721E;
-}
-
-bool soc_is_j7200(void)
-{
-	u32 soc;
-
-	soc = (readl(CTRLMMR_WKUP_JTAG_ID) &
-		JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
-
-	return soc == J7200;
-}
-
 #ifdef CONFIG_ARM64
 void board_prep_linux(struct bootm_headers *images)
 {
diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
index 8f38fcef7f0..531be0be54c 100644
--- a/arch/arm/mach-k3/common.h
+++ b/arch/arm/mach-k3/common.h
@@ -9,9 +9,6 @@
 #include <asm/armv7_mpu.h>
 #include <asm/hardware.h>
 
-#define J721E  0xbb64
-#define J7200  0xbb6d
-
 struct fwl_data {
 	const char *name;
 	u16 fwl_id;
diff --git a/arch/arm/mach-k3/include/mach/hardware.h b/arch/arm/mach-k3/include/mach/hardware.h
index 2c60ef85432..f87b4c6e5a7 100644
--- a/arch/arm/mach-k3/include/mach/hardware.h
+++ b/arch/arm/mach-k3/include/mach/hardware.h
@@ -36,6 +36,14 @@
 #define JTAG_ID_VARIANT_MASK	(0xf << 28)
 #define JTAG_ID_PARTNO_SHIFT	12
 #define JTAG_ID_PARTNO_MASK	(0xffff << 12)
+#define JTAG_ID_PARTNO_AM65X	0xbb5a
+#define JTAG_ID_PARTNO_J721E	0xbb64
+#define JTAG_ID_PARTNO_J7200	0xbb6d
+#define JTAG_ID_PARTNO_AM64X	0xbb38
+#define JTAG_ID_PARTNO_J721S2	0xbb75
+#define JTAG_ID_PARTNO_AM62X	0xbb7e
+#define JTAG_ID_PARTNO_AM62AX   0xbb8d
+
 #define K3_SEC_MGR_SYS_STATUS		0x44234100
 #define SYS_STATUS_DEV_TYPE_SHIFT	0
 #define SYS_STATUS_DEV_TYPE_MASK	(0xf)
diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
index 0b5d606eaa2..d5d4b787b7d 100644
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ b/arch/arm/mach-k3/include/mach/sys_proto.h
@@ -15,9 +15,6 @@ int do_board_detect(void);
 void release_resources_for_core_shutdown(void);
 int fdt_disable_node(void *blob, char *node_path);
 
-bool soc_is_j721e(void);
-bool soc_is_j7200(void);
-
 void k3_spl_init(void);
 void k3_mem_init(void);
 bool check_rom_loaded_sysfw(void);
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index 276cbb5dae2..233b867e90c 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -63,6 +63,26 @@ struct fwl_data cbass_hc_cfg0_fwls[] = {
 };
 #endif
 
+bool soc_is_j721e(void)
+{
+	u32 soc;
+
+	soc = (readl(CTRLMMR_WKUP_JTAG_ID) &
+		JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
+
+	return soc == JTAG_ID_PARTNO_J721E;
+}
+
+bool soc_is_j7200(void)
+{
+	u32 soc;
+
+	soc = (readl(CTRLMMR_WKUP_JTAG_ID) &
+		JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
+
+	return soc == JTAG_ID_PARTNO_J7200;
+}
+
 static void ctrl_mmr_unlock(void)
 {
 	/* Unlock all WKUP_CTRL_MMR0 module registers */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 03/12] soc: soc_ti_k3: Use hardware.h to remove definition duplication
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
  2023-03-30 20:28 ` [PATCH 02/12] arm: mach-k3: Move J721e SoC detection out of common section Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-03-30 20:28 ` [PATCH 04/12] configs: j721x_evm.h: Remove unneeded check for SYS_K3_SPL_ATF Andrew Davis
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

The K3 JTAG and SoC ID information is already stored in the K3 arch
hardware file, include that and use its definitions here.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/soc/Kconfig     |  2 +-
 drivers/soc/soc_ti_k3.c | 30 +++++++++---------------------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index acf555baaec..85dac9de78a 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -10,7 +10,7 @@ config SOC_DEVICE
 	  specific device variant in use.
 
 config SOC_DEVICE_TI_K3
-	depends on SOC_DEVICE
+	depends on SOC_DEVICE && ARCH_K3
 	bool "Enable SoC Device ID driver for TI K3 SoCs"
 	help
 	  This allows Texas Instruments Keystone 3 SoCs to identify
diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c
index 8af0ac70519..42430d79a7a 100644
--- a/drivers/soc/soc_ti_k3.c
+++ b/drivers/soc/soc_ti_k3.c
@@ -8,21 +8,9 @@
 #include <dm.h>
 #include <soc.h>
 
+#include <asm/arch/hardware.h>
 #include <asm/io.h>
 
-#define AM65X			0xbb5a
-#define J721E			0xbb64
-#define J7200			0xbb6d
-#define AM64X			0xbb38
-#define J721S2			0xbb75
-#define AM62X			0xbb7e
-#define AM62AX			0xbb8d
-
-#define JTAG_ID_VARIANT_SHIFT	28
-#define JTAG_ID_VARIANT_MASK	(0xf << 28)
-#define JTAG_ID_PARTNO_SHIFT	12
-#define JTAG_ID_PARTNO_MASK	(0xffff << 12)
-
 struct soc_ti_k3_plat {
 	const char *family;
 	const char *revision;
@@ -36,25 +24,25 @@ static const char *get_family_string(u32 idreg)
 	soc = (idreg & JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
 
 	switch (soc) {
-	case AM65X:
+	case JTAG_ID_PARTNO_AM65X:
 		family = "AM65X";
 		break;
-	case J721E:
+	case JTAG_ID_PARTNO_J721E:
 		family = "J721E";
 		break;
-	case J7200:
+	case JTAG_ID_PARTNO_J7200:
 		family = "J7200";
 		break;
-	case AM64X:
+	case JTAG_ID_PARTNO_AM64X:
 		family = "AM64X";
 		break;
-	case J721S2:
+	case JTAG_ID_PARTNO_J721S2:
 		family = "J721S2";
 		break;
-	case AM62X:
+	case JTAG_ID_PARTNO_AM62X:
 		family = "AM62X";
 		break;
-	case AM62AX:
+	case JTAG_ID_PARTNO_AM62AX:
 		family = "AM62AX";
 		break;
 	default:
@@ -81,7 +69,7 @@ static const char *get_rev_string(u32 idreg)
 	soc = (idreg & JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
 
 	switch (soc) {
-	case J721E:
+	case JTAG_ID_PARTNO_J721E:
 		if (rev > ARRAY_SIZE(j721e_rev_string_map))
 			goto bail;
 		return j721e_rev_string_map[rev];
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 04/12] configs: j721x_evm.h: Remove unneeded check for SYS_K3_SPL_ATF
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
  2023-03-30 20:28 ` [PATCH 02/12] arm: mach-k3: Move J721e SoC detection out of common section Andrew Davis
  2023-03-30 20:28 ` [PATCH 03/12] soc: soc_ti_k3: Use hardware.h to remove definition duplication Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-03-30 20:28 ` [PATCH 05/12] configs: j721s2_evm.h: Remove refrences to J7200 EVM Andrew Davis
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

The TARGET_x_R5_EVM check is already enough to limit these defines to
only the correct builds. Remove the extra outer check.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 include/configs/j721e_evm.h  | 4 +---
 include/configs/j721s2_evm.h | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h
index 48b1cea6e39..b2138c33b57 100644
--- a/include/configs/j721e_evm.h
+++ b/include/configs/j721e_evm.h
@@ -51,7 +51,6 @@
 	"uuid_disk=${uuid_gpt_disk};" \
 	"name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0"
 
-#ifdef CONFIG_SYS_K3_SPL_ATF
 #if defined(CONFIG_TARGET_J721E_R5_EVM)
 #define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC				\
 	"addr_mcur5f0_0load=0x89000000\0"				\
@@ -60,10 +59,9 @@
 #define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC				\
 	"addr_mcur5f0_0load=0x89000000\0"				\
 	"name_mcur5f0_0fw=/lib/firmware/j7200-mcu-r5f0_0-fw\0"
-#endif /* CONFIG_TARGET_J721E_R5_EVM */
 #else
 #define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC ""
-#endif /* CONFIG_SYS_K3_SPL_ATF */
+#endif
 
 /* U-Boot MMC-specific configuration */
 #define EXTRA_ENV_J721E_BOARD_SETTINGS_MMC				\
diff --git a/include/configs/j721s2_evm.h b/include/configs/j721s2_evm.h
index bfada9eebc2..d401f28ff21 100644
--- a/include/configs/j721s2_evm.h
+++ b/include/configs/j721s2_evm.h
@@ -48,7 +48,6 @@
 	"uuid_disk=${uuid_gpt_disk};" \
 	"name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0"
 
-#ifdef CONFIG_SYS_K3_SPL_ATF
 #if defined(CONFIG_TARGET_J721S2_R5_EVM)
 #define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC				\
 	"addr_mcur5f0_0load=0x89000000\0"				\
@@ -57,10 +56,9 @@
 #define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC				\
 	"addr_mcur5f0_0load=0x89000000\0"				\
 	"name_mcur5f0_0fw=/lib/firmware/j7200-mcu-r5f0_0-fw\0"
-#endif /* CONFIG_TARGET_J721S2_R5_EVM */
 #else
 #define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC ""
-#endif /* CONFIG_SYS_K3_SPL_ATF */
+#endif
 
 /* U-Boot MMC-specific configuration */
 #define EXTRA_ENV_J721S2_BOARD_SETTINGS_MMC				\
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 05/12] configs: j721s2_evm.h: Remove refrences to J7200 EVM
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
                   ` (2 preceding siblings ...)
  2023-03-30 20:28 ` [PATCH 04/12] configs: j721x_evm.h: Remove unneeded check for SYS_K3_SPL_ATF Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-03-30 20:28 ` [PATCH 06/12] arm: mach-k3: Make release_resources_for_core_shutdown() common Andrew Davis
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

The J7200 EVM will not include this file, all these J7200 checks look
to be copy/paste errors from j721e_evm.h, which J7200 *can* include.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 include/configs/j721s2_evm.h | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/include/configs/j721s2_evm.h b/include/configs/j721s2_evm.h
index d401f28ff21..45d080023f6 100644
--- a/include/configs/j721s2_evm.h
+++ b/include/configs/j721s2_evm.h
@@ -20,7 +20,7 @@
 #define CFG_SYS_SDRAM_BASE1		0x880000000
 
 /* SPL Loader Configuration */
-#if defined(CONFIG_TARGET_J721S2_A72_EVM) || defined(CONFIG_TARGET_J7200_A72_EVM)
+#if defined(CONFIG_TARGET_J721S2_A72_EVM)
 #define CFG_SYS_UBOOT_BASE		0x50280000
 /* Image load address in RAM for DFU boot*/
 #else
@@ -52,10 +52,6 @@
 #define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC				\
 	"addr_mcur5f0_0load=0x89000000\0"				\
 	"name_mcur5f0_0fw=/lib/firmware/j7-mcu-r5f0_0-fw\0"
-#elif defined(CONFIG_TARGET_J7200_R5_EVM)
-#define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC				\
-	"addr_mcur5f0_0load=0x89000000\0"				\
-	"name_mcur5f0_0fw=/lib/firmware/j7200-mcu-r5f0_0-fw\0"
 #else
 #define EXTRA_ENV_R5_SPL_RPROC_FW_ARGS_MMC ""
 #endif
@@ -86,7 +82,7 @@
 	"partitions=" PARTS_DEFAULT
 
 /* Set the default list of remote processors to boot */
-#if defined(CONFIG_TARGET_J721S2_A72_EVM) || defined(CONFIG_TARGET_J7200_A72_EVM)
+#if defined(CONFIG_TARGET_J721S2_A72_EVM)
 #ifdef DEFAULT_RPROCS
 #undef DEFAULT_RPROCS
 #endif
@@ -102,21 +98,6 @@
 		"7 /lib/firmware/j721s2-c71_1-fw "
 #endif /* CONFIG_TARGET_J721S2_A72_EVM */
 
-#ifdef CONFIG_TARGET_J7200_A72_EVM
-#define EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY				\
-	"do_main_cpsw0_qsgmii_phyinit=1\0"				\
-	"init_main_cpsw0_qsgmii_phy=gpio set gpio@22_17;"		\
-		 "gpio clear gpio@22_16\0"				\
-	"main_cpsw0_qsgmii_phyinit="					\
-	"if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} -eq 1 && " \
-			"test ${boot} = mmc; then "			\
-		"run init_main_cpsw0_qsgmii_phy;"			\
-	"fi;\0"
-#define DEFAULT_RPROCS ""						\
-		"2 /lib/firmware/j7200-main-r5f0_0-fw "			\
-		"3 /lib/firmware/j7200-main-r5f0_1-fw "
-#endif /* CONFIG_TARGET_J7200_A72_EVM */
-
 #ifndef EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY
 #define EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY
 #endif
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 06/12] arm: mach-k3: Make release_resources_for_core_shutdown() common
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
                   ` (3 preceding siblings ...)
  2023-03-30 20:28 ` [PATCH 05/12] configs: j721s2_evm.h: Remove refrences to J7200 EVM Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-03-30 20:28 ` [PATCH 07/12] arm: mach-k3: Move sysfw-loader.h out of mach includes Andrew Davis
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

This function is the same for each device when it needs to shutdown
the R5 core. Move this to the common section and move the remaining
device specific ID list to the device hardware include.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/am642_init.c                 | 51 -----------------
 arch/arm/mach-k3/am654_init.c                 | 51 -----------------
 arch/arm/mach-k3/common.c                     | 32 ++++++++++-
 arch/arm/mach-k3/include/mach/am62_hardware.h |  8 +++
 .../arm/mach-k3/include/mach/am62a_hardware.h |  8 +++
 arch/arm/mach-k3/include/mach/am64_hardware.h | 24 ++++++++
 arch/arm/mach-k3/include/mach/am6_hardware.h  | 19 +++++++
 .../arm/mach-k3/include/mach/j721e_hardware.h | 19 +++++++
 .../mach-k3/include/mach/j721s2_hardware.h    | 19 +++++++
 arch/arm/mach-k3/include/mach/sys_proto.h     |  1 -
 arch/arm/mach-k3/j721e_init.c                 | 55 -------------------
 arch/arm/mach-k3/j721s2_init.c                | 54 ------------------
 12 files changed, 127 insertions(+), 214 deletions(-)

diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c
index 96f292ea75c..74297be0f20 100644
--- a/arch/arm/mach-k3/am642_init.c
+++ b/arch/arm/mach-k3/am642_init.c
@@ -346,54 +346,3 @@ u32 spl_boot_device(void)
 	else
 		return __get_backup_bootmedia(devstat);
 }
-
-#if defined(CONFIG_SYS_K3_SPL_ATF)
-
-#define AM64X_DEV_RTI8			127
-#define AM64X_DEV_RTI9			128
-#define AM64X_DEV_R5FSS0_CORE0		121
-#define AM64X_DEV_R5FSS0_CORE1		122
-
-void release_resources_for_core_shutdown(void)
-{
-	struct ti_sci_handle *ti_sci = get_ti_sci_handle();
-	struct ti_sci_dev_ops *dev_ops = &ti_sci->ops.dev_ops;
-	struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
-	int ret;
-	u32 i;
-
-	const u32 put_device_ids[] = {
-		AM64X_DEV_RTI9,
-		AM64X_DEV_RTI8,
-	};
-
-	/* Iterate through list of devices to put (shutdown) */
-	for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
-		u32 id = put_device_ids[i];
-
-		ret = dev_ops->put_device(ti_sci, id);
-		if (ret)
-			panic("Failed to put device %u (%d)\n", id, ret);
-	}
-
-	const u32 put_core_ids[] = {
-		AM64X_DEV_R5FSS0_CORE1,
-		AM64X_DEV_R5FSS0_CORE0, /* Handle CPU0 after CPU1 */
-	};
-
-	/* Iterate through list of cores to put (shutdown) */
-	for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
-		u32 id = put_core_ids[i];
-
-		/*
-		 * Queue up the core shutdown request. Note that this call
-		 * needs to be followed up by an actual invocation of an WFE
-		 * or WFI CPU instruction.
-		 */
-		ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
-		if (ret)
-			panic("Failed sending core %u shutdown message (%d)\n",
-			      id, ret);
-	}
-}
-#endif
diff --git a/arch/arm/mach-k3/am654_init.c b/arch/arm/mach-k3/am654_init.c
index 768fdd69602..8ee1e9be643 100644
--- a/arch/arm/mach-k3/am654_init.c
+++ b/arch/arm/mach-k3/am654_init.c
@@ -354,54 +354,3 @@ u32 spl_boot_device(void)
 	else
 		return __get_backup_bootmedia(devstat);
 }
-
-#ifdef CONFIG_SYS_K3_SPL_ATF
-
-#define AM6_DEV_MCU_RTI0			134
-#define AM6_DEV_MCU_RTI1			135
-#define AM6_DEV_MCU_ARMSS0_CPU0			159
-#define AM6_DEV_MCU_ARMSS0_CPU1			245
-
-void release_resources_for_core_shutdown(void)
-{
-	struct ti_sci_handle *ti_sci = get_ti_sci_handle();
-	struct ti_sci_dev_ops *dev_ops = &ti_sci->ops.dev_ops;
-	struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
-	int ret;
-	u32 i;
-
-	const u32 put_device_ids[] = {
-		AM6_DEV_MCU_RTI0,
-		AM6_DEV_MCU_RTI1,
-	};
-
-	/* Iterate through list of devices to put (shutdown) */
-	for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
-		u32 id = put_device_ids[i];
-
-		ret = dev_ops->put_device(ti_sci, id);
-		if (ret)
-			panic("Failed to put device %u (%d)\n", id, ret);
-	}
-
-	const u32 put_core_ids[] = {
-		AM6_DEV_MCU_ARMSS0_CPU1,
-		AM6_DEV_MCU_ARMSS0_CPU0,	/* Handle CPU0 after CPU1 */
-	};
-
-	/* Iterate through list of cores to put (shutdown) */
-	for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
-		u32 id = put_core_ids[i];
-
-		/*
-		 * Queue up the core shutdown request. Note that this call
-		 * needs to be followed up by an actual invocation of an WFE
-		 * or WFI CPU instruction.
-		 */
-		ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
-		if (ret)
-			panic("Failed sending core %u shutdown message (%d)\n",
-			      id, ret);
-	}
-}
-#endif
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 6e084de692c..4f2e14c3105 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -189,9 +189,37 @@ int load_firmware(char *name_fw, char *name_loadaddr, u32 *loadaddr)
 	return size;
 }
 
-__weak void release_resources_for_core_shutdown(void)
+void release_resources_for_core_shutdown(void)
 {
-	debug("%s not implemented...\n", __func__);
+	struct ti_sci_handle *ti_sci = get_ti_sci_handle();
+	struct ti_sci_dev_ops *dev_ops = &ti_sci->ops.dev_ops;
+	struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
+	int ret;
+	u32 i;
+
+	/* Iterate through list of devices to put (shutdown) */
+	for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
+		u32 id = put_device_ids[i];
+
+		ret = dev_ops->put_device(ti_sci, id);
+		if (ret)
+			panic("Failed to put device %u (%d)\n", id, ret);
+	}
+
+	/* Iterate through list of cores to put (shutdown) */
+	for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
+		u32 id = put_core_ids[i];
+
+		/*
+		 * Queue up the core shutdown request. Note that this call
+		 * needs to be followed up by an actual invocation of an WFE
+		 * or WFI CPU instruction.
+		 */
+		ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
+		if (ret)
+			panic("Failed sending core %u shutdown message (%d)\n",
+			      id, ret);
+	}
 }
 
 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h
index db4a32cd461..88d58947269 100644
--- a/arch/arm/mach-k3/include/mach/am62_hardware.h
+++ b/arch/arm/mach-k3/include/mach/am62_hardware.h
@@ -57,4 +57,12 @@
 
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START	0x43c30000
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+static const u32 put_device_ids[] = {};
+
+static const u32 put_core_ids[] = {};
+
+#endif
+
 #endif /* __ASM_ARCH_AM62_HARDWARE_H */
diff --git a/arch/arm/mach-k3/include/mach/am62a_hardware.h b/arch/arm/mach-k3/include/mach/am62a_hardware.h
index 13bf50f147b..11080801c4c 100644
--- a/arch/arm/mach-k3/include/mach/am62a_hardware.h
+++ b/arch/arm/mach-k3/include/mach/am62a_hardware.h
@@ -86,4 +86,12 @@
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START	0x70000001
 #endif /* CONFIG_CPU_V7R */
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+static const u32 put_device_ids[] = {};
+
+static const u32 put_core_ids[] = {};
+
+#endif
+
 #endif /* __ASM_ARCH_AM62A_HARDWARE_H */
diff --git a/arch/arm/mach-k3/include/mach/am64_hardware.h b/arch/arm/mach-k3/include/mach/am64_hardware.h
index 207ef95f218..44df887d5df 100644
--- a/arch/arm/mach-k3/include/mach/am64_hardware.h
+++ b/arch/arm/mach-k3/include/mach/am64_hardware.h
@@ -7,6 +7,11 @@
 #ifndef __ASM_ARCH_AM64_HARDWARE_H
 #define __ASM_ARCH_AM64_HARDWARE_H
 
+#include <config.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define PADCFG_MMR1_BASE				0x000f0000
 #define MCU_PADCFG_MMR1_BASE				0x04080000
 #define WKUP_CTRL_MMR0_BASE				0x43000000
@@ -41,4 +46,23 @@
 /* Use Last 2K as Scratch pad */
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START		0x7019f800
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+#define AM64X_DEV_RTI8			127
+#define AM64X_DEV_RTI9			128
+#define AM64X_DEV_R5FSS0_CORE0		121
+#define AM64X_DEV_R5FSS0_CORE1		122
+
+static const u32 put_device_ids[] = {
+	AM64X_DEV_RTI9,
+	AM64X_DEV_RTI8,
+};
+
+static const u32 put_core_ids[] = {
+	AM64X_DEV_R5FSS0_CORE1,
+	AM64X_DEV_R5FSS0_CORE0, /* Handle CPU0 after CPU1 */
+};
+
+#endif
+
 #endif /* __ASM_ARCH_DRA8_HARDWARE_H */
diff --git a/arch/arm/mach-k3/include/mach/am6_hardware.h b/arch/arm/mach-k3/include/mach/am6_hardware.h
index f9f32918f7c..029041f415c 100644
--- a/arch/arm/mach-k3/include/mach/am6_hardware.h
+++ b/arch/arm/mach-k3/include/mach/am6_hardware.h
@@ -39,4 +39,23 @@
 
 #define	NAVSS_NBSS_THREADMAP				0x10
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+#define AM6_DEV_MCU_RTI0			134
+#define AM6_DEV_MCU_RTI1			135
+#define AM6_DEV_MCU_ARMSS0_CPU0			159
+#define AM6_DEV_MCU_ARMSS0_CPU1			245
+
+static const u32 put_device_ids[] = {
+	AM6_DEV_MCU_RTI0,
+	AM6_DEV_MCU_RTI1,
+};
+
+static const u32 put_core_ids[] = {
+	AM6_DEV_MCU_ARMSS0_CPU1,
+	AM6_DEV_MCU_ARMSS0_CPU0,	/* Handle CPU0 after CPU1 */
+};
+
+#endif
+
 #endif /* __ASM_ARCH_AM6_HARDWARE_H */
diff --git a/arch/arm/mach-k3/include/mach/j721e_hardware.h b/arch/arm/mach-k3/include/mach/j721e_hardware.h
index 247dee99ce5..376db389ba1 100644
--- a/arch/arm/mach-k3/include/mach/j721e_hardware.h
+++ b/arch/arm/mach-k3/include/mach/j721e_hardware.h
@@ -38,4 +38,23 @@
 /* MCU SCRATCHPAD usage */
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START	CONFIG_SYS_K3_MCU_SCRATCHPAD_BASE
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+#define J721E_DEV_MCU_RTI0			262
+#define J721E_DEV_MCU_RTI1			263
+#define J721E_DEV_MCU_ARMSS0_CPU0		250
+#define J721E_DEV_MCU_ARMSS0_CPU1		251
+
+static const u32 put_device_ids[] = {
+	J721E_DEV_MCU_RTI0,
+	J721E_DEV_MCU_RTI1,
+};
+
+static const u32 put_core_ids[] = {
+	J721E_DEV_MCU_ARMSS0_CPU1,
+	J721E_DEV_MCU_ARMSS0_CPU0,	/* Handle CPU0 after CPU1 */
+};
+
+#endif
+
 #endif /* __ASM_ARCH_J721E_HARDWARE_H */
diff --git a/arch/arm/mach-k3/include/mach/j721s2_hardware.h b/arch/arm/mach-k3/include/mach/j721s2_hardware.h
index 2e155ed9ec4..7948bcf4789 100644
--- a/arch/arm/mach-k3/include/mach/j721s2_hardware.h
+++ b/arch/arm/mach-k3/include/mach/j721s2_hardware.h
@@ -38,4 +38,23 @@
 /* MCU SCRATCHPAD usage */
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START	CONFIG_SYS_K3_MCU_SCRATCHPAD_BASE
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+#define J721S2_DEV_MCU_RTI0			295
+#define J721S2_DEV_MCU_RTI1			296
+#define J721S2_DEV_MCU_ARMSS0_CPU0		284
+#define J721S2_DEV_MCU_ARMSS0_CPU1		285
+
+static const u32 put_device_ids[] = {
+	J721S2_DEV_MCU_RTI0,
+	J721S2_DEV_MCU_RTI1,
+};
+
+static const u32 put_core_ids[] = {
+	J721S2_DEV_MCU_ARMSS0_CPU1,
+	J721S2_DEV_MCU_ARMSS0_CPU0,	/* Handle CPU0 after CPU1 */
+};
+
+#endif
+
 #endif /* __ASM_ARCH_J721S2_HARDWARE_H */
diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
index d5d4b787b7d..8cc75b636b5 100644
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ b/arch/arm/mach-k3/include/mach/sys_proto.h
@@ -12,7 +12,6 @@ u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
 		  u32 bound);
 struct ti_sci_handle *get_ti_sci_handle(void);
 int do_board_detect(void);
-void release_resources_for_core_shutdown(void);
 int fdt_disable_node(void *blob, char *node_path);
 
 void k3_spl_init(void);
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index 233b867e90c..afd46647405 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -399,58 +399,3 @@ u32 spl_boot_device(void)
 	else
 		return __get_backup_bootmedia(main_devstat);
 }
-
-#ifdef CONFIG_SYS_K3_SPL_ATF
-
-#define J721E_DEV_MCU_RTI0			262
-#define J721E_DEV_MCU_RTI1			263
-#define J721E_DEV_MCU_ARMSS0_CPU0		250
-#define J721E_DEV_MCU_ARMSS0_CPU1		251
-
-void release_resources_for_core_shutdown(void)
-{
-	struct ti_sci_handle *ti_sci;
-	struct ti_sci_dev_ops *dev_ops;
-	struct ti_sci_proc_ops *proc_ops;
-	int ret;
-	u32 i;
-
-	const u32 put_device_ids[] = {
-		J721E_DEV_MCU_RTI0,
-		J721E_DEV_MCU_RTI1,
-	};
-
-	ti_sci = get_ti_sci_handle();
-	dev_ops = &ti_sci->ops.dev_ops;
-	proc_ops = &ti_sci->ops.proc_ops;
-
-	/* Iterate through list of devices to put (shutdown) */
-	for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
-		u32 id = put_device_ids[i];
-
-		ret = dev_ops->put_device(ti_sci, id);
-		if (ret)
-			panic("Failed to put device %u (%d)\n", id, ret);
-	}
-
-	const u32 put_core_ids[] = {
-		J721E_DEV_MCU_ARMSS0_CPU1,
-		J721E_DEV_MCU_ARMSS0_CPU0,	/* Handle CPU0 after CPU1 */
-	};
-
-	/* Iterate through list of cores to put (shutdown) */
-	for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
-		u32 id = put_core_ids[i];
-
-		/*
-		 * Queue up the core shutdown request. Note that this call
-		 * needs to be followed up by an actual invocation of an WFE
-		 * or WFI CPU instruction.
-		 */
-		ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
-		if (ret)
-			panic("Failed sending core %u shutdown message (%d)\n",
-			      id, ret);
-	}
-}
-#endif
diff --git a/arch/arm/mach-k3/j721s2_init.c b/arch/arm/mach-k3/j721s2_init.c
index 09e55ed4566..fb95984c1ab 100644
--- a/arch/arm/mach-k3/j721s2_init.c
+++ b/arch/arm/mach-k3/j721s2_init.c
@@ -264,57 +264,3 @@ u32 spl_boot_device(void)
 	else
 		return __get_backup_bootmedia(main_devstat);
 }
-
-#define J721S2_DEV_MCU_RTI0			295
-#define J721S2_DEV_MCU_RTI1			296
-#define J721S2_DEV_MCU_ARMSS0_CPU0		284
-#define J721S2_DEV_MCU_ARMSS0_CPU1		285
-
-void release_resources_for_core_shutdown(void)
-{
-	if (IS_ENABLED(CONFIG_SYS_K3_SPL_ATF)) {
-		struct ti_sci_handle *ti_sci;
-		struct ti_sci_dev_ops *dev_ops;
-		struct ti_sci_proc_ops *proc_ops;
-		int ret;
-		u32 i;
-
-		const u32 put_device_ids[] = {
-			J721S2_DEV_MCU_RTI0,
-			J721S2_DEV_MCU_RTI1,
-		};
-
-		ti_sci = get_ti_sci_handle();
-		dev_ops = &ti_sci->ops.dev_ops;
-		proc_ops = &ti_sci->ops.proc_ops;
-
-		/* Iterate through list of devices to put (shutdown) */
-		for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
-			u32 id = put_device_ids[i];
-
-			ret = dev_ops->put_device(ti_sci, id);
-			if (ret)
-				panic("Failed to put device %u (%d)\n", id, ret);
-		}
-
-		const u32 put_core_ids[] = {
-			J721S2_DEV_MCU_ARMSS0_CPU1,
-			J721S2_DEV_MCU_ARMSS0_CPU0,	/* Handle CPU0 after CPU1 */
-		};
-
-		/* Iterate through list of cores to put (shutdown) */
-		for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
-			u32 id = put_core_ids[i];
-
-			/*
-			 * Queue up the core shutdown request. Note that this call
-			 * needs to be followed up by an actual invocation of an WFE
-			 * or WFI CPU instruction.
-			 */
-			ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
-			if (ret)
-				panic("Failed sending core %u shutdown message (%d)\n",
-				      id, ret);
-		}
-	}
-}
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 07/12] arm: mach-k3: Move sysfw-loader.h out of mach includes
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
                   ` (4 preceding siblings ...)
  2023-03-30 20:28 ` [PATCH 06/12] arm: mach-k3: Make release_resources_for_core_shutdown() common Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-03-30 20:28 ` [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file Andrew Davis
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

This header is only used locally by K3 init files, no need to have it
up with the global mach includes. Move into local includes.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/am625_init.c                      | 2 +-
 arch/arm/mach-k3/am62a7_init.c                     | 2 +-
 arch/arm/mach-k3/am642_init.c                      | 2 +-
 arch/arm/mach-k3/am654_init.c                      | 2 +-
 arch/arm/mach-k3/j721e_init.c                      | 2 +-
 arch/arm/mach-k3/j721s2_init.c                     | 2 +-
 arch/arm/mach-k3/{include/mach => }/sysfw-loader.h | 0
 7 files changed, 6 insertions(+), 6 deletions(-)
 rename arch/arm/mach-k3/{include/mach => }/sysfw-loader.h (100%)

diff --git a/arch/arm/mach-k3/am625_init.c b/arch/arm/mach-k3/am625_init.c
index a91c15ca4e1..026c4f9c02d 100644
--- a/arch/arm/mach-k3/am625_init.c
+++ b/arch/arm/mach-k3/am625_init.c
@@ -9,7 +9,7 @@
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/sysfw-loader.h>
+#include "sysfw-loader.h"
 #include "common.h"
 #include <dm.h>
 #include <dm/uclass-internal.h>
diff --git a/arch/arm/mach-k3/am62a7_init.c b/arch/arm/mach-k3/am62a7_init.c
index 02da24a3d6f..a89a9b4ae3a 100644
--- a/arch/arm/mach-k3/am62a7_init.c
+++ b/arch/arm/mach-k3/am62a7_init.c
@@ -8,7 +8,7 @@
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/sysfw-loader.h>
+#include "sysfw-loader.h"
 #include "common.h"
 #include <dm.h>
 #include <dm/uclass-internal.h>
diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c
index 74297be0f20..b29b7376ffd 100644
--- a/arch/arm/mach-k3/am642_init.c
+++ b/arch/arm/mach-k3/am642_init.c
@@ -12,7 +12,7 @@
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/sysfw-loader.h>
+#include "sysfw-loader.h"
 #include <asm/arch/sys_proto.h>
 #include "common.h"
 #include <asm/arch/sys_proto.h>
diff --git a/arch/arm/mach-k3/am654_init.c b/arch/arm/mach-k3/am654_init.c
index 8ee1e9be643..5b8e506c793 100644
--- a/arch/arm/mach-k3/am654_init.c
+++ b/arch/arm/mach-k3/am654_init.c
@@ -13,7 +13,7 @@
 #include <asm/io.h>
 #include <spl.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/sysfw-loader.h>
+#include "sysfw-loader.h"
 #include <asm/arch/sys_proto.h>
 #include "common.h"
 #include <dm.h>
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index afd46647405..6c18778c73e 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -12,7 +12,7 @@
 #include <asm/io.h>
 #include <asm/armv7_mpu.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/sysfw-loader.h>
+#include "sysfw-loader.h"
 #include "common.h"
 #include <asm/arch/sys_proto.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
diff --git a/arch/arm/mach-k3/j721s2_init.c b/arch/arm/mach-k3/j721s2_init.c
index fb95984c1ab..4785a747bf3 100644
--- a/arch/arm/mach-k3/j721s2_init.c
+++ b/arch/arm/mach-k3/j721s2_init.c
@@ -12,7 +12,7 @@
 #include <asm/io.h>
 #include <asm/armv7_mpu.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/sysfw-loader.h>
+#include "sysfw-loader.h"
 #include "common.h"
 #include <asm/arch/sys_proto.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
diff --git a/arch/arm/mach-k3/include/mach/sysfw-loader.h b/arch/arm/mach-k3/sysfw-loader.h
similarity index 100%
rename from arch/arm/mach-k3/include/mach/sysfw-loader.h
rename to arch/arm/mach-k3/sysfw-loader.h
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
                   ` (5 preceding siblings ...)
  2023-03-30 20:28 ` [PATCH 07/12] arm: mach-k3: Move sysfw-loader.h out of mach includes Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-04-02 10:44   ` Christian Gmeiner
  2023-03-30 20:28 ` [PATCH 09/12] arm: mach-k3: Remove unused fdt_disable_node() Andrew Davis
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

This matches how it was done for pre-K3 TI platforms and it allows
us to move the forward declaration out of sys_proto.h.

It also removes the need to check for TI_I2C_BOARD_DETECT before
calling this function, which might not be the right guard ifdef
should a board use a different method for board detection.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/am642_init.c             |  3 +--
 arch/arm/mach-k3/am654_init.c             |  3 +--
 arch/arm/mach-k3/common.c                 | 10 ++++++++++
 arch/arm/mach-k3/common.h                 |  2 ++
 arch/arm/mach-k3/include/mach/sys_proto.h |  2 --
 arch/arm/mach-k3/j721e_init.c             |  6 ++----
 6 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c
index b29b7376ffd..192c8f785de 100644
--- a/arch/arm/mach-k3/am642_init.c
+++ b/arch/arm/mach-k3/am642_init.c
@@ -100,8 +100,7 @@ void do_dt_magic(void)
 {
 	int ret, rescan;
 
-	if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT))
-		do_board_detect();
+	do_board_detect();
 
 	/*
 	 * Board detection has been done.
diff --git a/arch/arm/mach-k3/am654_init.c b/arch/arm/mach-k3/am654_init.c
index 5b8e506c793..5a9a780f521 100644
--- a/arch/arm/mach-k3/am654_init.c
+++ b/arch/arm/mach-k3/am654_init.c
@@ -246,8 +246,7 @@ void board_init_f(ulong dummy)
 	k3_sysfw_print_ver();
 
 	/* Perform EEPROM-based board detection */
-	if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT))
-		do_board_detect();
+	do_board_detect();
 
 #if defined(CONFIG_CPU_V7R) && defined(CONFIG_K3_AVS0)
 	ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(k3_avs),
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 4f2e14c3105..115f5959734 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -636,3 +636,13 @@ int misc_init_r(void)
 
 	return 0;
 }
+
+/**
+ * do_board_detect() - Detect board description
+ *
+ * Function to detect board description. This is expected to be
+ * overridden in the SoC family board file where desired.
+ */
+void __weak do_board_detect(void)
+{
+}
diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
index 531be0be54c..130f5021123 100644
--- a/arch/arm/mach-k3/common.h
+++ b/arch/arm/mach-k3/common.h
@@ -35,3 +35,5 @@ void mmr_unlock(phys_addr_t base, u32 partition);
 bool is_rom_loaded_sysfw(struct rom_extended_boot_data *data);
 enum k3_device_type get_device_type(void);
 void ti_secure_image_post_process(void **p_image, size_t *p_size);
+struct ti_sci_handle *get_ti_sci_handle(void);
+void do_board_detect(void);
diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
index 8cc75b636b5..939de0f79b4 100644
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ b/arch/arm/mach-k3/include/mach/sys_proto.h
@@ -10,8 +10,6 @@
 void sdelay(unsigned long loops);
 u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
 		  u32 bound);
-struct ti_sci_handle *get_ti_sci_handle(void);
-int do_board_detect(void);
 int fdt_disable_node(void *blob, char *node_path);
 
 void k3_spl_init(void);
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index 6c18778c73e..92f11133c85 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -160,8 +160,7 @@ void do_dt_magic(void)
 	int ret, rescan, mmc_dev = -1;
 	static struct mmc *mmc;
 
-	if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT))
-		do_board_detect();
+	do_board_detect();
 
 	/*
 	 * Board detection has been done.
@@ -288,8 +287,7 @@ void board_init_f(ulong dummy)
 	k3_sysfw_print_ver();
 
 	/* Perform EEPROM-based board detection */
-	if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT))
-		do_board_detect();
+	do_board_detect();
 
 #if defined(CONFIG_CPU_V7R) && defined(CONFIG_K3_AVS0)
 	ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(k3_avs),
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 09/12] arm: mach-k3: Remove unused fdt_disable_node()
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
                   ` (6 preceding siblings ...)
  2023-03-30 20:28 ` [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-03-30 20:28 ` [PATCH 10/12] arm: mach-k3: Move sdelay() and wait_on_value() declaration Andrew Davis
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

This function is not used currently; remove it.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/common.c                 | 19 -------------------
 arch/arm/mach-k3/include/mach/sys_proto.h |  1 -
 2 files changed, 20 deletions(-)

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 115f5959734..9f2f5a98771 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -395,25 +395,6 @@ int fdt_fixup_msmc_ram(void *blob, char *parent_path, char *node_name)
 	return 0;
 }
 
-int fdt_disable_node(void *blob, char *node_path)
-{
-	int offs;
-	int ret;
-
-	offs = fdt_path_offset(blob, node_path);
-	if (offs < 0) {
-		printf("Node %s not found.\n", node_path);
-		return offs;
-	}
-	ret = fdt_setprop_string(blob, offs, "status", "disabled");
-	if (ret < 0) {
-		printf("Could not add status property to node %s: %s\n",
-		       node_path, fdt_strerror(ret));
-		return ret;
-	}
-	return 0;
-}
-
 #if defined(CONFIG_OF_SYSTEM_SETUP)
 int ft_system_setup(void *blob, struct bd_info *bd)
 {
diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
index 939de0f79b4..bbe57718e1a 100644
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ b/arch/arm/mach-k3/include/mach/sys_proto.h
@@ -10,7 +10,6 @@
 void sdelay(unsigned long loops);
 u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
 		  u32 bound);
-int fdt_disable_node(void *blob, char *node_path);
 
 void k3_spl_init(void);
 void k3_mem_init(void);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 10/12] arm: mach-k3: Move sdelay() and wait_on_value() declaration
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
                   ` (7 preceding siblings ...)
  2023-03-30 20:28 ` [PATCH 09/12] arm: mach-k3: Remove unused fdt_disable_node() Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-03-30 20:28 ` [PATCH 11/12] arm: mach-k3: Move J721s2 SPL init functions to mach-k3 Andrew Davis
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

These probably should be in some system wide header given their use.
Until then move them out of K3 sys_proto.h so we can finish cleaning
that header out.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/include/mach/sys_proto.h | 4 ----
 drivers/ram/k3-am654-ddrss.c              | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
index bbe57718e1a..4b4e2a5be39 100644
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ b/arch/arm/mach-k3/include/mach/sys_proto.h
@@ -7,10 +7,6 @@
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
 
-void sdelay(unsigned long loops);
-u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
-		  u32 bound);
-
 void k3_spl_init(void);
 void k3_mem_init(void);
 bool check_rom_loaded_sysfw(void);
diff --git a/drivers/ram/k3-am654-ddrss.c b/drivers/ram/k3-am654-ddrss.c
index 4453c247b29..adac14f9464 100644
--- a/drivers/ram/k3-am654-ddrss.c
+++ b/drivers/ram/k3-am654-ddrss.c
@@ -18,6 +18,10 @@
 #include <power/regulator.h>
 #include "k3-am654-ddrss.h"
 
+void sdelay(unsigned long loops);
+u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
+		  u32 bound);
+
 #define LDELAY 10000
 
 /* DDRSS PHY configuration register fixed values */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 11/12] arm: mach-k3: Move J721s2 SPL init functions to mach-k3
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
                   ` (8 preceding siblings ...)
  2023-03-30 20:28 ` [PATCH 10/12] arm: mach-k3: Move sdelay() and wait_on_value() declaration Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-03-30 20:28 ` [PATCH 12/12] arm: mach-k3: Remove empty sys_proto.h include Andrew Davis
  2023-04-02 10:47 ` [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Christian Gmeiner
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

This matches AM64 and J721e and removes the need to forward
declare k3_spl_init(), k3_mem_init(), and check_rom_loaded_sysfw()
in sys_proto.h.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/include/mach/sys_proto.h |  3 --
 arch/arm/mach-k3/j721s2_init.c            | 64 +++++++++++++++++++++++
 board/ti/j721s2/evm.c                     | 63 ----------------------
 3 files changed, 64 insertions(+), 66 deletions(-)

diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
index 4b4e2a5be39..5638c6f8c8a 100644
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ b/arch/arm/mach-k3/include/mach/sys_proto.h
@@ -7,7 +7,4 @@
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
 
-void k3_spl_init(void);
-void k3_mem_init(void);
-bool check_rom_loaded_sysfw(void);
 #endif
diff --git a/arch/arm/mach-k3/j721s2_init.c b/arch/arm/mach-k3/j721s2_init.c
index 4785a747bf3..175ac4028a0 100644
--- a/arch/arm/mach-k3/j721s2_init.c
+++ b/arch/arm/mach-k3/j721s2_init.c
@@ -19,6 +19,7 @@
 #include <dm.h>
 #include <dm/uclass-internal.h>
 #include <dm/pinctrl.h>
+#include <dm/root.h>
 #include <mmc.h>
 #include <remoteproc.h>
 
@@ -182,6 +183,69 @@ void k3_mem_init(void)
 	spl_enable_dcache();
 }
 
+/* Support for the various EVM / SK families */
+#if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
+void do_dt_magic(void)
+{
+	int ret, rescan, mmc_dev = -1;
+	static struct mmc *mmc;
+
+	do_board_detect();
+
+	/*
+	 * Board detection has been done.
+	 * Let us see if another dtb wouldn't be a better match
+	 * for our board
+	 */
+	if (IS_ENABLED(CONFIG_CPU_V7R)) {
+		ret = fdtdec_resetup(&rescan);
+		if (!ret && rescan) {
+			dm_uninit();
+			dm_init_and_scan(true);
+		}
+	}
+
+	/*
+	 * Because of multi DTB configuration, the MMC device has
+	 * to be re-initialized after reconfiguring FDT inorder to
+	 * boot from MMC. Do this when boot mode is MMC and ROM has
+	 * not loaded SYSFW.
+	 */
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+		mmc_dev = 0;
+		break;
+	case BOOT_DEVICE_MMC2:
+	case BOOT_DEVICE_MMC2_2:
+		mmc_dev = 1;
+		break;
+	}
+
+	if (mmc_dev > 0 && !check_rom_loaded_sysfw()) {
+		ret = mmc_init_device(mmc_dev);
+		if (!ret) {
+			mmc = find_mmc_device(mmc_dev);
+			if (mmc) {
+				ret = mmc_init(mmc);
+				if (ret)
+					printf("mmc init failed with error: %d\n", ret);
+			}
+		}
+	}
+}
+#endif
+
+#ifdef CONFIG_SPL_BUILD
+void board_init_f(ulong dummy)
+{
+	k3_spl_init();
+#if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
+	do_dt_magic();
+#endif
+	k3_mem_init();
+}
+#endif
+
 u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 {
 	switch (boot_device) {
diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c
index 9b130c141ac..d3f9a655899 100644
--- a/board/ti/j721s2/evm.c
+++ b/board/ti/j721s2/evm.c
@@ -192,66 +192,3 @@ int board_late_init(void)
 void spl_board_init(void)
 {
 }
-
-/* Support for the various EVM / SK families */
-#if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
-void do_dt_magic(void)
-{
-	int ret, rescan, mmc_dev = -1;
-	static struct mmc *mmc;
-
-	do_board_detect();
-
-	/*
-	 * Board detection has been done.
-	 * Let us see if another dtb wouldn't be a better match
-	 * for our board
-	 */
-	if (IS_ENABLED(CONFIG_CPU_V7R)) {
-		ret = fdtdec_resetup(&rescan);
-		if (!ret && rescan) {
-			dm_uninit();
-			dm_init_and_scan(true);
-		}
-	}
-
-	/*
-	 * Because of multi DTB configuration, the MMC device has
-	 * to be re-initialized after reconfiguring FDT inorder to
-	 * boot from MMC. Do this when boot mode is MMC and ROM has
-	 * not loaded SYSFW.
-	 */
-	switch (spl_boot_device()) {
-	case BOOT_DEVICE_MMC1:
-		mmc_dev = 0;
-		break;
-	case BOOT_DEVICE_MMC2:
-	case BOOT_DEVICE_MMC2_2:
-		mmc_dev = 1;
-		break;
-	}
-
-	if (mmc_dev > 0 && !check_rom_loaded_sysfw()) {
-		ret = mmc_init_device(mmc_dev);
-		if (!ret) {
-			mmc = find_mmc_device(mmc_dev);
-			if (mmc) {
-				ret = mmc_init(mmc);
-				if (ret)
-					printf("mmc init failed with error: %d\n", ret);
-			}
-		}
-	}
-}
-#endif
-
-#ifdef CONFIG_SPL_BUILD
-void board_init_f(ulong dummy)
-{
-	k3_spl_init();
-#if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
-	do_dt_magic();
-#endif
-	k3_mem_init();
-}
-#endif
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 12/12] arm: mach-k3: Remove empty sys_proto.h include
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
                   ` (9 preceding siblings ...)
  2023-03-30 20:28 ` [PATCH 11/12] arm: mach-k3: Move J721s2 SPL init functions to mach-k3 Andrew Davis
@ 2023-03-30 20:28 ` Andrew Davis
  2023-04-02 10:47 ` [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Christian Gmeiner
  11 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-03-30 20:28 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, u-boot; +Cc: Andrew Davis

This header file is now empty, remove it.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/mach-k3/am642_init.c             |  2 --
 arch/arm/mach-k3/am654_init.c             |  1 -
 arch/arm/mach-k3/common.c                 |  1 -
 arch/arm/mach-k3/include/mach/sys_proto.h | 10 ----------
 arch/arm/mach-k3/j721e_init.c             |  1 -
 arch/arm/mach-k3/j721s2_init.c            |  1 -
 arch/arm/mach-k3/security.c               |  1 -
 arch/arm/mach-k3/sysfw-loader.c           |  1 -
 board/siemens/iot2050/board.c             |  1 -
 board/ti/am62ax/evm.c                     |  1 -
 board/ti/am62x/evm.c                      |  1 -
 board/ti/am64x/evm.c                      |  1 -
 board/ti/am65x/evm.c                      |  2 --
 board/ti/j721e/evm.c                      |  2 --
 board/ti/j721s2/evm.c                     |  2 --
 drivers/phy/phy-ti-am654.c                |  1 -
 drivers/ram/k3-am654-ddrss.c              |  1 -
 17 files changed, 30 deletions(-)
 delete mode 100644 arch/arm/mach-k3/include/mach/sys_proto.h

diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c
index 192c8f785de..078755178ea 100644
--- a/arch/arm/mach-k3/am642_init.c
+++ b/arch/arm/mach-k3/am642_init.c
@@ -13,9 +13,7 @@
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include "sysfw-loader.h"
-#include <asm/arch/sys_proto.h>
 #include "common.h"
-#include <asm/arch/sys_proto.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
diff --git a/arch/arm/mach-k3/am654_init.c b/arch/arm/mach-k3/am654_init.c
index 5a9a780f521..b5021069d62 100644
--- a/arch/arm/mach-k3/am654_init.c
+++ b/arch/arm/mach-k3/am654_init.c
@@ -14,7 +14,6 @@
 #include <spl.h>
 #include <asm/arch/hardware.h>
 #include "sysfw-loader.h"
-#include <asm/arch/sys_proto.h>
 #include "common.h"
 #include <dm.h>
 #include <dm/uclass-internal.h>
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 9f2f5a98771..e29e51b7042 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -19,7 +19,6 @@
 #include <asm/cache.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <fdt_support.h>
-#include <asm/arch/sys_proto.h>
 #include <asm/hardware.h>
 #include <asm/io.h>
 #include <fs_loader.h>
diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
deleted file mode 100644
index 5638c6f8c8a..00000000000
--- a/arch/arm/mach-k3/include/mach/sys_proto.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
- *	Andreas Dannenberg <dannenberg@ti.com>
- */
-
-#ifndef _SYS_PROTO_H_
-#define _SYS_PROTO_H_
-
-#endif
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index 92f11133c85..7666ac9b91a 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -14,7 +14,6 @@
 #include <asm/arch/hardware.h>
 #include "sysfw-loader.h"
 #include "common.h"
-#include <asm/arch/sys_proto.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
diff --git a/arch/arm/mach-k3/j721s2_init.c b/arch/arm/mach-k3/j721s2_init.c
index 175ac4028a0..001d9466c20 100644
--- a/arch/arm/mach-k3/j721s2_init.c
+++ b/arch/arm/mach-k3/j721s2_init.c
@@ -14,7 +14,6 @@
 #include <asm/arch/hardware.h>
 #include "sysfw-loader.h"
 #include "common.h"
-#include <asm/arch/sys_proto.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
diff --git a/arch/arm/mach-k3/security.c b/arch/arm/mach-k3/security.c
index 092588f4b5e..6179f7373aa 100644
--- a/arch/arm/mach-k3/security.c
+++ b/arch/arm/mach-k3/security.c
@@ -17,7 +17,6 @@
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <mach/spl.h>
 #include <spl.h>
-#include <asm/arch/sys_proto.h>
 #include <linux/dma-mapping.h>
 
 #include "common.h"
diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
index c4c5c371100..9be2d9eaea2 100644
--- a/arch/arm/mach-k3/sysfw-loader.c
+++ b/arch/arm/mach-k3/sysfw-loader.c
@@ -23,7 +23,6 @@
 #include <spi_flash.h>
 
 #include <asm/io.h>
-#include <asm/arch/sys_proto.h>
 #include "common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c
index 8b0506e4cb9..e0614ff853d 100644
--- a/board/siemens/iot2050/board.c
+++ b/board/siemens/iot2050/board.c
@@ -19,7 +19,6 @@
 #include <spl.h>
 #include <version.h>
 #include <linux/delay.h>
-#include <asm/arch/sys_proto.h>
 #include <asm/arch/hardware.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
diff --git a/board/ti/am62ax/evm.c b/board/ti/am62ax/evm.c
index beef3f2f3da..f2dd3b4192e 100644
--- a/board/ti/am62ax/evm.c
+++ b/board/ti/am62ax/evm.c
@@ -7,7 +7,6 @@
  */
 
 #include <asm/arch/hardware.h>
-#include <asm/arch/sys_proto.h>
 #include <asm/io.h>
 #include <common.h>
 #include <dm/uclass.h>
diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
index 20b2a701223..034fbed3aa4 100644
--- a/board/ti/am62x/evm.c
+++ b/board/ti/am62x/evm.c
@@ -15,7 +15,6 @@
 #include <fdt_support.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/sys_proto.h>
 #include <dm/uclass.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
index c88139ac7ac..b63792e8888 100644
--- a/board/ti/am64x/evm.c
+++ b/board/ti/am64x/evm.c
@@ -14,7 +14,6 @@
 #include <spl.h>
 #include <fdt_support.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/sys_proto.h>
 #include <env.h>
 
 #include "../common/board_detect.h"
diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
index 4053b8333cf..706b2198183 100644
--- a/board/ti/am65x/evm.c
+++ b/board/ti/am65x/evm.c
@@ -13,7 +13,6 @@
 #include <image.h>
 #include <init.h>
 #include <net.h>
-#include <asm/arch/sys_proto.h>
 #include <asm/arch/hardware.h>
 #include <asm/global_data.h>
 #include <asm/gpio.h>
@@ -21,7 +20,6 @@
 #include <asm/omap_common.h>
 #include <env.h>
 #include <spl.h>
-#include <asm/arch/sys_proto.h>
 
 #include "../common/board_detect.h"
 
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 00ce009d3e8..2398bead782 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -15,13 +15,11 @@
 #include <init.h>
 #include <log.h>
 #include <net.h>
-#include <asm/arch/sys_proto.h>
 #include <asm/arch/hardware.h>
 #include <asm/global_data.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <spl.h>
-#include <asm/arch/sys_proto.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
 
diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c
index d3f9a655899..09d26883f19 100644
--- a/board/ti/j721s2/evm.c
+++ b/board/ti/j721s2/evm.c
@@ -15,12 +15,10 @@
 #include <init.h>
 #include <log.h>
 #include <net.h>
-#include <asm/arch/sys_proto.h>
 #include <asm/arch/hardware.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <spl.h>
-#include <asm/arch/sys_proto.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
 #include <dm/root.h>
diff --git a/drivers/phy/phy-ti-am654.c b/drivers/phy/phy-ti-am654.c
index 27a312227bc..70a746d2c92 100644
--- a/drivers/phy/phy-ti-am654.c
+++ b/drivers/phy/phy-ti-am654.c
@@ -16,7 +16,6 @@
 #include <dt-bindings/phy/phy.h>
 #include <generic-phy.h>
 #include <asm/io.h>
-#include <asm/arch/sys_proto.h>
 #include <power-domain.h>
 #include <regmap.h>
 #include <syscon.h>
diff --git a/drivers/ram/k3-am654-ddrss.c b/drivers/ram/k3-am654-ddrss.c
index adac14f9464..b8338f84a3d 100644
--- a/drivers/ram/k3-am654-ddrss.c
+++ b/drivers/ram/k3-am654-ddrss.c
@@ -13,7 +13,6 @@
 #include <ram.h>
 #include <asm/io.h>
 #include <power-domain.h>
-#include <asm/arch/sys_proto.h>
 #include <dm/device_compat.h>
 #include <power/regulator.h>
 #include "k3-am654-ddrss.h"
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file
  2023-03-30 20:28 ` [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file Andrew Davis
@ 2023-04-02 10:44   ` Christian Gmeiner
  2023-04-05 14:42     ` Andrew Davis
  0 siblings, 1 reply; 15+ messages in thread
From: Christian Gmeiner @ 2023-04-02 10:44 UTC (permalink / raw)
  To: Andrew Davis; +Cc: Simon Glass, Tom Rini, u-boot

Hi Andrew

Am Do., 30. März 2023 um 22:30 Uhr schrieb Andrew Davis <afd@ti.com>:
>
> This matches how it was done for pre-K3 TI platforms and it allows
> us to move the forward declaration out of sys_proto.h.
>
> It also removes the need to check for TI_I2C_BOARD_DETECT before
> calling this function, which might not be the right guard ifdef
> should a board use a different method for board detection.
>
> Signed-off-by: Andrew Davis <afd@ti.com>

This change is conflicting with what is u-boot/next:
https://source.denx.de/u-boot/u-boot/-/commit/e44657ed744d1b4e216d8dda5d528ff0d0a6234e

-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level
  2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
                   ` (10 preceding siblings ...)
  2023-03-30 20:28 ` [PATCH 12/12] arm: mach-k3: Remove empty sys_proto.h include Andrew Davis
@ 2023-04-02 10:47 ` Christian Gmeiner
  11 siblings, 0 replies; 15+ messages in thread
From: Christian Gmeiner @ 2023-04-02 10:47 UTC (permalink / raw)
  To: Andrew Davis; +Cc: Simon Glass, Tom Rini, u-boot

Am Do., 30. März 2023 um 22:31 Uhr schrieb Andrew Davis <afd@ti.com>:
>
> The MSMC fixup is something we do based on SoC, not based on the board.
> So this fixup does not belong in the board files. Move this to the
> mach-k3 common file so that it does not have to be done in each board
> that uses these SoCs.
>
> We use ft_system_setup() here instead of ft_board_setup() since it is no
> longer board level. Enable OF_SYSTEM_SETUP in the configurations that use
> this to keep functionality the same.
>
> Signed-off-by: Andrew Davis <afd@ti.com>

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

> ---
>  arch/arm/mach-k3/common.c                 | 16 ++++++++++++++++
>  arch/arm/mach-k3/include/mach/sys_proto.h |  1 -
>  board/siemens/iot2050/board.c             | 16 ----------------
>  board/ti/am65x/evm.c                      | 18 ------------------
>  board/ti/j721e/evm.c                      | 11 +----------
>  board/ti/j721s2/evm.c                     | 16 ----------------
>  configs/am65x_evm_a53_defconfig           |  2 +-
>  configs/am65x_hs_evm_a53_defconfig        |  2 +-
>  configs/iot2050_defconfig                 |  2 +-
>  configs/j7200_evm_a72_defconfig           |  1 +
>  configs/j7200_hs_evm_a72_defconfig        |  1 +
>  configs/j721e_evm_a72_defconfig           |  1 +
>  configs/j721e_hs_evm_a72_defconfig        |  1 +
>  configs/j721s2_evm_a72_defconfig          |  2 +-
>  configs/j721s2_hs_evm_a72_defconfig       |  2 +-
>  15 files changed, 26 insertions(+), 66 deletions(-)
>
> diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
> index a2adb791f6c..6870f13c520 100644
> --- a/arch/arm/mach-k3/common.c
> +++ b/arch/arm/mach-k3/common.c
> @@ -386,6 +386,22 @@ int fdt_disable_node(void *blob, char *node_path)
>         return 0;
>  }
>
> +#if defined(CONFIG_OF_SYSTEM_SETUP)
> +int ft_system_setup(void *blob, struct bd_info *bd)
> +{
> +       int ret;
> +
> +       ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
> +       if (ret < 0)
> +               ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
> +                                        "sram@70000000");
> +       if (ret)
> +               printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
> +
> +       return ret;
> +}
> +#endif
> +
>  #endif
>
>  #ifndef CONFIG_SYSRESET
> diff --git a/arch/arm/mach-k3/include/mach/sys_proto.h b/arch/arm/mach-k3/include/mach/sys_proto.h
> index 3d3d90d02d6..0b5d606eaa2 100644
> --- a/arch/arm/mach-k3/include/mach/sys_proto.h
> +++ b/arch/arm/mach-k3/include/mach/sys_proto.h
> @@ -11,7 +11,6 @@ void sdelay(unsigned long loops);
>  u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
>                   u32 bound);
>  struct ti_sci_handle *get_ti_sci_handle(void);
> -int fdt_fixup_msmc_ram(void *blob, char *parent_path, char *node_name);
>  int do_board_detect(void);
>  void release_resources_for_core_shutdown(void);
>  int fdt_disable_node(void *blob, char *node_path);
> diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c
> index 8f4b0eae495..8b0506e4cb9 100644
> --- a/board/siemens/iot2050/board.c
> +++ b/board/siemens/iot2050/board.c
> @@ -230,22 +230,6 @@ int board_late_init(void)
>         return 0;
>  }
>
> -#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
> -int ft_board_setup(void *blob, struct bd_info *bd)
> -{
> -       int ret;
> -
> -       ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
> -       if (ret < 0)
> -               ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
> -                                        "sram@70000000");
> -       if (ret)
> -               pr_err("%s: fixing up msmc ram failed %d\n", __func__, ret);
> -
> -       return ret;
> -}
> -#endif
> -
>  void spl_board_init(void)
>  {
>  }
> diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
> index b266ccb4b82..4053b8333cf 100644
> --- a/board/ti/am65x/evm.c
> +++ b/board/ti/am65x/evm.c
> @@ -101,24 +101,6 @@ int board_fit_config_name_match(const char *name)
>  }
>  #endif
>
> -#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
> -int ft_board_setup(void *blob, struct bd_info *bd)
> -{
> -       int ret;
> -
> -       ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
> -       if (ret < 0)
> -               ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
> -                                        "sram@70000000");
> -       if (ret) {
> -               printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
> -               return ret;
> -       }
> -
> -       return 0;
> -}
> -#endif
> -
>  #ifdef CONFIG_TI_I2C_BOARD_DETECT
>  int do_board_detect(void)
>  {
> diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
> index d4e672a7acd..00ce009d3e8 100644
> --- a/board/ti/j721e/evm.c
> +++ b/board/ti/j721e/evm.c
> @@ -144,18 +144,9 @@ void spl_perform_fixups(struct spl_image_info *spl_image)
>  #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
>  int ft_board_setup(void *blob, struct bd_info *bd)
>  {
> -       int ret;
> -
> -       ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
> -       if (ret < 0)
> -               ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
> -                                        "sram@70000000");
> -       if (ret)
> -               printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
> -
>         detect_enable_hyperflash(blob);
>
> -       return ret;
> +       return 0;
>  }
>  #endif
>
> diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c
> index c86715fa211..9b130c141ac 100644
> --- a/board/ti/j721s2/evm.c
> +++ b/board/ti/j721s2/evm.c
> @@ -73,22 +73,6 @@ int dram_init_banksize(void)
>         return 0;
>  }
>
> -#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
> -int ft_board_setup(void *blob, struct bd_info *bd)
> -{
> -       int ret;
> -
> -       ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
> -       if (ret < 0)
> -               ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
> -                                        "sram@70000000");
> -       if (ret)
> -               printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
> -
> -       return ret;
> -}
> -#endif
> -
>  #ifdef CONFIG_TI_I2C_BOARD_DETECT
>  /*
>   * Functions specific to EVM and SK designs of J721S2/AM68 family.
> diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
> index bddd94ce80e..4af274e06d6 100644
> --- a/configs/am65x_evm_a53_defconfig
> +++ b/configs/am65x_evm_a53_defconfig
> @@ -30,7 +30,7 @@ CONFIG_SPL_SPI=y
>  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
>  CONFIG_SPL_LOAD_FIT=y
>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
> -CONFIG_OF_BOARD_SETUP=y
> +CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
>  CONFIG_LOGLEVEL=7
> diff --git a/configs/am65x_hs_evm_a53_defconfig b/configs/am65x_hs_evm_a53_defconfig
> index 898403aad98..bdd4b6420dd 100644
> --- a/configs/am65x_hs_evm_a53_defconfig
> +++ b/configs/am65x_hs_evm_a53_defconfig
> @@ -30,7 +30,7 @@ CONFIG_SPL_SPI=y
>  # CONFIG_PSCI_RESET is not set
>  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
>  CONFIG_SPL_LOAD_FIT=y
> -CONFIG_OF_BOARD_SETUP=y
> +CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_fit_${boot}; run get_overlaystring; run run_fit"
>  CONFIG_LOGLEVEL=7
> diff --git a/configs/iot2050_defconfig b/configs/iot2050_defconfig
> index 57387edcb41..95a6418d0ae 100644
> --- a/configs/iot2050_defconfig
> +++ b/configs/iot2050_defconfig
> @@ -27,7 +27,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
>  CONFIG_SPL_SPI=y
>  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
>  CONFIG_SPL_LOAD_FIT=y
> -CONFIG_OF_BOARD_SETUP=y
> +CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTSTAGE=y
>  CONFIG_SHOW_BOOT_PROGRESS=y
> diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig
> index 9b6512bacba..f9299780f71 100644
> --- a/configs/j7200_evm_a72_defconfig
> +++ b/configs/j7200_evm_a72_defconfig
> @@ -31,6 +31,7 @@ CONFIG_SPL_SPI=y
>  CONFIG_SPL_LOAD_FIT=y
>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
>  CONFIG_OF_BOARD_SETUP=y
> +CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
>  CONFIG_LOGLEVEL=7
> diff --git a/configs/j7200_hs_evm_a72_defconfig b/configs/j7200_hs_evm_a72_defconfig
> index cfd2e80aded..e83525bcb5e 100644
> --- a/configs/j7200_hs_evm_a72_defconfig
> +++ b/configs/j7200_hs_evm_a72_defconfig
> @@ -32,6 +32,7 @@ CONFIG_SPL_SPI=y
>  CONFIG_SPL_LOAD_FIT=y
>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
>  CONFIG_OF_BOARD_SETUP=y
> +CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_fit_${boot}; run get_overlaystring; run run_fit"
>  CONFIG_LOGLEVEL=7
> diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
> index 452e4b9695d..46ad1b7d1a1 100644
> --- a/configs/j721e_evm_a72_defconfig
> +++ b/configs/j721e_evm_a72_defconfig
> @@ -29,6 +29,7 @@ CONFIG_SPL_SPI=y
>  CONFIG_SPL_LOAD_FIT=y
>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
>  CONFIG_OF_BOARD_SETUP=y
> +CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run main_cpsw0_qsgmii_phyinit; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
>  CONFIG_LOGLEVEL=7
> diff --git a/configs/j721e_hs_evm_a72_defconfig b/configs/j721e_hs_evm_a72_defconfig
> index 651df4a4865..df4bf01daf9 100644
> --- a/configs/j721e_hs_evm_a72_defconfig
> +++ b/configs/j721e_hs_evm_a72_defconfig
> @@ -30,6 +30,7 @@ CONFIG_SPL_SPI=y
>  CONFIG_SPL_LOAD_FIT=y
>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
>  CONFIG_OF_BOARD_SETUP=y
> +CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run main_cpsw0_qsgmii_phyinit; run boot_rprocs; run get_fit_${boot}; run get_overlay_${boot}; run run_fit"
>  CONFIG_LOGLEVEL=7
> diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig
> index 3a91df71d37..9889e1bd523 100644
> --- a/configs/j721s2_evm_a72_defconfig
> +++ b/configs/j721s2_evm_a72_defconfig
> @@ -28,7 +28,7 @@ CONFIG_SPL_SPI=y
>  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
>  CONFIG_SPL_LOAD_FIT=y
>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
> -CONFIG_OF_BOARD_SETUP=y
> +CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
>  CONFIG_LOGLEVEL=7
> diff --git a/configs/j721s2_hs_evm_a72_defconfig b/configs/j721s2_hs_evm_a72_defconfig
> index 453f2aabbfc..035d87b49f1 100644
> --- a/configs/j721s2_hs_evm_a72_defconfig
> +++ b/configs/j721s2_hs_evm_a72_defconfig
> @@ -31,7 +31,7 @@ CONFIG_SPL_SPI=y
>  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
>  CONFIG_SPL_LOAD_FIT=y
>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
> -CONFIG_OF_BOARD_SETUP=y
> +CONFIG_OF_SYSTEM_SETUP=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_fit_${boot}; run get_overlaystring; run run_fit"
>  CONFIG_LOGLEVEL=7
> --
> 2.39.2
>


-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file
  2023-04-02 10:44   ` Christian Gmeiner
@ 2023-04-05 14:42     ` Andrew Davis
  0 siblings, 0 replies; 15+ messages in thread
From: Andrew Davis @ 2023-04-05 14:42 UTC (permalink / raw)
  To: Christian Gmeiner; +Cc: Simon Glass, Tom Rini, u-boot

On 4/2/23 5:44 AM, Christian Gmeiner wrote:
> Hi Andrew
> 
> Am Do., 30. März 2023 um 22:30 Uhr schrieb Andrew Davis <afd@ti.com>:
>>
>> This matches how it was done for pre-K3 TI platforms and it allows
>> us to move the forward declaration out of sys_proto.h.
>>
>> It also removes the need to check for TI_I2C_BOARD_DETECT before
>> calling this function, which might not be the right guard ifdef
>> should a board use a different method for board detection.
>>
>> Signed-off-by: Andrew Davis <afd@ti.com>
> 
> This change is conflicting with what is u-boot/next:
> https://source.denx.de/u-boot/u-boot/-/commit/e44657ed744d1b4e216d8dda5d528ff0d0a6234e
> 

Thanks for the heads up, will rebase on latest and resend.

Andrew

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-04-05 14:42 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
2023-03-30 20:28 ` [PATCH 02/12] arm: mach-k3: Move J721e SoC detection out of common section Andrew Davis
2023-03-30 20:28 ` [PATCH 03/12] soc: soc_ti_k3: Use hardware.h to remove definition duplication Andrew Davis
2023-03-30 20:28 ` [PATCH 04/12] configs: j721x_evm.h: Remove unneeded check for SYS_K3_SPL_ATF Andrew Davis
2023-03-30 20:28 ` [PATCH 05/12] configs: j721s2_evm.h: Remove refrences to J7200 EVM Andrew Davis
2023-03-30 20:28 ` [PATCH 06/12] arm: mach-k3: Make release_resources_for_core_shutdown() common Andrew Davis
2023-03-30 20:28 ` [PATCH 07/12] arm: mach-k3: Move sysfw-loader.h out of mach includes Andrew Davis
2023-03-30 20:28 ` [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file Andrew Davis
2023-04-02 10:44   ` Christian Gmeiner
2023-04-05 14:42     ` Andrew Davis
2023-03-30 20:28 ` [PATCH 09/12] arm: mach-k3: Remove unused fdt_disable_node() Andrew Davis
2023-03-30 20:28 ` [PATCH 10/12] arm: mach-k3: Move sdelay() and wait_on_value() declaration Andrew Davis
2023-03-30 20:28 ` [PATCH 11/12] arm: mach-k3: Move J721s2 SPL init functions to mach-k3 Andrew Davis
2023-03-30 20:28 ` [PATCH 12/12] arm: mach-k3: Remove empty sys_proto.h include Andrew Davis
2023-04-02 10:47 ` [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Christian Gmeiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).