From: Brian Hill Date: Tue, 26 Apr 2011 14:54:27 +0000 (-0600) Subject: Xilinx: ARM: Make use of boot mode register possible with u-boot X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c6830ae0908b56c5d8dddff0df854aa442cdeb4;p=thirdparty%2Fu-boot.git Xilinx: ARM: Make use of boot mode register possible with u-boot 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. --- diff --git a/board/xilinx/dfe/board.c b/board/xilinx/dfe/board.c index 2e8ca86953e..52171932077 100644 --- a/board/xilinx/dfe/board.c +++ b/board/xilinx/dfe/board.c @@ -12,6 +12,14 @@ #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; } diff --git a/include/configs/xpele.h b/include/configs/xpele.h index a6558b01444..5c1d2c29d6a 100644 --- a/include/configs/xpele.h +++ b/include/configs/xpele.h @@ -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...; \ @@ -218,4 +219,6 @@ #define CONFIG_DOS_PARTITION #endif +#define BOARD_LATE_INIT 1 + #endif /* __CONFIG_H */