Skip to contentSkip to conversation

board/ti: k3 boards: Stop using findfdt

PATCH In review Nishanth Menon 2 participants 13 messages Feb 12, 2024 – Feb 21, 2024

lore
Share & tools
lore
#0 lore raw

cover board/ti: k3 boards: Stop using findfdt

Hi,

Hopefully the last time. Apologies on the screw ups. Ran CI loop[1] to be doubly sure that I have'nt yet again fat fingered something.

This is a wide cleanup to switch to setting fdtfile using env_set instead of scripted magic. 'fdtfile' is expected to be set by default. This allows the stdboot triggered efi loaders to find the correct OS device tree file even if regular boot process is interrupted by user intervention.

Fixes since V3:
* fix up missing header for am62x evm (I seemed to have dropped the fixup somehow)

based on:
master e8f2404e093d Merge branch 'master-779h0-r2' of https://source.denx.de/u-boot/custodians/u-boot-sh

Since this impacts out of box distro support, will be great to get it as part of 2024.04 release.

Testing (decided to retest it all): https://gist.github.com/nmenon/b9d49d752c27988aabdc062dcdc41e67

V3: https://lore.kernel.org/all/[email protected]/
V2: https://lore.kernel.org/all/[email protected]/
V1: https://lore.kernel.org/all/[email protected]/

Nishanth Menon (11):
board: ti: Add missing common/Kconfig references
board: ti: common: Introduce a common fdt ops library
board: ti: am62ax: Set fdtfile from C code instead of findfdt script
board: ti: am62x: Set fdtfile from C code instead of findfdt script
board: ti: am64x: Set fdtfile from C code instead of findfdt script
board: ti: am65x: Set fdtfile from C code instead of findfdt script
board: ti: j721e: Set fdtfile from C code instead of findfdt script
board: ti: j721s2: Set fdtfile from C code instead of findfdt script
board: beagle: beagleboneai64: Set fdtfile from C code instead of
findfdt script
board: beagle: beagleplay: Set fdtfile from C code instead of findfdt
script
include: env: ti: Drop default_findfdt

 board/beagle/beagleboneai64/beagleboneai64.c  | 14 ++++
 .../beagle/beagleboneai64/beagleboneai64.env  |  1 -
 board/beagle/beagleplay/beagleplay.c          | 14 ++++
 board/beagle/beagleplay/beagleplay.env        |  1 -
 board/ti/am62ax/am62ax.env                    |  1 -
 board/ti/am62ax/evm.c                         | 10 +++
 board/ti/am62x/am62x.env                      |  1 -
 board/ti/am62x/evm.c                          | 10 +++
 board/ti/am64x/am64x.env                      |  9 ---
 board/ti/am64x/evm.c                          |  8 +++
 board/ti/am65x/am65x.env                      |  3 -
 board/ti/am65x/evm.c                          |  2 +
 board/ti/common/Kconfig                       | 12 ++++
 board/ti/common/Makefile                      |  1 +
 board/ti/common/fdt_ops.c                     | 64 +++++++++++++++++++
 board/ti/common/fdt_ops.h                     | 42 ++++++++++++
 board/ti/j721e/evm.c                          |  8 +++
 board/ti/j721e/j721e.env                      | 10 ---
 board/ti/j721s2/evm.c                         |  8 +++
 board/ti/j721s2/j721s2.env                    |  8 ---
 board/ti/omap3evm/Kconfig                     |  2 +
 board/ti/panda/Kconfig                        |  2 +
 board/ti/sdp4430/Kconfig                      |  2 +
 configs/am62ax_evm_a53_defconfig              |  1 +
 configs/am62x_beagleplay_a53_defconfig        |  3 +-
 configs/am62x_evm_a53_defconfig               |  1 +
 configs/j721e_beagleboneai64_a72_defconfig    |  3 +-
 include/env/ti/default_findfdt.env            | 12 ----
 28 files changed, 205 insertions(+), 48 deletions(-)
 create mode 100644 board/ti/common/fdt_ops.c
 create mode 100644 board/ti/common/fdt_ops.h
 delete mode 100644 include/env/ti/default_findfdt.env

[1] https://github.com/u-boot/u-boot/pull/487

base-commit: e8f2404e093daf6cc3ac2b3233e3c6770d13e371

Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/11 board: ti: Add missing common/Kconfig references

Add missing board/ti/common/Kconfig references for the platforms that missed it. The intent is for the common Kconfig to be usable across TI reference boards as required.

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 board/ti/omap3evm/Kconfig | 2 ++
 board/ti/panda/Kconfig    | 2 ++
 board/ti/sdp4430/Kconfig  | 2 ++
 3 files changed, 6 insertions(+)
board/ti/omap3evm/Kconfig +2 -0
index 08a8aa20ae85..cd71fe083176 100644
@@ -9,4 +9,6 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "omap3_evm"
 
+source "board/ti/common/Kconfig"
+
 endif
board/ti/panda/Kconfig +2 -0
index 8f277b612a45..5912f69babe2 100644
@@ -9,4 +9,6 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "omap4_panda"
 
+source "board/ti/common/Kconfig"
+
 endif
board/ti/sdp4430/Kconfig +2 -0
index 36f185282166..65e9107bc1b0 100644
@@ -12,4 +12,6 @@ config SYS_CONFIG_NAME
 config CMD_BAT
 	bool "Enable board-specific battery command"
 
+source "board/ti/common/Kconfig"
+
 endif
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/11 board: ti: common: Introduce a common fdt ops library

In reply to Nishanth Menon

Introduce a common fdt operations library for basic device tree operations that are common between various boards.

The first library to introduce here is the capability to set up fdtfile as a standard variable as part of board identification rather than depend on scripted ifdeffery.

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 board/ti/common/Kconfig   | 12 ++++++++
 board/ti/common/Makefile  |  1 +
 board/ti/common/fdt_ops.c | 64 +++++++++++++++++++++++++++++++++++++++
 board/ti/common/fdt_ops.h | 42 +++++++++++++++++++++++++
 4 files changed, 119 insertions(+)
 create mode 100644 board/ti/common/fdt_ops.c
 create mode 100644 board/ti/common/fdt_ops.h
board/ti/common/Kconfig +12 -0
index 49edd98014ab..de44e4de2115 100644
@@ -49,3 +49,15 @@ config TI_COMMON_CMD_OPTIONS
 	imply CMD_SPI
 	imply CMD_TIME
 	imply CMD_USB if USB
+
+config TI_FDT_FOLDER_PATH
+	string "Location of Folder path where dtb is present"
+	default "ti/davinci" if ARCH_DAVINCI
+	default "ti/keystone" if ARCH_KEYSTONE
+	default "ti/omap" if ARCH_OMAP2PLUS
+	default "ti" if ARCH_K3
+	depends on ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3
+	help
+	   Folder path for kernel device tree default.
+	   This is used along with fdtfile path to locate the kernel
+	   device tree blob.
board/ti/common/Makefile +1 -0
index 26bf12e2e6d5..5ac361ba7fcf 100644
@@ -3,3 +3,4 @@
 
 obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o
 obj-${CONFIG_CMD_EXTENSION} += cape_detect.o
+obj-${CONFIG_OF_LIBFDT} += fdt_ops.o
board/ti/common/fdt_ops.c new file +64 -0

64 lines not on this page · raw message

board/ti/common/fdt_ops.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/11 board: ti: am62ax: Set fdtfile from C code instead of findfdt script

In reply to Nishanth Menon

Stop using the findfdt script and switch to setting the fdtfile from C code.

While at this, replace findfdt in environment with a warning as it is no longer needed

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 board/ti/am62ax/am62ax.env       |  1 -
 board/ti/am62ax/evm.c            | 10 ++++++++++
 configs/am62ax_evm_a53_defconfig |  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)
board/ti/am62ax/am62ax.env +0 -1
index a6d967e982d4..334374abb73e 100644
@@ -1,5 +1,4 @@
 #include <env/ti/ti_common.env>
-#include <env/ti/default_findfdt.env>
 #include <env/ti/mmc.env>
 
 name_kern=Image
board/ti/am62ax/evm.c +10 -0
index cd3360a43029..62d3664936e7 100644
@@ -13,6 +13,8 @@
 #include <fdt_support.h>
 #include <spl.h>
 
+#include "../common/fdt_ops.h"
+
 int board_init(void)
 {
 	return 0;
@@ -27,3 +29,11 @@ int dram_init_banksize(void)
 {
 	return fdtdec_setup_memory_banksize();
 }
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	ti_set_fdt_env(NULL, NULL);
+	return 0;
+}
+#endif
configs/am62ax_evm_a53_defconfig +1 -0
index 38083586a3ec..e5fcd8cc5b6f 100644
@@ -24,6 +24,7 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/11 board: ti: am62x: Set fdtfile from C code instead of findfdt script

In reply to Nishanth Menon

Stop using the findfdt script and switch to setting the fdtfile from C code.

While at this, replace findfdt in environment with a warning as it is no longer needed

---
Changes since V3:
* Add missing header file - have no idea how i dropped that fixup.. :(

V3: https://lore.kernel.org/r/[email protected]

 board/ti/am62x/am62x.env        |  1 -
 board/ti/am62x/evm.c            | 10 ++++++++++
 configs/am62x_evm_a53_defconfig |  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)
board/ti/am62x/am62x.env +0 -1
index e53a55c38fbb..9cb186c2a03c 100644
@@ -1,5 +1,4 @@
 #include <env/ti/ti_common.env>
-#include <env/ti/default_findfdt.env>
 #include <env/ti/mmc.env>
 
 name_kern=Image
board/ti/am62x/evm.c +10 -0
index 88e02155ee33..b3e8680dfab2 100644
@@ -19,6 +19,8 @@
 #include <asm/arch/hardware.h>
 #include <dm/uclass.h>
 
+#include "../common/fdt_ops.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #if CONFIG_IS_ENABLED(SPLASH_SCREEN)
@@ -54,6 +56,14 @@ int dram_init(void)
 	return fdtdec_setup_mem_size_base();
 }
 
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	ti_set_fdt_env(NULL, NULL);
+	return 0;
+}
+#endif
+
 int dram_init_banksize(void)
 {
 	return fdtdec_setup_memory_banksize();
configs/am62x_evm_a53_defconfig +1 -0
index 457931faf210..a39b82d05a63 100644
@@ -32,6 +32,7 @@ CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_SYS_BOOTM_LEN=0x800000
 CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80c80000
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/11 board: ti: am64x: Set fdtfile from C code instead of findfdt script

In reply to Nishanth Menon

We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".

While at this, replace findfdt in environment with a warning as it is no longer needed.

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 board/ti/am64x/am64x.env | 9 ---------
 board/ti/am64x/evm.c     | 8 ++++++++
 2 files changed, 8 insertions(+), 9 deletions(-)
board/ti/am64x/am64x.env +0 -9
index efd736b99be4..9a8812d4ee54 100644
@@ -2,14 +2,6 @@
 #include <env/ti/mmc.env>
 #include <env/ti/k3_dfu.env>
 
-findfdt=
-	if test $board_name = am64x_gpevm; then
-		setenv name_fdt ti/k3-am642-evm.dtb; fi;
-	if test $board_name = am64x_skevm; then
-		setenv name_fdt ti/k3-am642-sk.dtb; fi;
-	if test $name_fdt = undefined; then
-		echo WARNING: Could not determine device tree to use; fi;
-	setenv fdtfile ${name_fdt}
 name_kern=Image
 console=ttyS2,115200n8
 args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 ${mtdparts}
@@ -43,7 +35,6 @@ get_fit_usb=load usb ${bootpart} ${addr_fit}
 usbboot=setenv boot usb;
 	setenv bootpart 0:2;
 	usb start;
-	run findfdt;
 	run init_usb;
 	run get_kern_usb;
 	run get_fdt_usb;
board/ti/am64x/evm.c +8 -0
index a7ca6be436eb..b8de69da06c5 100644
@@ -16,6 +16,7 @@
 #include <env.h>
 
 #include "../common/board_detect.h"
+#include "../common/fdt_ops.h"
 
 #define board_is_am64x_gpevm() (board_ti_k3_is("AM64-GPEVM") || \
 				board_ti_k3_is("AM64-EVM") || \
@@ -181,6 +182,12 @@ int checkboard(void)
 }
 
 #ifdef CONFIG_BOARD_LATE_INIT
+static struct ti_fdt_map ti_am64_evm_fdt_map[] = {
+	{"am64x_gpevm", "k3-am642-evm.dtb"},
+	{"am64x_skevm", "k3-am642-sk.dtb"},
+	{ /* Sentinel. */ }
+};
+
 static void setup_board_eeprom_env(void)
 {
 	char *name = "am64x_gpevm";
@@ -198,6 +205,7 @@ static void setup_board_eeprom_env(void)
 
 invalid_eeprom:
 	set_board_info_env_am6(name);
+	ti_set_fdt_env(name, ti_am64_evm_fdt_map);
 }
 
 static void setup_serial(void)
Signature · 1 line
2.43.0
#6 lore raw

PATCH 6/11 board: ti: am65x: Set fdtfile from C code instead of findfdt script

In reply to Nishanth Menon

We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".

While at this, replace findfdt in environment with a warning as it is no longer needed.

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 board/ti/am65x/am65x.env | 3 ---
 board/ti/am65x/evm.c     | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
board/ti/am65x/am65x.env +0 -3
index 286b9c300c05..814374d68cf0 100644
@@ -5,9 +5,6 @@
 #include <env/ti/k3_rproc.env>
 #endif
 
-findfdt=
-	setenv name_fdt ti/k3-am654-base-board.dtb;
-	setenv fdtfile ${name_fdt}
 name_kern=Image
 console=ttyS2,115200n8
 args_all=setenv optargs ${optargs} earlycon=ns16550a,mmio32,0x02800000
board/ti/am65x/evm.c +2 -0
index df209021c1b7..3109c9a2acac 100644
@@ -22,6 +22,7 @@
 #include <linux/printk.h>
 
 #include "../common/board_detect.h"
+#include "../common/fdt_ops.h"
 
 #define board_is_am65x_base_board()	board_ti_is("AM6-COMPROCEVM")
 
@@ -141,6 +142,7 @@ static void setup_board_eeprom_env(void)
 
 invalid_eeprom:
 	set_board_info_env_am6(name);
+	ti_set_fdt_env(NULL, NULL);
 }
 
 static int init_daughtercard_det_gpio(char *gpio_name, struct gpio_desc *desc)
Signature · 1 line
2.43.0
#7 lore raw

PATCH 7/11 board: ti: j721e: Set fdtfile from C code instead of findfdt script

In reply to Nishanth Menon

We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".

While at this, replace findfdt in environment with a warning as it is no longer needed.

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 board/ti/j721e/evm.c     |  8 ++++++++
 board/ti/j721e/j721e.env | 10 ----------
 2 files changed, 8 insertions(+), 10 deletions(-)
board/ti/j721e/evm.c +8 -0
index b77cffc5ef56..9dc3ed6dfffa 100644
@@ -16,6 +16,7 @@
 #include <dm.h>
 
 #include "../common/board_detect.h"
+#include "../common/fdt_ops.h"
 
 #define board_is_j721e_som()	(board_ti_k3_is("J721EX-PM1-SOM") || \
 				 board_ti_k3_is("J721EX-PM2-SOM"))
@@ -353,6 +354,12 @@ static int probe_daughtercards(void)
 #endif
 
 #ifdef CONFIG_BOARD_LATE_INIT
+static struct ti_fdt_map ti_j721e_evm_fdt_map[] = {
+	{"j721e", "k3-j721e-common-proc-board.dtb"},
+	{"j721e-sk", "k3-j721e-sk.dtb"},
+	{"j7200", "k3-j7200-common-proc-board.dtb"},
+	{ /* Sentinel. */ }
+};
 static void setup_board_eeprom_env(void)
 {
 	char *name = "j721e";
@@ -372,6 +379,7 @@ static void setup_board_eeprom_env(void)
 
 invalid_eeprom:
 	set_board_info_env_am6(name);
+	ti_set_fdt_env(name, ti_j721e_evm_fdt_map);
 }
 
 static void setup_serial(void)
board/ti/j721e/j721e.env +0 -10
index cb27bf5e2b24..38bfd7d49634 100644
@@ -7,16 +7,6 @@
 #include <env/ti/k3_rproc.env>
 #endif
 
-default_device_tree=ti/k3-j721e-common-proc-board.dtb
-findfdt=
-	setenv name_fdt ${default_device_tree};
-	if test $board_name = j721e; then
-		setenv name_fdt ti/k3-j721e-common-proc-board.dtb; fi;
-	if test $board_name = j7200; then
-		setenv name_fdt ti/k3-j7200-common-proc-board.dtb; fi;
-	if test $board_name = j721e-eaik || test $board_name = j721e-sk; then
-		setenv name_fdt ti/k3-j721e-sk.dtb; fi;
-	setenv fdtfile ${name_fdt}
 name_kern=Image
 console=ttyS2,115200n8
 args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000
Signature · 1 line
2.43.0
#8 lore raw

PATCH 8/11 board: ti: j721s2: Set fdtfile from C code instead of findfdt script

In reply to Nishanth Menon

We now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".

While at this, replace findfdt in environment with a warning as it is no longer needed.

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 board/ti/j721s2/evm.c      | 8 ++++++++
 board/ti/j721s2/j721s2.env | 8 --------
 2 files changed, 8 insertions(+), 8 deletions(-)
board/ti/j721s2/evm.c +8 -0
index 1220cd84519b..5a0281d6b483 100644
@@ -23,6 +23,7 @@
 #include <dm/root.h>
 
 #include "../common/board_detect.h"
+#include "../common/fdt_ops.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -114,6 +115,12 @@ int checkboard(void)
 	return 0;
 }
 
+static struct ti_fdt_map ti_j721s2_evm_fdt_map[] = {
+	{"j721s2", "k3-j721s2-common-proc-board.dtb"},
+	{"am68-sk", "k3-am68-sk-base-board.dtb"},
+	{ /* Sentinel. */ }
+};
+
 static void setup_board_eeprom_env(void)
 {
 	char *name = "j721s2";
@@ -131,6 +138,7 @@ static void setup_board_eeprom_env(void)
 
 invalid_eeprom:
 	set_board_info_env_am6(name);
+	ti_set_fdt_env(name, ti_j721s2_evm_fdt_map);
 }
 
 static void setup_serial(void)
board/ti/j721s2/j721s2.env +0 -8
index 64e3d9da85f0..9a03b9f30aee 100644
@@ -7,14 +7,6 @@
 #include <env/ti/k3_rproc.env>
 #endif
 
-default_device_tree=ti/k3-j721s2-common-proc-board.dtb
-findfdt=
-	setenv name_fdt ${default_device_tree};
-	if test $board_name = j721s2; then			\
-		setenv name_fdt ti/k3-j721s2-common-proc-board.dtb; fi;
-	if test $board_name = am68-sk; then
-		setenv name_fdt ti/k3-am68-sk-base-board.dtb; fi;
-	setenv fdtfile ${name_fdt}
 name_kern=Image
 console=ttyS2,115200n8
 args_all=setenv optargs earlycon=ns16550a,mmio32,0x02880000
Signature · 1 line
2.43.0
#9 lore raw

PATCH 9/11 board: beagle: beagleboneai64: Set fdtfile from C code instead of findfdt script

In reply to Nishanth Menon

Stop using the findfdt script and switch to setting the fdtfile from C code.

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 board/beagle/beagleboneai64/beagleboneai64.c   | 14 ++++++++++++++
 board/beagle/beagleboneai64/beagleboneai64.env |  1 -
 configs/j721e_beagleboneai64_a72_defconfig     |  3 ++-
 3 files changed, 16 insertions(+), 2 deletions(-)
board/beagle/beagleboneai64/beagleboneai64.c +14 -0
index c8c1c78ae5a2..c5b4ff7df47a 100644
@@ -28,3 +28,17 @@ int dram_init_banksize(void)
 {
 	return fdtdec_setup_memory_banksize();
 }
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	char fdtfile[50];
+
+	snprintf(fdtfile, sizeof(fdtfile), "%s/%s.dtb",
+		 CONFIG_TI_FDT_FOLDER_PATH, CONFIG_DEFAULT_DEVICE_TREE);
+
+	env_set("fdtfile", fdtfile);
+
+	return 0;
+}
+#endif
board/beagle/beagleboneai64/beagleboneai64.env +0 -1
index 4f0a94a8113e..647b25d14c8e 100644
@@ -1,5 +1,4 @@
 #include <env/ti/ti_common.env>
-#include <env/ti/default_findfdt.env>
 #include <env/ti/mmc.env>
 
 name_kern=Image
configs/j721e_beagleboneai64_a72_defconfig +2 -1
index 4b019fa2f30e..3f061381f06c 100644
@@ -34,7 +34,8 @@ CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
 CONFIG_AUTOBOOT_DELAY_STR="d"
 CONFIG_AUTOBOOT_STOP_STR=" "
 CONFIG_OF_SYSTEM_SETUP=y
-CONFIG_BOOTCOMMAND="run set_led_state_start_load;run findfdt; run envboot; bootflow scan -lb;run set_led_state_fail_load"
+CONFIG_BOOTCOMMAND="run set_led_state_start_load; run envboot; bootflow scan -lb;run set_led_state_fail_load"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_LOGLEVEL=7
 CONFIG_SPL_MAX_SIZE=0xc0000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
Signature · 1 line
2.43.0
#10 lore raw

PATCH 10/11 board: beagle: beagleplay: Set fdtfile from C code instead of findfdt script

In reply to Nishanth Menon

Stop using the findfdt script and switch to setting the fdtfile from C code.

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 board/beagle/beagleplay/beagleplay.c   | 14 ++++++++++++++
 board/beagle/beagleplay/beagleplay.env |  1 -
 configs/am62x_beagleplay_a53_defconfig |  3 ++-
 3 files changed, 16 insertions(+), 2 deletions(-)
board/beagle/beagleplay/beagleplay.c +14 -0
index 1c376dea372f..20819ecf45b4 100644
@@ -27,3 +27,17 @@ int dram_init_banksize(void)
 {
 	return fdtdec_setup_memory_banksize();
 }
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	char fdtfile[50];
+
+	snprintf(fdtfile, sizeof(fdtfile), "%s/%s.dtb",
+		 CONFIG_TI_FDT_FOLDER_PATH, CONFIG_DEFAULT_DEVICE_TREE);
+
+	env_set("fdtfile", fdtfile);
+
+	return 0;
+}
+#endif
board/beagle/beagleplay/beagleplay.env +0 -1
index 4f0a94a8113e..647b25d14c8e 100644
@@ -1,5 +1,4 @@
 #include <env/ti/ti_common.env>
-#include <env/ti/default_findfdt.env>
 #include <env/ti/mmc.env>
 
 name_kern=Image
configs/am62x_beagleplay_a53_defconfig +2 -1
index 0be20045a974..1f43891d10bb 100644
@@ -33,7 +33,8 @@ CONFIG_AUTOBOOT_KEYED=y
 CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
 CONFIG_AUTOBOOT_DELAY_STR="d"
 CONFIG_AUTOBOOT_STOP_STR=" "
-CONFIG_BOOTCOMMAND="run set_led_state_start_load;run findfdt; run envboot; bootflow scan -lb;run set_led_state_fail_load"
+CONFIG_BOOTCOMMAND="run set_led_state_start_load; run envboot; bootflow scan -lb;run set_led_state_fail_load"
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80c80000
Signature · 1 line
2.43.0
#11 lore raw

PATCH 11/11 include: env: ti: Drop default_findfdt

In reply to Nishanth Menon

We shouldn't need finfdt anymore. Drop the env script.

---
Changes since V3:
* No change

V3: https://lore.kernel.org/r/[email protected]

 include/env/ti/default_findfdt.env | 12 ------------
 1 file changed, 12 deletions(-)
 delete mode 100644 include/env/ti/default_findfdt.env
include/env/ti/default_findfdt.env deleted +0 -12
deleted file mode 100644
index a2b51dd923bb..000000000000
@@ -1,12 +0,0 @@
-default_device_tree=CONFIG_DEFAULT_DEVICE_TREE
-default_device_tree_arch=ti
-#ifdef CONFIG_ARM64
-findfdt=
-	setenv name_fdt ${default_device_tree_arch}/${default_device_tree}.dtb;
-	setenv fdtfile ${name_fdt}
-#else
-default_device_tree_subarch=omap
-findfdt=
-	setenv name_fdt ${default_device_tree_arch}/${default_device_tree_subarch}/${default_device_tree}.dtb;
-	setenv fdtfile ${name_fdt}
-#endif
Signature · 1 line
2.43.0
#12 lore raw
In reply to Nishanth Menon
Quoted 10 lines · Nishanth Menon

Hopefully the last time. Apologies on the screw ups. Ran CI loop[1] to be doubly sure that I have'nt yet again fat fingered something.

This is a wide cleanup to switch to setting fdtfile using env_set instead of scripted magic. 'fdtfile' is expected to be set by default. This allows the stdboot triggered efi loaders to find the correct OS device tree file even if regular boot process is interrupted by user intervention.

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom