diff options
author | Peng Fan <Peng.Fan@freescale.com> | 2015-03-14 19:58:01 +0800 |
---|---|---|
committer | Peng Fan <Peng.Fan@freescale.com> | 2015-04-29 14:56:08 +0800 |
commit | 9d40a90876b287370df0a0be1c8297641a1686f4 (patch) | |
tree | 99001b39fcd5c842b2f4f306310a1f65ab4fbc42 /arch | |
parent | d2ca1e24701a6a10578a133209c8233645a5755f (diff) | |
download | u-boot-imx-9d40a90876b287370df0a0be1c8297641a1686f4.zip u-boot-imx-9d40a90876b287370df0a0be1c8297641a1686f4.tar.gz u-boot-imx-9d40a90876b287370df0a0be1c8297641a1686f4.tar.bz2 |
MLK-10774-24 imx:mx6 add get_boot_device
Add get_boot_device function.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/cpu/armv7/mx6/soc.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c index 9499b1a..394687f 100644 --- a/arch/arm/cpu/armv7/mx6/soc.c +++ b/arch/arm/cpu/armv7/mx6/soc.c @@ -640,6 +640,49 @@ const struct boot_mode soc_boot_modes[] = { {NULL, 0}, }; +enum boot_device get_boot_device(void) +{ + enum boot_device boot_dev = UNKNOWN_BOOT; + uint soc_sbmr = readl(SRC_BASE_ADDR + 0x4); + uint bt_mem_ctl = (soc_sbmr & 0x000000FF) >> 4 ; + uint bt_mem_type = (soc_sbmr & 0x00000008) >> 3; + uint bt_dev_port = (soc_sbmr & 0x00001800) >> 11; + + switch (bt_mem_ctl) { + case 0x0: + if (bt_mem_type) + boot_dev = ONE_NAND_BOOT; + else + boot_dev = WEIM_NOR_BOOT; + break; + case 0x2: + boot_dev = SATA_BOOT; + break; + case 0x3: + if (bt_mem_type) + boot_dev = I2C_BOOT; + else + boot_dev = SPI_NOR_BOOT; + break; + case 0x4: + case 0x5: + boot_dev = bt_dev_port + SD1_BOOT; + break; + case 0x6: + case 0x7: + boot_dev = bt_dev_port + MMC1_BOOT; + break; + case 0x8 ... 0xf: + boot_dev = NAND_BOOT; + break; + default: + boot_dev = UNKNOWN_BOOT; + break; + } + + return boot_dev; +} + void s_init(void) { struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR; |