From: notaz Date: Sat, 2 Jul 2016 23:35:47 +0000 (+0300) Subject: pandora: support the right SD slot X-Git-Tag: sz_175~12 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d030cb626a4ed2cb74face0445a3ac70d424ee1a;p=pandora-u-boot.git pandora: support the right SD slot --- diff --git a/board/pandora/menu.c b/board/pandora/menu.c index 8709a9c9caf..8fd4885edc3 100644 --- a/board/pandora/menu.c +++ b/board/pandora/menu.c @@ -185,54 +185,44 @@ static struct menu_item default_menu_items[] = { { "serial prompt", menu_do_serial, }, }; -static void menu_init(void) +static void do_mmc(int dev_id) { - const char *check_format1 = "%sload mmc1 0:%d ${loadaddr} boot.scr 4"; - const char *check_format2 = "%sload mmc1 0:%d ${loadaddr} boot.txt 4"; - const char *run_format1 = "%sload mmc1 0:%d ${loadaddr} boot.scr;source ${loadaddr}"; - const char *run_format2 = "%sload mmc1 0:%d ${loadaddr} boot.txt;ssource ${loadaddr} ${filesize}"; + static const char *check_format1 = "%sload mmc1 %d:%d ${loadaddr} boot.scr 4"; + static const char *check_format2 = "%sload mmc1 %d:%d ${loadaddr} boot.txt 4"; + static const char *run_format1 = "%sload mmc1 %d:%d ${loadaddr} boot.scr;source ${loadaddr}"; + static const char *run_format2 = "%sload mmc1 %d:%d ${loadaddr} boot.txt;ssource ${loadaddr} ${filesize}"; disk_partition_t part_info; block_dev_desc_t *dev_desc; char tmp_name[32], tmp_cmd[128]; int i; - for (i = 0; i < 2; i++) - menu_items[i] = &default_menu_items[i]; - menu_item_count = i; - - if (!do_cmd("mmc rescan")) - goto no_mmc; - - dev_desc = get_dev("mmc1", 0); + dev_desc = get_dev("mmc", dev_id); if (dev_desc == NULL) { printf("dev desc null\n"); - goto no_mmc; + return; } - /* kill stdout while we search for bootfiles */ - setenv("stdout", "nulldev"); - for (i = 1; menu_item_count < ARRAY_SIZE(menu_items); i++) { if (get_partition_info(dev_desc, i, &part_info)) break; - if (do_cmd("fatls mmc1 0:%d", i)) { - if (do_cmd(check_format1, "fat", i)) { - sprintf(tmp_cmd, run_format1, "fat", i); + if (do_cmd("fatls mmc %d:%d", dev_id, i)) { + if (do_cmd(check_format1, "fat", dev_id, i)) { + sprintf(tmp_cmd, run_format1, "fat", dev_id, i); goto found; } - if (do_cmd(check_format2, "fat", i)) { - sprintf(tmp_cmd, run_format2, "fat", i); + if (do_cmd(check_format2, "fat", dev_id, i)) { + sprintf(tmp_cmd, run_format2, "fat", dev_id, i); goto found; } continue; } - if (do_cmd("ext2ls mmc1 0:%d", i)) { - if (do_cmd(check_format1, "ext2", i)) { - sprintf(tmp_cmd, run_format1, "ext2", i); + if (do_cmd("ext2ls mmc %d:%d", dev_id, i)) { + if (do_cmd(check_format1, "ext2", dev_id, i)) { + sprintf(tmp_cmd, run_format1, "ext2", dev_id, i); goto found; } - if (do_cmd(check_format2, "ext2", i)) { - sprintf(tmp_cmd, run_format2, "ext2", i); + if (do_cmd(check_format2, "ext2", dev_id, i)) { + sprintf(tmp_cmd, run_format2, "ext2", dev_id, i); goto found; } continue; @@ -240,11 +230,28 @@ static void menu_init(void) continue; found: - sprintf(tmp_name, "boot from SD1:%d", i); + sprintf(tmp_name, "boot from SD%d:%d", dev_id + 1, i); add_menu_item(tmp_name, menu_do_script_cmd, tmp_cmd); } +} + +static void menu_init(void) +{ + int i; + + for (i = 0; i < 2; i++) + menu_items[i] = &default_menu_items[i]; + menu_item_count = i; + + if (do_cmd("mmc rescan")) + { + /* kill stdout while we search for bootfiles */ + setenv("stdout", "nulldev"); + + do_mmc(0); + do_mmc(1); + } -no_mmc: setenv("stdout", "serial"); if (do_cmd("ubi part boot && ubifsmount boot")) { diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c index d942b095e24..f75c651762b 100644 --- a/board/pandora/pandora.c +++ b/board/pandora/pandora.c @@ -145,6 +145,7 @@ void set_muxconf_regs(void) int board_mmc_init(bd_t *bis) { omap_mmc_init(0, 0, 0); + omap_mmc_init(1, 0, 0); return 0; } #endif