All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@openedev.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 13/15] i.MX6Q: icorem6_rqs: Add modeboot env via board_late_init
Date: Fri, 24 Feb 2017 15:45:24 +0530	[thread overview]
Message-ID: <1487931326-10199-14-git-send-email-jagan@openedev.com> (raw)
In-Reply-To: <1487931326-10199-1-git-send-email-jagan@openedev.com>

From: Jagan Teki <jagan@amarulasolutions.com>

Add runtime, modeboot env which is setting mmcboot based
on the bootdevice so-that conditional macros for MMC via
CONFIG_BOOTCOMMAND should be avoided in config files.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Matteo Lisi <matteo.lisi@engicam.com>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 board/engicam/icorem6_rqs/icorem6_rqs.c | 18 ++++++++++++++++++
 configs/imx6dl_icore_rqs_mmc_defconfig  |  1 +
 configs/imx6q_icore_rqs_mmc_defconfig   |  1 +
 include/configs/imx6qdl_icore_rqs.h     | 32 ++++++++++++++++----------------
 4 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/board/engicam/icorem6_rqs/icorem6_rqs.c b/board/engicam/icorem6_rqs/icorem6_rqs.c
index 175bda5..cc7f897 100644
--- a/board/engicam/icorem6_rqs/icorem6_rqs.c
+++ b/board/engicam/icorem6_rqs/icorem6_rqs.c
@@ -45,6 +45,24 @@ int board_init(void)
 	return 0;
 }
 
+int board_late_init(void)
+{
+	switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
+			IMX6_BMODE_SHIFT) {
+	case IMX6_BMODE_SD:
+	case IMX6_BMODE_ESD:
+	case IMX6_BMODE_MMC:
+	case IMX6_BMODE_EMMC:
+		setenv("modeboot", "mmcboot");
+		break;
+	default:
+		setenv("modeboot", "");
+		break;
+	}
+
+	return 0;
+}
+
 int dram_init(void)
 {
 	gd->ram_size = imx_ddr_size();
diff --git a/configs/imx6dl_icore_rqs_mmc_defconfig b/configs/imx6dl_icore_rqs_mmc_defconfig
index 3b10e99..b15fcb2 100644
--- a/configs/imx6dl_icore_rqs_mmc_defconfig
+++ b/configs/imx6dl_icore_rqs_mmc_defconfig
@@ -38,3 +38,4 @@ CONFIG_FEC_MXC=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
+CONFIG_BOARD_LATE_INIT=y
diff --git a/configs/imx6q_icore_rqs_mmc_defconfig b/configs/imx6q_icore_rqs_mmc_defconfig
index 8df4ef0..987fdf7 100644
--- a/configs/imx6q_icore_rqs_mmc_defconfig
+++ b/configs/imx6q_icore_rqs_mmc_defconfig
@@ -38,3 +38,4 @@ CONFIG_FEC_MXC=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
+CONFIG_BOARD_LATE_INIT=y
diff --git a/include/configs/imx6qdl_icore_rqs.h b/include/configs/imx6qdl_icore_rqs.h
index cd94c5f..c62c1d4 100644
--- a/include/configs/imx6qdl_icore_rqs.h
+++ b/include/configs/imx6qdl_icore_rqs.h
@@ -56,8 +56,7 @@
 	"fitboot=echo Booting FIT image from mmc ...; " \
 		"run mmcargs; " \
 		"bootm ${loadaddr}\0" \
-	"mmcboot=echo Booting from mmc ...; " \
-		"run mmcargs; " \
+	"_mmcboot=run mmcargs; " \
 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
 			"if run loadfdt; then " \
 				"bootm ${loadaddr} - ${fdt_addr}; " \
@@ -70,23 +69,24 @@
 			"fi; " \
 		"else " \
 			"bootm; " \
-		"fi\0"
-
-#define CONFIG_BOOTCOMMAND \
-	"mmc dev ${mmcdev};" \
-	"if mmc rescan; then " \
-		"if run loadbootscript; then " \
-			"run bootscript; " \
-		"else " \
-			"if run loadfit; then " \
-				"run fitboot; " \
+		"fi\0" \
+	"mmcboot=echo Booting from mmc ...; " \
+		"mmc dev ${mmcdev};" \
+		"if mmc rescan; then " \
+			"if run loadbootscript; then " \
+				"run bootscript; " \
 			"else " \
-				"if run loadimage; then " \
-					"run mmcboot; " \
+				"if run loadfit; then " \
+					"run fitboot; " \
+				"else " \
+					"if run loadimage; then " \
+						"run _mmcboot; " \
+					"fi; " \
 				"fi; " \
 			"fi; " \
-		"fi; " \
-	"fi"
+		"fi\0"
+
+#define CONFIG_BOOTCOMMAND		"run $modeboot"
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_MEMTEST_START	0x80000000
-- 
1.9.1

  parent reply	other threads:[~2017-02-24 10:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24 10:15 [U-Boot] [PATCH v4 00/15] i.MX6: Engicam i.CoreM6/Is.IoT eMMC boot support Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 01/15] imx6: Add imx6_src_get_boot_mode Jagan Teki
2017-02-26 11:31   ` Stefano Babic
2017-02-24 10:15 ` [U-Boot] [PATCH v4 02/15] imx: spl: Update NAND bootmode detection bit Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 03/15] imx: Use IMX6_BMODE_* macros instead of numericals Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 04/15] imx6: Add src_base structure define macro Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 05/15] imx6: isiotmx6ul: Update SPL board boot order for eMMC Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 06/15] i.MX6UL: isiot: Add eMMC boot support Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 07/15] i.MX6UL: isiot: Add modeboot env via board_late_init Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 08/15] i.MX6UL: isiot: Add mmc_late_init Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 09/15] i.MX6UL: isiot: Switch the mmc env based on devno Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 10/15] arm: dts: imx6qdl-icore-rqs: Add eMMC node Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 11/15] imx6: icorem6_rqs: Update SPL board boot order for eMMC Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 12/15] imx6: icorem6_rqs: Add eMMC boot support Jagan Teki
2017-02-24 10:15 ` Jagan Teki [this message]
2017-02-24 10:15 ` [U-Boot] [PATCH v4 14/15] i.MX6Q: icorem6_rqs: Add mmc_late_init Jagan Teki
2017-02-24 10:15 ` [U-Boot] [PATCH v4 15/15] i.MX6Q: isiot: Switch the mmc env based on devno Jagan Teki
2017-02-26 11:54 ` [U-Boot] [PATCH v4 00/15] i.MX6: Engicam i.CoreM6/Is.IoT eMMC boot support Stefano Babic
2017-02-27 14:28   ` Sébastien Szymanski
2017-02-27 14:38     ` Jagan Teki
2017-02-27 14:52       ` Sébastien Szymanski
2017-02-27 15:07         ` Jagan Teki
2017-02-27 14:41     ` Stefano Babic

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=1487931326-10199-14-git-send-email-jagan@openedev.com \
    --to=jagan@openedev.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.