diff options
Diffstat (limited to 'board/sunxi')
-rw-r--r-- | board/sunxi/board.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index ca67368ec2..d55e974856 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -357,6 +357,42 @@ int board_mmc_init(bd_t *bis) #endif #if !defined(CONFIG_SPL_BUILD) && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2 + /* Determine the bootdevice propagated via devicetree from spl + * to select the mmc device order. In case no boot-device is set + * fall back to the old detection scheme. + */ + int nodeoffset; + const char* boot_device; + + debug("FDT_BLOB 0x%p\n", gd->fdt_blob); + + nodeoffset = fdt_path_offset(gd->fdt_blob, "/"); + if (nodeoffset < 0) { + debug("No '/' in FTD?"); + goto no_boot_device; + } + + boot_device = fdt_getprop(gd->fdt_blob, nodeoffset, "boot-device", NULL); + if (!boot_device) { + debug("no 'boot-device' set"); + goto no_boot_device; + } + debug("boot-device: %s\n",boot_device); + + if(strcmp(boot_device,"MMC1") == 0) + { + mmc0->block_dev.devnum = 0; + mmc1->block_dev.devnum = 1; + } + else if(strcmp(boot_device,"MMC2") == 0) + { + mmc0->block_dev.devnum = 1; + mmc1->block_dev.devnum = 0; + } + return 0; + +no_boot_device: + /* * On systems with an emmc (mmc2), figure out if we are booting from * the emmc and if we are make it "mmc dev 0" so that boot.scr, etc. |