U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/9] Generalize PHYTEC Overlay Handling
@ 2024-07-17  5:11 Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 1/9] include: env: phytec: Create env file for loading and applying overlays Daniel Schultz
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream; +Cc: w.egorov, t.remmet, d-gole, Daniel Schultz

The overlays are specified in the bootenv.txt file that is loaded into
the environment. Then these overlays get loaded and applied via a script.
These scripts for loading and applying devicetree overlays are identical
for many phytec boards.
Create a common overlays.env that can be included.
Add support for devicetree overlays to phycore-imx8mp and include the
overlays.env for phycore-imx93.
Rename existing environment variables according to bootstd doc.
Move MMC boot logic into a common k3_mmc.env file and include the new
overlays.env file as well.

Changes v2:
  * Rebased to master and resolved a conflict in
    configs/phycore-imx8mp_defconfig.

Benjamin Hahn (5):
  include: env: phytec: Create env file for loading and applying
    overlays
  phycore-imx8mp: Add overlay and bootenv.txt support
  phycore_imx93: include common overlays.env
  board: phytec: renaming of variables according to bootstd doc
  include: env: phytec: renaming of variables according to bootstd doc

Daniel Schultz (4):
  include: env: phytec: Add common mmc boot for K3 SoMs
  include: env: phytec: k3_mmc: Apply overlays during boot
  board: phytec: phycore_am62x: Use k3_mmc.env logic
  board: phytec: phycore_am64x: Use k3_mmc.env logic

 board/phytec/phycore_am62x/phycore_am62x.env  | 11 +----
 board/phytec/phycore_am64x/phycore_am64x.env  | 12 +----
 .../phytec/phycore_imx8mp/phycore_imx8mp.env  | 27 ++++++++---
 board/phytec/phycore_imx93/phycore_imx93.env  | 45 +++++--------------
 configs/phycore-imx8mp_defconfig              |  4 +-
 include/env/phytec/k3_mmc.env                 | 21 +++++++++
 include/env/phytec/overlays.env               | 38 ++++++++++++++++
 7 files changed, 97 insertions(+), 61 deletions(-)
 create mode 100644 include/env/phytec/k3_mmc.env
 create mode 100644 include/env/phytec/overlays.env

-- 
2.25.1


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

* [PATCH v2 1/9] include: env: phytec: Create env file for loading and applying overlays
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
@ 2024-07-17  5:11 ` Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 2/9] phycore-imx8mp: Add overlay and bootenv.txt support Daniel Schultz
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream
  Cc: w.egorov, t.remmet, d-gole, Benjamin Hahn, Daniel Schultz

From: Benjamin Hahn <B.Hahn@phytec.de>

The env scripts for loading and applying overlays are identical for many
PHYTEC Boards. Create a common env that can be included.

The env variables bootenv_addr and fdto_addr are board specific and need
to be set in the board specific file. The env variable get_cmd also
needs to be set in board specific files and can be set to tftp or dhcp.

Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 include/env/phytec/overlays.env | 37 +++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 include/env/phytec/overlays.env

diff --git a/include/env/phytec/overlays.env b/include/env/phytec/overlays.env
new file mode 100644
index 00000000000..febb991f4f5
--- /dev/null
+++ b/include/env/phytec/overlays.env
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later  */
+/*
+ * Copyright (C) 2024 PHYTEC Messtechnik GmbH
+ * Author: Benjamin Hahn <b.hahn@phytec.de>
+ */
+
+/* Logic to load and apply overlays. Load overlays from bootenv.txt into
+ * environment and apply those overlays.
+ * The variables bootenv_addr and fdto_addr are board specific. */
+
+bootenv=bootenv.txt
+mmc_load_bootenv=load mmc ${mmcdev}:${mmcpart} ${bootenv_addr} ${bootenv}
+mmc_load_overlay=load mmc ${mmcdev}:${mmcpart} ${fdto_addr} ${overlay}
+mmc_apply_overlays=
+	fdt address ${fdt_addr};
+	if test ${no_overlays} = 0; then
+		for overlay in ${overlays};
+		do;
+			if run mmc_load_overlay; then
+				fdt resize ${filesize};
+				fdt apply ${fdto_addr};
+			fi;
+		done;
+	fi;
+net_load_bootenv=${get_cmd} ${bootenv_addr} ${bootenv}
+net_load_overlay=${get_cmd} ${fdto_addr} ${overlay}
+net_apply_overlays=
+	fdt address ${fdt_addr};
+	if test ${no_overlays} = 0; then
+		for overlay in ${overlays};
+		do;
+			if run net_load_overlay; then
+				fdt resize ${filesize};
+				fdt apply ${fdto_addr};
+			fi;
+		done;
+	fi;
-- 
2.25.1


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

* [PATCH v2 2/9] phycore-imx8mp: Add overlay and bootenv.txt support
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 1/9] include: env: phytec: Create env file for loading and applying overlays Daniel Schultz
@ 2024-07-17  5:11 ` Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 3/9] phycore_imx93: include common overlays.env Daniel Schultz
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream
  Cc: w.egorov, t.remmet, d-gole, Benjamin Hahn, Daniel Schultz

From: Benjamin Hahn <B.Hahn@phytec.de>

Add support for loading bootenv.txt as well as loading and applying
overlays during boot from mmc and net.

${no_bootenv}: Prevent loading external bootenv.txt environment. Use
	       ${overlays} variable directly from u-boot environment.
${no_overlay}: Do not load overlays defined in ${overlays} variable.
	       Overlays loaded over the extension command are still
	       being applied.

Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 board/phytec/phycore_imx8mp/phycore_imx8mp.env | 15 +++++++++++++++
 configs/phycore-imx8mp_defconfig               |  4 ++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/board/phytec/phycore_imx8mp/phycore_imx8mp.env b/board/phytec/phycore_imx8mp/phycore_imx8mp.env
index 7f6c5fd2c76..4ed5dc7e272 100644
--- a/board/phytec/phycore_imx8mp/phycore_imx8mp.env
+++ b/board/phytec/phycore_imx8mp/phycore_imx8mp.env
@@ -1,4 +1,5 @@
 #include <env/phytec/rauc.env>
+#include <env/phytec/overlays.env>
 
 bootcmd=
 	if test ${dofastboot} = 1; then
@@ -16,6 +17,8 @@ bootcmd=
 		fi;
 	fi;
 console=ttymxc0,115200
+bootenv_addr=0x49100000
+fdto_addr=0x49000000
 dofastboot=0
 emmc_dev=2
 fastboot_raw_partition_all=0 4194304
@@ -32,8 +35,14 @@ mmcargs=
 mmcautodetect=yes
 mmcboot=
 	echo Booting from mmc ...;
+	if test ${no_bootenv} = 0; then
+		if run mmc_load_bootenv; then
+			env import -t ${bootenv_addr} ${filesize};
+		fi;
+	fi;
 	run mmcargs;
 	if run loadfdt; then
+		run mmc_apply_overlays;
 		booti ${loadaddr} - ${fdt_addr};
 	else
 		echo WARN: Cannot load the DT;
@@ -51,9 +60,15 @@ netboot=
 	else
 		setenv get_cmd tftp;
 	fi;
+	if test ${no_bootenv} = 0; then
+		if run net_load_bootenv; then
+			env import -t ${bootenv_addr} ${filesize};
+		fi;
+	fi;
 	${get_cmd} ${loadaddr} ${image};
 	run netargs;
 	if ${get_cmd} ${fdt_addr} ${fdt_file}; then
+		run net_apply_overlays;
 		booti ${loadaddr} - ${fdt_addr};
 	else
 		echo WARN: Cannot load the DT;
diff --git a/configs/phycore-imx8mp_defconfig b/configs/phycore-imx8mp_defconfig
index 8dd4963bdc0..da7fe612ca0 100644
--- a/configs/phycore-imx8mp_defconfig
+++ b/configs/phycore-imx8mp_defconfig
@@ -13,6 +13,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="freescale/imx8mp-phyboard-pollux-rdk"
 CONFIG_SPL_TEXT_BASE=0x920000
 CONFIG_TARGET_PHYCORE_IMX8MP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
@@ -51,8 +52,6 @@ CONFIG_SPL_POWER=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="u-boot=> "
-# CONFIG_CMD_EXPORTENV is not set
-# CONFIG_CMD_IMPORTENV is not set
 # CONFIG_CMD_CRC32 is not set
 CONFIG_CMD_EEPROM=y
 CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
@@ -76,6 +75,7 @@ CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
-- 
2.25.1


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

* [PATCH v2 3/9] phycore_imx93: include common overlays.env
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 1/9] include: env: phytec: Create env file for loading and applying overlays Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 2/9] phycore-imx8mp: Add overlay and bootenv.txt support Daniel Schultz
@ 2024-07-17  5:11 ` Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 4/9] board: phytec: renaming of variables according to bootstd doc Daniel Schultz
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream
  Cc: w.egorov, t.remmet, d-gole, Benjamin Hahn, Daniel Schultz

From: Benjamin Hahn <B.Hahn@phytec.de>

Include the common overlays env file for phycore_imx93.
The common overlays env file supports disabling loading overlays by
setting the no_overlays variable.

Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 board/phytec/phycore_imx93/phycore_imx93.env | 25 ++------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/board/phytec/phycore_imx93/phycore_imx93.env b/board/phytec/phycore_imx93/phycore_imx93.env
index 27bfadfa140..09542f5aa7d 100644
--- a/board/phytec/phycore_imx93/phycore_imx93.env
+++ b/board/phytec/phycore_imx93/phycore_imx93.env
@@ -1,5 +1,7 @@
 /* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
 
+#include <env/phytec/overlays.env>
+
 image=Image
 console=ttyLP0
 fdt_addr=0x83000000
@@ -7,8 +9,6 @@ fdto_addr=0x830c0000
 bootenv_addr=0x83500000
 fdt_file=CONFIG_DEFAULT_FDT_FILE
 ip_dyn=yes
-bootenv=bootenv.txt
-mmc_load_bootenv=fatload mmc ${mmcdev}:${mmcpart} ${bootenv_addr} ${bootenv}
 mmcdev=CONFIG_SYS_MMC_ENV_DEV
 mmcpart=1
 mmcroot=2
@@ -17,16 +17,6 @@ mmcargs=setenv bootargs console=${console},${baudrate} earlycon
 	root=/dev/mmcblk${mmcdev}p${mmcroot} ${raucargs} rootwait rw
 loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
 loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
-mmc_load_overlay=fatload mmc ${mmcdev}:${mmcpart} ${fdto_addr} ${overlay}
-mmc_apply_overlays=
-	fdt address ${fdt_addr};
-	for overlay in ${overlays};
-	do;
-		if run mmc_load_overlay; then
-			fdt resize ${filesize};
-			fdt apply ${fdto_addr};
-		fi;
-	done;
 mmcboot=
 	echo Booting from mmc ...;
 	if run mmc_load_bootenv; then
@@ -42,17 +32,6 @@ mmcboot=
 nfsroot=/nfs
 netargs=setenv bootargs console=${console},${baudrate} earlycon
 	root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
-net_load_bootenv=${get_cmd} ${bootenv_addr} ${bootenv}
-net_load_overlay=${get_cmd} ${fdto_addr} ${overlay}
-net_apply_overlays=
-	fdt address ${fdt_addr};
-	for overlay in ${overlays};
-	do;
-		if run net_load_overlay; then
-			fdt resize ${filesize};
-			fdt apply ${fdto_addr};
-		fi;
-	done;
 netboot=
 	echo Booting from net ...;
 	run netargs;
-- 
2.25.1


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

* [PATCH v2 4/9] board: phytec: renaming of variables according to bootstd doc
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
                   ` (2 preceding siblings ...)
  2024-07-17  5:11 ` [PATCH v2 3/9] phycore_imx93: include common overlays.env Daniel Schultz
@ 2024-07-17  5:11 ` Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 5/9] include: env: " Daniel Schultz
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream
  Cc: w.egorov, t.remmet, d-gole, Benjamin Hahn, Daniel Schultz

From: Benjamin Hahn <B.Hahn@phytec.de>

Rename existing environment variables according to the bootstd doc.
Renamed variables are fdto_addr, bootenv_addr, fdt_addr and
fdt_file.

Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 .../phytec/phycore_imx8mp/phycore_imx8mp.env  | 20 +++++++++----------
 board/phytec/phycore_imx93/phycore_imx93.env  | 20 +++++++++----------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/board/phytec/phycore_imx8mp/phycore_imx8mp.env b/board/phytec/phycore_imx8mp/phycore_imx8mp.env
index 4ed5dc7e272..f8f878e8f3a 100644
--- a/board/phytec/phycore_imx8mp/phycore_imx8mp.env
+++ b/board/phytec/phycore_imx8mp/phycore_imx8mp.env
@@ -17,17 +17,17 @@ bootcmd=
 		fi;
 	fi;
 console=ttymxc0,115200
-bootenv_addr=0x49100000
-fdto_addr=0x49000000
+bootenv_addr_r=0x49100000
+fdtoverlay_addr_r=0x49000000
 dofastboot=0
 emmc_dev=2
 fastboot_raw_partition_all=0 4194304
 fastboot_raw_partition_bootloader=64 8128
-fdt_addr=0x48000000
-fdt_file=CONFIG_DEFAULT_FDT_FILE
+fdt_addr_r=0x48000000
+fdtfile=CONFIG_DEFAULT_FDT_FILE
 image=Image
 ip_dyn=yes
-loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
+loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
 loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
 mmcargs=
 	setenv bootargs console=${console}
@@ -37,13 +37,13 @@ mmcboot=
 	echo Booting from mmc ...;
 	if test ${no_bootenv} = 0; then
 		if run mmc_load_bootenv; then
-			env import -t ${bootenv_addr} ${filesize};
+			env import -t ${bootenv_addr_r} ${filesize};
 		fi;
 	fi;
 	run mmcargs;
 	if run loadfdt; then
 		run mmc_apply_overlays;
-		booti ${loadaddr} - ${fdt_addr};
+		booti ${loadaddr} - ${fdt_addr_r};
 	else
 		echo WARN: Cannot load the DT;
 	fi;
@@ -62,14 +62,14 @@ netboot=
 	fi;
 	if test ${no_bootenv} = 0; then
 		if run net_load_bootenv; then
-			env import -t ${bootenv_addr} ${filesize};
+			env import -t ${bootenv_addr_r} ${filesize};
 		fi;
 	fi;
 	${get_cmd} ${loadaddr} ${image};
 	run netargs;
-	if ${get_cmd} ${fdt_addr} ${fdt_file}; then
+	if ${get_cmd} ${fdt_addr_r} ${fdtfile}; then
 		run net_apply_overlays;
-		booti ${loadaddr} - ${fdt_addr};
+		booti ${loadaddr} - ${fdt_addr_r};
 	else
 		echo WARN: Cannot load the DT;
 	fi;
diff --git a/board/phytec/phycore_imx93/phycore_imx93.env b/board/phytec/phycore_imx93/phycore_imx93.env
index 09542f5aa7d..ab65cfce5fd 100644
--- a/board/phytec/phycore_imx93/phycore_imx93.env
+++ b/board/phytec/phycore_imx93/phycore_imx93.env
@@ -4,10 +4,10 @@
 
 image=Image
 console=ttyLP0
-fdt_addr=0x83000000
-fdto_addr=0x830c0000
-bootenv_addr=0x83500000
-fdt_file=CONFIG_DEFAULT_FDT_FILE
+fdt_addr_r=0x83000000
+fdtoverlay_addr_r=0x830c0000
+bootenv_addr_r=0x83500000
+fdtfile=CONFIG_DEFAULT_FDT_FILE
 ip_dyn=yes
 mmcdev=CONFIG_SYS_MMC_ENV_DEV
 mmcpart=1
@@ -16,16 +16,16 @@ mmcautodetect=yes
 mmcargs=setenv bootargs console=${console},${baudrate} earlycon
 	root=/dev/mmcblk${mmcdev}p${mmcroot} ${raucargs} rootwait rw
 loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
-loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
+loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
 mmcboot=
 	echo Booting from mmc ...;
 	if run mmc_load_bootenv; then
-		env import -t ${bootenv_addr} ${filesize};
+		env import -t ${bootenv_addr_r} ${filesize};
 	fi;
 	run mmcargs;
 	if run loadfdt; then
 		run mmc_apply_overlays;
-		booti ${loadaddr} - ${fdt_addr};
+		booti ${loadaddr} - ${fdt_addr_r};
 	else
 		echo WARN: Cannot load the DT;
 	fi;
@@ -41,12 +41,12 @@ netboot=
 		setenv get_cmd tftp;
 	fi;
 	if run net_load_bootenv; then
-		env import -t ${bootenv_addr} ${filesize};
+		env import -t ${bootenv_addr_r} ${filesize};
 	fi;
 	${get_cmd} ${loadaddr} ${image};
-	if ${get_cmd} ${fdt_addr} ${fdt_file}; then
+	if ${get_cmd} ${fdt_addr_r} ${fdtfile}; then
 		run net_apply_overlays;
-		booti ${loadaddr} - ${fdt_addr};
+		booti ${loadaddr} - ${fdt_addr_r};
 	else
 		echo WARN: Cannot load the DT;
 	fi;
-- 
2.25.1


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

* [PATCH v2 5/9] include: env: phytec: renaming of variables according to bootstd doc
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
                   ` (3 preceding siblings ...)
  2024-07-17  5:11 ` [PATCH v2 4/9] board: phytec: renaming of variables according to bootstd doc Daniel Schultz
@ 2024-07-17  5:11 ` Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 6/9] include: env: phytec: Add common mmc boot for K3 SoMs Daniel Schultz
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream
  Cc: w.egorov, t.remmet, d-gole, Benjamin Hahn, Daniel Schultz

From: Benjamin Hahn <B.Hahn@phytec.de>

Rename existing environment variables according to the bootstd doc.
Renamed variables are fdto_addr, bootenv_addr, fdt_addr.

Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 include/env/phytec/overlays.env | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/env/phytec/overlays.env b/include/env/phytec/overlays.env
index febb991f4f5..78721cde654 100644
--- a/include/env/phytec/overlays.env
+++ b/include/env/phytec/overlays.env
@@ -6,32 +6,33 @@
 
 /* Logic to load and apply overlays. Load overlays from bootenv.txt into
  * environment and apply those overlays.
- * The variables bootenv_addr and fdto_addr are board specific. */
+ * The variables bootenv_addr_r and fdtoverlay_addr_r are board specific.
+ * get_cmd can be either tftp or dhcp. */
 
 bootenv=bootenv.txt
-mmc_load_bootenv=load mmc ${mmcdev}:${mmcpart} ${bootenv_addr} ${bootenv}
-mmc_load_overlay=load mmc ${mmcdev}:${mmcpart} ${fdto_addr} ${overlay}
+mmc_load_bootenv=load mmc ${mmcdev}:${mmcpart} ${bootenv_addr_r} ${bootenv}
+mmc_load_overlay=load mmc ${mmcdev}:${mmcpart} ${fdtoverlay_addr_r} ${overlay}
 mmc_apply_overlays=
-	fdt address ${fdt_addr};
+	fdt address ${fdt_addr_r};
 	if test ${no_overlays} = 0; then
 		for overlay in ${overlays};
 		do;
 			if run mmc_load_overlay; then
 				fdt resize ${filesize};
-				fdt apply ${fdto_addr};
+				fdt apply ${fdtoverlay_addr_r};
 			fi;
 		done;
 	fi;
-net_load_bootenv=${get_cmd} ${bootenv_addr} ${bootenv}
-net_load_overlay=${get_cmd} ${fdto_addr} ${overlay}
+net_load_bootenv=${get_cmd} ${bootenv_addr_r} ${bootenv}
+net_load_overlay=${get_cmd} ${fdtoverlay_addr_r} ${overlay}
 net_apply_overlays=
-	fdt address ${fdt_addr};
+	fdt address ${fdt_addr_r};
 	if test ${no_overlays} = 0; then
 		for overlay in ${overlays};
 		do;
 			if run net_load_overlay; then
 				fdt resize ${filesize};
-				fdt apply ${fdto_addr};
+				fdt apply ${fdtoverlay_addr_r};
 			fi;
 		done;
 	fi;
-- 
2.25.1


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

* [PATCH v2 6/9] include: env: phytec: Add common mmc boot for K3 SoMs
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
                   ` (4 preceding siblings ...)
  2024-07-17  5:11 ` [PATCH v2 5/9] include: env: " Daniel Schultz
@ 2024-07-17  5:11 ` Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 7/9] include: env: phytec: k3_mmc: Apply overlays during boot Daniel Schultz
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream; +Cc: w.egorov, t.remmet, d-gole, Daniel Schultz

This environment include can be used to boot from a
MMC device for PHYTEC's K3-based SoMs.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 include/env/phytec/k3_mmc.env | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 include/env/phytec/k3_mmc.env

diff --git a/include/env/phytec/k3_mmc.env b/include/env/phytec/k3_mmc.env
new file mode 100644
index 00000000000..e1208a6eea1
--- /dev/null
+++ b/include/env/phytec/k3_mmc.env
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2024 PHYTEC Messtechnik GmbH
+ * Author: Daniel Schultz <d.schultz@phytec.de>
+ */
+
+/* Logic for TI K3 based SoCs to boot from a MMC device. */
+
+mmcargs=setenv bootargs console=${console} earlycon=${earlycon}
+	root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw
+loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} Image
+loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
+mmcboot=run mmcargs;
+	mmc dev ${mmcdev};
+	mmc rescan;
+	run loadimage;
+	run loadfdt;
+	booti ${loadaddr} - ${fdt_addr_r}
-- 
2.25.1


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

* [PATCH v2 7/9] include: env: phytec: k3_mmc: Apply overlays during boot
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
                   ` (5 preceding siblings ...)
  2024-07-17  5:11 ` [PATCH v2 6/9] include: env: phytec: Add common mmc boot for K3 SoMs Daniel Schultz
@ 2024-07-17  5:11 ` Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 8/9] board: phytec: phycore_am62x: Use k3_mmc.env logic Daniel Schultz
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream; +Cc: w.egorov, t.remmet, d-gole, Daniel Schultz

Include the overlays.env file and run the apply routine before
booting the Kernel.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 include/env/phytec/k3_mmc.env | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/env/phytec/k3_mmc.env b/include/env/phytec/k3_mmc.env
index e1208a6eea1..3d3595ceb7e 100644
--- a/include/env/phytec/k3_mmc.env
+++ b/include/env/phytec/k3_mmc.env
@@ -6,6 +6,8 @@
 
 /* Logic for TI K3 based SoCs to boot from a MMC device. */
 
+#include <env/phytec/overlays.env>
+
 mmcargs=setenv bootargs console=${console} earlycon=${earlycon}
 	root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw
 loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} Image
@@ -15,4 +17,5 @@ mmcboot=run mmcargs;
 	mmc rescan;
 	run loadimage;
 	run loadfdt;
+	run mmc_apply_overlays;
 	booti ${loadaddr} - ${fdt_addr_r}
-- 
2.25.1


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

* [PATCH v2 8/9] board: phytec: phycore_am62x: Use k3_mmc.env logic
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
                   ` (6 preceding siblings ...)
  2024-07-17  5:11 ` [PATCH v2 7/9] include: env: phytec: k3_mmc: Apply overlays during boot Daniel Schultz
@ 2024-07-17  5:11 ` Daniel Schultz
  2024-07-17  5:11 ` [PATCH v2 9/9] board: phytec: phycore_am64x: " Daniel Schultz
  2024-07-23 21:04 ` [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Tom Rini
  9 siblings, 0 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream; +Cc: w.egorov, t.remmet, d-gole, Daniel Schultz

Use our common environment file to implement MMC boot.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 board/phytec/phycore_am62x/phycore_am62x.env | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/board/phytec/phycore_am62x/phycore_am62x.env b/board/phytec/phycore_am62x/phycore_am62x.env
index 2d6475d408f..046bbd22f25 100644
--- a/board/phytec/phycore_am62x/phycore_am62x.env
+++ b/board/phytec/phycore_am62x/phycore_am62x.env
@@ -1,4 +1,5 @@
 #include <env/ti/k3_dfu.env>
+#include <env/phytec/k3_mmc.env>
 
 fdtaddr=0x88000000
 loadaddr=0x82000000
@@ -14,13 +15,3 @@ mmcroot=2
 mmcpart=1
 console=ttyS2,115200n8
 earlycon=ns16550a,mmio32,0x02800000
-mmcargs=setenv bootargs console=${console} earlycon=${earlycon}
-	root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw
-loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} Image
-loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdtaddr} ${fdtfile}
-mmcboot=run mmcargs;
-	mmc dev ${mmcdev};
-	mmc rescan;
-	run loadimage;
-	run loadfdt;
-	booti ${loadaddr} - ${fdtaddr}
-- 
2.25.1


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

* [PATCH v2 9/9] board: phytec: phycore_am64x: Use k3_mmc.env logic
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
                   ` (7 preceding siblings ...)
  2024-07-17  5:11 ` [PATCH v2 8/9] board: phytec: phycore_am62x: Use k3_mmc.env logic Daniel Schultz
@ 2024-07-17  5:11 ` Daniel Schultz
  2024-07-23 21:04 ` [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Tom Rini
  9 siblings, 0 replies; 11+ messages in thread
From: Daniel Schultz @ 2024-07-17  5:11 UTC (permalink / raw)
  To: u-boot, trini, upstream; +Cc: w.egorov, t.remmet, d-gole, Daniel Schultz

Use our common environment file to implement MMC boot.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 board/phytec/phycore_am64x/phycore_am64x.env | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/board/phytec/phycore_am64x/phycore_am64x.env b/board/phytec/phycore_am64x/phycore_am64x.env
index e24a958f51d..18f0fa5b4c3 100644
--- a/board/phytec/phycore_am64x/phycore_am64x.env
+++ b/board/phytec/phycore_am64x/phycore_am64x.env
@@ -1,3 +1,5 @@
+#include <env/phytec/k3_mmc.env>
+
 fdtaddr=0x88000000
 loadaddr=0x82000000
 scriptaddr=0x80000000
@@ -12,13 +14,3 @@ mmcroot=2
 mmcpart=1
 console=ttyS2,115200n8
 earlycon=ns16550a,mmio32,0x02800000
-mmcargs=setenv bootargs console=${console} earlycon=${earlycon}
-	root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw
-loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} Image
-loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdtaddr} ${fdtfile}
-mmcboot=run mmcargs;
-	mmc dev ${mmcdev};
-	mmc rescan;
-	run loadimage;
-	run loadfdt;
-	booti ${loadaddr} - ${fdtaddr}
-- 
2.25.1


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

* Re: [PATCH v2 0/9] Generalize PHYTEC Overlay Handling
  2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
                   ` (8 preceding siblings ...)
  2024-07-17  5:11 ` [PATCH v2 9/9] board: phytec: phycore_am64x: " Daniel Schultz
@ 2024-07-23 21:04 ` Tom Rini
  9 siblings, 0 replies; 11+ messages in thread
From: Tom Rini @ 2024-07-23 21:04 UTC (permalink / raw)
  To: u-boot, upstream, Daniel Schultz; +Cc: w.egorov, t.remmet, d-gole

On Tue, 16 Jul 2024 22:11:25 -0700, Daniel Schultz wrote:

> The overlays are specified in the bootenv.txt file that is loaded into
> the environment. Then these overlays get loaded and applied via a script.
> These scripts for loading and applying devicetree overlays are identical
> for many phytec boards.
> Create a common overlays.env that can be included.
> Add support for devicetree overlays to phycore-imx8mp and include the
> overlays.env for phycore-imx93.
> Rename existing environment variables according to bootstd doc.
> Move MMC boot logic into a common k3_mmc.env file and include the new
> overlays.env file as well.
> 
> [...]

Applied to u-boot/master, thanks!

-- 
Tom



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

end of thread, other threads:[~2024-07-23 21:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 1/9] include: env: phytec: Create env file for loading and applying overlays Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 2/9] phycore-imx8mp: Add overlay and bootenv.txt support Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 3/9] phycore_imx93: include common overlays.env Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 4/9] board: phytec: renaming of variables according to bootstd doc Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 5/9] include: env: " Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 6/9] include: env: phytec: Add common mmc boot for K3 SoMs Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 7/9] include: env: phytec: k3_mmc: Apply overlays during boot Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 8/9] board: phytec: phycore_am62x: Use k3_mmc.env logic Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 9/9] board: phytec: phycore_am64x: " Daniel Schultz
2024-07-23 21:04 ` [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox