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 v3 15/17] imx: imx8mq_evk: Switch to BOOTSTD
Date: Thu, 09 Jan 2025 11:29:16 +0800	[thread overview]
Message-ID: <20250109-imx-bootstd-v3-15-16e5fc0baecf@nxp.com> (raw)
In-Reply-To: <20250109-imx-bootstd-v3-0-16e5fc0baecf@nxp.com>

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

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

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/mach-imx/imx8m/Kconfig           |  2 ++
 board/freescale/imx8mq_evk/imx8mq_evk.env | 60 +++++++++++++++++++++++++++++++
 configs/imx8mq_evk_defconfig              |  3 +-
 include/configs/imx8mq_evk.h              | 22 ------------
 4 files changed, 64 insertions(+), 23 deletions(-)

diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index 28be6a22bf07e1341ec841bace149cdbb871fac0..76a8be7798c5d80a0384b1f28b1f18eff7b34e43 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -54,6 +54,8 @@ config TARGET_IMX8MQ_EVK
 	select ARCH_MISC_INIT
 	select SPL_CRYPTO if SPL
 	imply OF_UPSTREAM
+	imply BOOTSTD_FULL
+	imply BOOTSTD_BOOTCOMMAND
 
 config TARGET_IMX8MQ_PHANBELL
 	bool "imx8mq_phanbell"
diff --git a/board/freescale/imx8mq_evk/imx8mq_evk.env b/board/freescale/imx8mq_evk/imx8mq_evk.env
new file mode 100644
index 0000000000000000000000000000000000000000..dcfe1c2f2d4118e5af01078e2e4402f60c2b7f6a
--- /dev/null
+++ b/board/freescale/imx8mq_evk/imx8mq_evk.env
@@ -0,0 +1,60 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
+
+boot_fdt=try
+boot_targets=mmc1 mmc2 dhcp
+bootm_size=0x10000000
+console=ttymxc0,115200
+fdt_addr_r=0x43000000
+fdtfile=CONFIG_DEFAULT_FDT_FILE
+initrd_addr=0x43800000
+image=Image
+ip_dyn=yes
+kernel_addr_r=CONFIG_SYS_LOAD_ADDR
+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-imx8mq.mcore_booted;
+scriptaddr=CONFIG_SYS_LOAD_ADDR
+
+mmcargs=setenv bootargs ${jh_clk} ${mcore_clk} console=${console} root=${mmcroot}
+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_fdt} = yes || test ${boot_fdt} = try; then
+		if run loadfdt; then
+			booti ${loadaddr} - ${fdt_addr_r};
+		else
+			echo WARN: Cannot load the DT;
+		fi;
+	else
+		echo wait for boot;
+	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_fdt} = yes || test ${boot_fit} = try; then
+		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/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
index a3a2333c98268d17942cd76c654bad63406099a8..97ef352dfb866830b228e3e4ae77d78afe01ea8b 100644
--- a/configs/imx8mq_evk_defconfig
+++ b/configs/imx8mq_evk_defconfig
@@ -30,8 +30,9 @@ CONFIG_REMAKE_ELF=y
 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="imx8mp-evk.dtb"
 CONFIG_SYS_PBSIZE=1050
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_LATE_INIT=y
diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
index 666f46ac105be6a7828bf54c388afad14ee1d1cf..2a86240e2c6dbf3e86e626a2b4a2c1311c68e8a0 100644
--- a/include/configs/imx8mq_evk.h
+++ b/include/configs/imx8mq_evk.h
@@ -26,28 +26,6 @@
 #define CFG_FEC_MXC_PHYADDR          0
 #endif
 
-#define BOOT_TARGET_DEVICES(func) \
-       func(MMC, mmc, 0) \
-       func(MMC, mmc, 1) \
-       func(DHCP, dhcp, na)
-
-#include <config_distro_bootcmd.h>
-
-/* Initial environment variables */
-#define CFG_EXTRA_ENV_SETTINGS		\
-	BOOTENV \
-	"scriptaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
-	"kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
-	"image=Image\0" \
-	"console=ttymxc0,115200\0" \
-	"fdt_addr_r=0x43000000\0"			\
-	"boot_fdt=try\0" \
-	"fdtfile=imx8mq-evk.dtb\0" \
-	"initrd_addr=0x43800000\0"		\
-	"bootm_size=0x10000000\0" \
-	"mmcpart=1\0" \
-	"mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
-
 /* Link Definitions */
 
 #define CFG_SYS_INIT_RAM_ADDR        0x40000000

-- 
2.35.3


  parent reply	other threads:[~2025-01-09  2:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09  3:29 [PATCH v3 00/17] imx9: switch to bootstd for i.MX93/1 EVK/QSB and i.MX8M EVK Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 01/17] imx: imx93_evk: switch to BOOTSTD Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 02/17] imx: imx93_qsb: " Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 03/17] imx: imx91_evk: " Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 04/17] imx: imx8mp_evk: Enable dynamic settings to mmcdev and mmcroot Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 05/17] imx: imx8mp_evk: Switch to BOOTSTD Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 06/17] imx: imx8mn_evk: Cleanup headers Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 07/17] imx: imx8mn_evk: Drop DECLARE_GLOBAL_DATA_PTR Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 08/17] imx: imx8mn_evk: Enable dynamic settings to mmcdev and mmcroot Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 09/17] imx: imx8mn_evk: Switch to BOOTSTD Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 10/17] imx: imx8mm_evk: Enable dynamic settings to mmcdev and mmcroot Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 11/17] imx: imx8mm_evk: Switch to BOOTSTD Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 12/17] imx: imx8mq_evk: Cleanup headers Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 13/17] imx: imx8mq_evk: Drop DECLARE_GLOBAL_DATA_PTR Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 14/17] imx: imx8mq_evk: Enable dynamic settings to mmcdev and mmcroot Peng Fan (OSS)
2025-01-09  3:29 ` Peng Fan (OSS) [this message]
2025-01-09  3:29 ` [PATCH v3 16/17] imx: imx93-11x11-evk: drop duplicated nodes Peng Fan (OSS)
2025-01-09  3:29 ` [PATCH v3 17/17] gpio: adp5585: Update compatible string Peng Fan (OSS)
2025-01-16 14:40 ` [PATCH v3 00/17] imx9: switch to bootstd for i.MX93/1 EVK/QSB and i.MX8M EVK Fabio Estevam

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=20250109-imx-bootstd-v3-15-16e5fc0baecf@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