diff options
Diffstat (limited to 'board/sunxi/board.c')
-rw-r--r-- | board/sunxi/board.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 70e01437c4..6e13ee32c1 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -32,6 +32,7 @@ #include <libfdt.h> #include <nand.h> #include <net.h> +#include <spl.h> #include <sy8106a.h> #include <asm/setup.h> @@ -491,20 +492,6 @@ int board_mmc_init(bd_t *bis) return -1; #endif -#if !defined(CONFIG_SPL_BUILD) && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2 - /* - * 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. - * are searched there first. Note we only do this for u-boot proper, - * not for the SPL, see spl_boot_device(). - */ - if (readb(SPL_ADDR + 0x28) == SUNXI_BOOTED_FROM_MMC2) { - /* Booting from emmc / mmc2, swap */ - mmc0->block_dev.devnum = 1; - mmc1->block_dev.devnum = 0; - } -#endif - return 0; } #endif @@ -720,13 +707,22 @@ static void setup_environment(const void *fdt) int misc_init_r(void) { __maybe_unused int ret; + uint boot; env_set("fel_booted", NULL); env_set("fel_scriptaddr", NULL); + env_set("mmc_bootdev", NULL); + + boot = sunxi_get_boot_device(); /* determine if we are running in FEL mode */ - if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */ + if (boot == BOOT_DEVICE_BOARD) { env_set("fel_booted", "1"); parse_spl_header(SPL_ADDR); + /* or if we booted from MMC, and which one */ + } else if (boot == BOOT_DEVICE_MMC1) { + env_set("mmc_bootdev", "0"); + } else if (boot == BOOT_DEVICE_MMC2) { + env_set("mmc_bootdev", "1"); } setup_environment(gd->fdt_blob); @@ -736,7 +732,10 @@ int misc_init_r(void) if (ret) return ret; #endif - sunxi_musb_board_init(); + +#ifdef CONFIG_USB_ETHER + usb_ether_init(); +#endif return 0; } |