[1/9] ARM: uniphier: do not modify bootcmd environment variable at run-time

Message ID 1545217401-27018-2-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit 6bc50a8f69920b2d2b0c5890e2133748b62656c3
Headers show
Series
  • ARM: dts: uniphier: updates for v2019.01
Related show

Commit Message

Masahiro Yamada Dec. 19, 2018, 11:03 a.m.
Some users might want to modify 'bootcmd' at compile-time by editing
include/configs/uniphier.h, but overwriting it at run-time makes it
impossible.

Instead, set 'bootdev' at run-time, which contains the boot device the
system is booting from, then indirectly reference it from 'bootcmd'.

It is up to users whether to override 'bootcmd'.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/mach-uniphier/board_late_init.c | 8 ++++----
 configs/uniphier_ld4_sld8_defconfig      | 1 +
 configs/uniphier_v7_defconfig            | 1 +
 configs/uniphier_v8_defconfig            | 1 +
 include/configs/uniphier.h               | 4 ++++
 5 files changed, 11 insertions(+), 4 deletions(-)

Patch

diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c
index 1b871c6..972dbe8 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -66,20 +66,20 @@  int board_late_init(void)
 	switch (uniphier_boot_device_raw()) {
 	case BOOT_DEVICE_MMC1:
 		printf("eMMC Boot");
-		env_set("bootcmd", "run bootcmd_mmc0; run distro_bootcmd");
+		env_set("bootdev", "emmc");
 		break;
 	case BOOT_DEVICE_NAND:
 		printf("NAND Boot");
-		env_set("bootcmd", "run bootcmd_ubifs0; run distro_bootcmd");
+		env_set("bootdev", "nand");
 		nand_denali_wp_disable();
 		break;
 	case BOOT_DEVICE_NOR:
 		printf("NOR Boot");
-		env_set("bootcmd", "run tftpboot; run distro_bootcmd");
+		env_set("bootdev", "nor");
 		break;
 	case BOOT_DEVICE_USB:
 		printf("USB Boot");
-		env_set("bootcmd", "run bootcmd_usb0; run distro_bootcmd");
+		env_set("bootdev", "usb");
 		break;
 	default:
 		printf("Unknown");
diff --git a/configs/uniphier_ld4_sld8_defconfig b/configs/uniphier_ld4_sld8_defconfig
index 6b9e22a..bede166 100644
--- a/configs/uniphier_ld4_sld8_defconfig
+++ b/configs/uniphier_ld4_sld8_defconfig
@@ -9,6 +9,7 @@  CONFIG_ARCH_UNIPHIER_LD4_SLD8=y
 CONFIG_MICRO_SUPPORT_CARD=y
 CONFIG_NR_DRAM_BANKS=3
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_BOOTCOMMAND="run ${bootdev}boot"
 CONFIG_LOGLEVEL=6
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
diff --git a/configs/uniphier_v7_defconfig b/configs/uniphier_v7_defconfig
index 4c06f27..be4ab7c 100644
--- a/configs/uniphier_v7_defconfig
+++ b/configs/uniphier_v7_defconfig
@@ -8,6 +8,7 @@  CONFIG_SPL=y
 CONFIG_MICRO_SUPPORT_CARD=y
 CONFIG_NR_DRAM_BANKS=3
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_BOOTCOMMAND="run ${bootdev}boot"
 CONFIG_LOGLEVEL=6
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
diff --git a/configs/uniphier_v8_defconfig b/configs/uniphier_v8_defconfig
index f8f9bdf..6f7c269 100644
--- a/configs/uniphier_v8_defconfig
+++ b/configs/uniphier_v8_defconfig
@@ -7,6 +7,7 @@  CONFIG_ARCH_UNIPHIER_V8_MULTI=y
 CONFIG_MICRO_SUPPORT_CARD=y
 CONFIG_NR_DRAM_BANKS=3
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_BOOTCOMMAND="run ${bootdev}boot"
 CONFIG_LOGLEVEL=6
 CONFIG_CMD_CONFIG=y
 CONFIG_CMD_IMLS=y
diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h
index 70f8712..7d14c31 100644
--- a/include/configs/uniphier.h
+++ b/include/configs/uniphier.h
@@ -171,6 +171,10 @@ 
 	"initrd_high=0xffffffffffffffff\0"			\
 	"scriptaddr=0x85000000\0"				\
 	"nor_base=0x42000000\0"					\
+	"emmcboot=mmcsetn && run bootcmd_mmc${mmc_first_dev}\0" \
+	"nandboot=run bootcmd_ubifs0\0" \
+	"norboot=run tftpboot\0" \
+	"usbboot=run bootcmd_usb0\0" \
 	"sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&"	\
 		"tftpboot $tmp_addr $second_image && " \
 		"setexpr tmp_addr $nor_base + 0x70000 && " \