[PATCH 11/11] board: freescale: p1_p2_rdb_pc: Add env commands norlowerboot, norupperboot, sd2boot and defboot

Pali Rohár pali at kernel.org
Thu Apr 7 12:16:24 CEST 2022


All *boot env commands overrides default BootROM boot location via i2c.
BootROM then starts booting U-Boot from this specified location instead of
the default one.

Add new env command defboot which reverts BootROM boot location to the
default value, which in most cases is configurable by HW DIP switches.

And add new env commands norlowerboot, norupperboot, sd2boot to boot from
other locations. norlowerboot would instruct BootROM to boot from lower NOR
bank, norupperboot from upper NOR bank and sd2boot from SD card with
alternative configuration.

Signed-off-by: Pali Rohár <pali at kernel.org>
---
 include/configs/p1_p2_bootrom.h | 14 +++++++++++++
 include/configs/p1_p2_rdb_pc.h  | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/include/configs/p1_p2_bootrom.h b/include/configs/p1_p2_bootrom.h
index a1f61b788cf7..d1e91049606b 100644
--- a/include/configs/p1_p2_bootrom.h
+++ b/include/configs/p1_p2_bootrom.h
@@ -15,6 +15,14 @@
 #define CHANGE_BOOTROM_SOURCE_DEF_NOR_BANK_CMD CHANGE_BOOTROM_SOURCE_CMD(__SW_BOOT_NOR, __SW_BOOT_MASK)
 #endif
 
+#ifdef __SW_BOOT_NOR_BANK_LO
+#define CHANGE_BOOTROM_SOURCE_LOWER_NOR_BANK_CMD CHANGE_BOOTROM_SOURCE_CMD(__SW_BOOT_NOR_BANK_LO, __SW_BOOT_NOR_BANK_MASK)
+#endif
+
+#ifdef __SW_BOOT_NOR_BANK_UP
+#define CHANGE_BOOTROM_SOURCE_UPPER_NOR_BANK_CMD CHANGE_BOOTROM_SOURCE_CMD(__SW_BOOT_NOR_BANK_UP, __SW_BOOT_NOR_BANK_MASK)
+#endif
+
 #ifdef __SW_BOOT_SPI
 #define CHANGE_BOOTROM_SOURCE_SPI_CMD CHANGE_BOOTROM_SOURCE_CMD(__SW_BOOT_SPI, __SW_BOOT_MASK)
 #endif
@@ -23,6 +31,10 @@
 #define CHANGE_BOOTROM_SOURCE_SD_CMD CHANGE_BOOTROM_SOURCE_CMD(__SW_BOOT_SD, __SW_BOOT_MASK)
 #endif
 
+#ifdef __SW_BOOT_SD2
+#define CHANGE_BOOTROM_SOURCE_SD2_CMD CHANGE_BOOTROM_SOURCE_CMD(__SW_BOOT_SD2, __SW_BOOT_MASK)
+#endif
+
 #ifdef __SW_BOOT_NAND
 #define CHANGE_BOOTROM_SOURCE_NAND_CMD CHANGE_BOOTROM_SOURCE_CMD(__SW_BOOT_NAND, __SW_BOOT_MASK)
 #endif
@@ -30,3 +42,5 @@
 #ifdef __SW_BOOT_PCIE
 #define CHANGE_BOOTROM_SOURCE_PCIE_CMD CHANGE_BOOTROM_SOURCE_CMD(__SW_BOOT_PCIE, __SW_BOOT_MASK)
 #endif
+
+#define CHANGE_BOOTROM_SOURCE_DEF_CMD CHANGE_BOOTROM_SOURCE_CMD(0x00, 0xff)
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index d41b31081017..ac8199a88aa0 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -25,6 +25,9 @@
 #define __SW_NOR_BANK_MASK	0xfd
 #define __SW_NOR_BANK_UP	0x00
 #define __SW_NOR_BANK_LO	0x02
+#define __SW_BOOT_NOR_BANK_UP	0x5c /* (__SW_BOOT_NOR | __SW_NOR_BANK_UP) */
+#define __SW_BOOT_NOR_BANK_LO	0x5e /* (__SW_BOOT_NOR | __SW_NOR_BANK_LO) */
+#define __SW_BOOT_NOR_BANK_MASK	0x01 /* (__SW_BOOT_MASK & __SW_NOR_BANK_MASK) */
 #define CONFIG_SYS_L2_SIZE	(256 << 10)
 #endif
 
@@ -54,6 +57,9 @@
 #define __SW_NOR_BANK_MASK	0xfd
 #define __SW_NOR_BANK_UP	0x00
 #define __SW_NOR_BANK_LO	0x02
+#define __SW_BOOT_NOR_BANK_UP	0x64 /* (__SW_BOOT_NOR | __SW_NOR_BANK_UP) */
+#define __SW_BOOT_NOR_BANK_LO	0x66 /* (__SW_BOOT_NOR | __SW_NOR_BANK_LO) */
+#define __SW_BOOT_NOR_BANK_MASK	0x01 /* (__SW_BOOT_MASK & __SW_NOR_BANK_MASK) */
 #define CONFIG_SYS_L2_SIZE	(256 << 10)
 /*
  * Dynamic MTD Partition support with mtdparts
@@ -73,6 +79,9 @@
 #define __SW_NOR_BANK_MASK	0xfd
 #define __SW_NOR_BANK_UP	0x00
 #define __SW_NOR_BANK_LO	0x02
+#define __SW_BOOT_NOR_BANK_UP	0xc8 /* (__SW_BOOT_NOR | __SW_NOR_BANK_UP) */
+#define __SW_BOOT_NOR_BANK_LO	0xca /* (__SW_BOOT_NOR | __SW_NOR_BANK_LO) */
+#define __SW_BOOT_NOR_BANK_MASK	0x01 /* (__SW_BOOT_MASK & __SW_NOR_BANK_MASK) */
 #define CONFIG_SYS_L2_SIZE	(512 << 10)
 /*
  * Dynamic MTD Partition support with mtdparts
@@ -595,6 +604,18 @@
 #define __NOR_RST_CMD ""
 #endif
 
+#ifdef CHANGE_BOOTROM_SOURCE_LOWER_NOR_BANK_CMD
+#define __NOR_LOWER_RST_CMD "norlowerboot="__stringify(CHANGE_BOOTROM_SOURCE_LOWER_NOR_BANK_CMD)"; reset\0"
+#else
+#define __NOR_LOWER_RST_CMD ""
+#endif
+
+#ifdef CHANGE_BOOTROM_SOURCE_UPPER_NOR_BANK_CMD
+#define __NOR_UPPER_RST_CMD "norupperboot="__stringify(CHANGE_BOOTROM_SOURCE_UPPER_NOR_BANK_CMD)"; reset\0"
+#else
+#define __NOR_UPPER_RST_CMD ""
+#endif
+
 #ifdef CHANGE_BOOTROM_SOURCE_SPI_CMD
 #define __SPI_RST_CMD "spiboot="__stringify(CHANGE_BOOTROM_SOURCE_SPI_CMD)"; reset\0"
 #else
@@ -607,6 +628,12 @@
 #define __SD_RST_CMD ""
 #endif
 
+#ifdef CHANGE_BOOTROM_SOURCE_SD2_CMD
+#define __SD2_RST_CMD "sd2boot="__stringify(CHANGE_BOOTROM_SOURCE_SD2_CMD)"; reset\0"
+#else
+#define __SD2_RST_CMD ""
+#endif
+
 #ifdef CHANGE_BOOTROM_SOURCE_NAND_CMD
 #define __NAND_RST_CMD "nandboot="__stringify(CHANGE_BOOTROM_SOURCE_NAND_CMD)"; reset\0"
 #else
@@ -619,6 +646,12 @@
 #define __PCIE_RST_CMD ""
 #endif
 
+#ifdef CHANGE_BOOTROM_SOURCE_DEF_CMD
+#define __DEF_RST_CMD "defboot="__stringify(CHANGE_BOOTROM_SOURCE_DEF_CMD)"; reset\0"
+#else
+#define __DEF_RST_CMD ""
+#endif
+
 #define	CONFIG_EXTRA_ENV_SETTINGS	\
 "netdev=eth0\0"	\
 "uboot=" __stringify(CONFIG_UBOOTPATH) "\0"	\
@@ -647,10 +680,14 @@ __VSCFW_ADDR	\
 __MAP_NOR_LOWER_CMD	\
 __MAP_NOR_UPPER_CMD	\
 __NOR_RST_CMD	\
+__NOR_LOWER_RST_CMD	\
+__NOR_UPPER_RST_CMD	\
 __SPI_RST_CMD	\
 __SD_RST_CMD	\
+__SD2_RST_CMD	\
 __NAND_RST_CMD	\
 __PCIE_RST_CMD	\
+__DEF_RST_CMD	\
 ""
 
 #define CONFIG_USB_FAT_BOOT	\
-- 
2.20.1



More information about the U-Boot mailing list