]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
Xilinx: ARM: Make use of boot mode register possible with u-boot
authorBrian Hill <brian.hill@xilinx.com>
Tue, 26 Apr 2011 14:54:27 +0000 (08:54 -0600)
committerBrian Hill <brian.hill@xilinx.com>
Tue, 26 Apr 2011 14:54:27 +0000 (08:54 -0600)
The environment variable modeboot is set to something appropriate
based on the contents of the boot mode register.
EXAMPLE:
For bootmode 2, modeboot will be set to "run norboot".
This method of booting can be utilized via bootcmd = "run modeboot"
or not, if the user prefers that u-boot and the kernel come from
separate storage devices.

board/xilinx/dfe/board.c
include/configs/xpele.h

index 2e8ca86953e7fff1060299a455748b7a09f0165a..52171932077190a83b11b453ec3c59211d928875 100644 (file)
 #define PARPORT_MC_SET_CYCLES                   0x014
 #define PARPORT_MC_SET_OPMODE                   0x018
 
+#define BOOT_MODE_REG     (XPSS_SYS_CTRL_BASEADDR + 0x25C)
+#define BOOT_MODES_MASK    0x0000000F
+#define QSPI_MODE         (0x00000000)            /**< QSPI */
+#define NAND_FLASH_MODE   (0x00000001)            /**< NAND */
+#define NOR_FLASH_MODE    (0x00000002)            /**< NOR  */
+#define SD_MODE           (0x00000008)            /**< Secure Digital card */
+
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /* Where should these really go? */
@@ -88,6 +96,32 @@ int board_init(void)
 {
        icache_enable();
        init_nor_flash();
+
+       return 0;
+}
+
+int board_late_init (void)
+{
+       u32 boot_mode;
+
+       boot_mode = (In32(BOOT_MODE_REG) & BOOT_MODES_MASK);
+       switch(boot_mode) {
+       case QSPI_MODE:
+               setenv("modeboot", "run qspiboot");
+               break;
+       case NAND_FLASH_MODE:
+               setenv("modeboot", "run nandboot");
+               break;
+       case NOR_FLASH_MODE:
+               setenv("modeboot", "run norboot");
+               break;
+       case SD_MODE:
+               setenv("modeboot", "run sdboot");
+               break;
+       default:
+               setenv("modeboot", "");
+               break;
+       }
        return 0;
 }
 
index a6558b0144457b7eaa6e36b4d5ed9a4e4ce34c2e..5c1d2c29d6ab1f1e2db5a542e2e0d0e8f97a090f 100644 (file)
@@ -28,6 +28,7 @@
        "ramdisk_size=0x200000\0"       \
        "nand_kernel_size=0x400000\0"   \
        "nand_ramdisk_size=0x400000\0"  \
+       "bootcmd=run modeboot\0"        \
        "norboot=echo Copying Linux from NOR flash to RAM...;                   \
                            cp 0xE2100000 0x8000 ${kernel_size};                \
                            echo Copying ramdisk from NOR flash to RAM...;      \
 #define CONFIG_DOS_PARTITION
 #endif
 
+#define BOARD_LATE_INIT        1
+
 #endif /* __CONFIG_H */