public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Stefano Babic <sbabic@denx.de>,
	Fabio Estevam <festevam@gmail.com>,
	 "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
Cc: u-boot@lists.denx.de, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 07/12] imx: imx8mn_evk: Switch to BOOTSTD
Date: Sat, 04 Jan 2025 12:25:41 +0800	[thread overview]
Message-ID: <20250104-imx-bootstd-v1-7-e09618cc1d65@nxp.com> (raw)
In-Reply-To: <20250104-imx-bootstd-v1-0-e09618cc1d65@nxp.com>

From: Peng Fan <peng.fan@nxp.com>

Move env to imx8mn_evk.env
Switch to support BOOTSTD with a bsp bootcmd as fallback.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 board/freescale/imx8mn_evk/imx8mn_evk.env | 67 +++++++++++++++++++++++++++++++
 configs/imx8mn_evk_defconfig              |  3 +-
 include/configs/imx8mn_evk.h              | 30 --------------
 3 files changed, 69 insertions(+), 31 deletions(-)

diff --git a/board/freescale/imx8mn_evk/imx8mn_evk.env b/board/freescale/imx8mn_evk/imx8mn_evk.env
new file mode 100644
index 0000000000000000000000000000000000000000..16a6543ffc692f5ddce5baf1ced11889c444f3b1
--- /dev/null
+++ b/board/freescale/imx8mn_evk/imx8mn_evk.env
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
+
+boot_fdt=try
+boot_fit=no
+boot_targets=mmc1 mmc2 dhcp
+bootm_size=0x10000000
+console=ttymxc1,115200
+fdt_addr_r=0x48000000
+fdtfile=CONFIG_DEFAULT_FDT_FILE
+fdtoverlay_addr_r=0x49000000
+initrd_addr=0x48080000
+image=Image
+ip_dyn=yes
+kernel_addr_r=0x42000000
+loadaddr=CONFIG_SYS_LOAD_ADDR
+mmcautodetect=yes
+mmcdev=CONFIG_SYS_MMC_ENV_DEV
+mmcpart=1
+mmcroot=/dev/mmcblk1p2 rootwait rw
+prepare_mcore=setenv mcore_clk clk-imx8mn.mcore_booted;
+pxefile_addr_r=0x40100000
+ramdisk_addr_r=0x48080000
+scriptaddr=0x40000000
+
+mmcargs=setenv bootargs ${jh_clk} ${mcore_clk} console=${console} root=${mmcroot}
+prepare_mcore=setenv mcore_clk clk-imx8mn.mcore_booted
+loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
+loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
+mmcboot=echo Booting from mmc ...;
+	run mmcargs;
+	if test ${boot_fit} = yes || test ${boot_fit} = try; then
+		bootm ${loadaddr};
+	else
+		if run loadfdt; then
+			booti ${loadaddr} - ${fdt_addr_r};
+		else
+			echo WARN: Cannot load the DT;
+		fi;
+	fi
+netargs=setenv bootargs ${jh_clk} ${mcore_clk} console=${console} root=/dev/nfs
+	ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
+netboot=echo Booting from net ...;
+	run netargs;
+	if test ${ip_dyn} = yes; then
+		setenv get_cmd dhcp;
+	else
+		setenv get_cmd tftp;
+	fi;
+	${get_cmd} ${loadaddr} ${image};
+	if test ${boot_fit} = yes || test ${boot_fit} = try; then
+		bootm ${loadaddr};
+	else
+		if ${get_cmd} ${fdt_addr_r} ${fdtfile}; then
+			booti ${loadaddr} - ${fdt_addr_r};
+		else
+			echo WARN: Cannot load the DT;
+		fi;
+	fi;
+bsp_bootcmd=echo Running BSP bootcmd ...;
+	mmc dev ${mmcdev};
+	if mmc rescan; then
+		if run loadimage; then
+			run mmcboot;
+		else
+			run netboot;
+		fi;
+	fi;
diff --git a/configs/imx8mn_evk_defconfig b/configs/imx8mn_evk_defconfig
index 43860fe3f56f9a178bbf83dbedb6a2ca0bba19fe..b112c30b8242aab890b5861b67a9c8a01ddbc460 100644
--- a/configs/imx8mn_evk_defconfig
+++ b/configs/imx8mn_evk_defconfig
@@ -5,6 +5,7 @@ CONFIG_SYS_MALLOC_LEN=0x2000000
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_ENV_SOURCE_FILE="imx8mn_evk"
 CONFIG_ENV_SIZE=0x1000
 CONFIG_ENV_OFFSET=0x400000
 CONFIG_DM_GPIO=y
@@ -26,8 +27,8 @@ CONFIG_SPL_IMX_ROMAPI_LOADADDR=0x48000000
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_BOOTCOMMAND="bootflow scan -lb; run bsp_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="imx8mn-evk.dtb"
 CONFIG_SYS_CBSIZE=2048
 CONFIG_SYS_PBSIZE=2074
diff --git a/include/configs/imx8mn_evk.h b/include/configs/imx8mn_evk.h
index ca02e26c26e42f7606be4e17f77ccf25bdcf9bd1..9972dc17812b7da4f2996f96a618cf8abc871288 100644
--- a/include/configs/imx8mn_evk.h
+++ b/include/configs/imx8mn_evk.h
@@ -13,36 +13,6 @@
 #define CFG_SYS_UBOOT_BASE	\
 	(QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
 
-#define BOOT_TARGET_DEVICES(func) \
-	func(MMC, mmc, 1) \
-	func(MMC, mmc, 2) \
-	func(DHCP, dhcp, na)
-
-#include <config_distro_bootcmd.h>
-
-/* Initial environment variables */
-/* see include/configs/ti_armv7_common.h */
-#define ENV_MEM_LAYOUT_SETTINGS \
-	"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
-	"kernel_addr_r=0x42000000\0" \
-	"fdt_addr_r=0x48000000\0" \
-	"fdtoverlay_addr_r=0x49000000\0" \
-	"ramdisk_addr_r=0x48080000\0" \
-	"initrd_addr=0x48080000\0" \
-	"scriptaddr=0x40000000\0" \
-	"pxefile_addr_r=0x40100000\0"
-
-#define CFG_EXTRA_ENV_SETTINGS		\
-	"image=Image\0" \
-	BOOTENV \
-	"console=ttymxc1,115200\0" \
-	"boot_fit=no\0" \
-	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
-	"bootm_size=0x10000000\0" \
-	"mmcpart=1\0" \
-	"mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
-	ENV_MEM_LAYOUT_SETTINGS
-
 /* Link Definitions */
 
 #define CFG_SYS_INIT_RAM_ADDR        0x40000000

-- 
2.35.3


  parent reply	other threads:[~2025-01-04  3:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-04  4:25 [PATCH 00/12] imx9: switch to bootstd for i.MX93/1 EVK/QSB and i.MX8M EVK Peng Fan (OSS)
2025-01-04  4:25 ` [PATCH 01/12] imx: imx93_evk: switch to BOOTSTD Peng Fan (OSS)
2025-01-06 11:06   ` Fabio Estevam
2025-01-04  4:25 ` [PATCH 02/12] imx: imx93_qsb: " Peng Fan (OSS)
2025-01-04  4:25 ` [PATCH 03/12] imx: imx91_evk: " Peng Fan (OSS)
2025-01-04  4:25 ` [PATCH 04/12] imx: imx8mp_evk: Enable dynamic settings to mmcdev and mmcroot Peng Fan (OSS)
2025-01-04  4:25 ` [PATCH 05/12] imx: imx8mp_evk: Switch to BOOTSTD Peng Fan (OSS)
2025-01-04  4:25 ` [PATCH 06/12] imx: imx8mn_evk: Enable dynamic settings to mmcdev and mmcroot Peng Fan (OSS)
2025-01-06 11:09   ` Fabio Estevam
2025-01-04  4:25 ` Peng Fan (OSS) [this message]
2025-01-04  4:25 ` [PATCH 08/12] imx: imx8mm_evk: " Peng Fan (OSS)
2025-01-04  4:25 ` [PATCH 09/12] imx: imx8mm_evk: Switch to BOOTSTD Peng Fan (OSS)
2025-01-04  4:25 ` [PATCH 10/12] imx: imx8mq_evk: Enable dynamic settings to mmcdev and mmcroot Peng Fan (OSS)
2025-01-06 11:11   ` Fabio Estevam
2025-01-04  4:25 ` [PATCH 11/12] imx: imx8mq_evk: Switch to BOOTSTD Peng Fan (OSS)
2025-01-04  4:25 ` [PATCH 12/12] imx: imx93-11x11-evk: drop duplicated nodes Peng Fan (OSS)
2025-01-04 19:30 ` [PATCH 00/12] imx9: switch to bootstd for i.MX93/1 EVK/QSB and i.MX8M EVK Simon Glass
2025-01-06  1:33   ` Peng Fan
2025-01-06  1:02     ` Simon Glass
2025-01-06  1:14       ` Peng Fan
2025-01-06 12:15         ` Simon Glass
2025-01-06 23:45           ` Tony Dinh
2025-01-13  9:48             ` Frieder Schrempf
2025-01-14 13:13               ` Simon Glass
2025-01-07  1:39           ` Peng Fan
2025-01-08 16:27             ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250104-imx-bootstd-v1-7-e09618cc1d65@nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=festevam@gmail.com \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox