summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2016-09-16 15:39:54 +0200
committerKlaus Goger <klaus.goger@theobroma-systems.com>2016-09-18 20:22:05 +0200
commit4a3ae98974b1600084f00bd8bc82f9e72a2587cf (patch)
tree0d09f1fd173d5293bafac2261a38b94be0216993 /board
parent59956cf5b49025a523ebfd94921f695a81265ab8 (diff)
sun9i: armadillo: select bootdevice via devicetreeHEADv2016.03-armadillo
Diffstat (limited to 'board')
-rw-r--r--board/sunxi/board.c36
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.