arm64: zynqmp: Fix emmc boot mode boot_target sequence
authorT Karthik Reddy <t.karthik.reddy@xilinx.com>
Tue, 17 Dec 2019 13:41:42 +0000 (06:41 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 14 Jan 2020 08:05:52 +0000 (09:05 +0100)
Emmc boot devcie is mounted to mmc@ff160000 controller on zynqmp.
Detect mmc alias at run time for setting up proper boot_targets
sequence instead of setting boot_targets manually.
Removed setting "modeboot" variable as it not longer need as we
switched to distro boot.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/zynqmp/zynqmp.c

index aac2eb7bc1a2db8f2059b1bdb0f8556a8229bd3c..b72eade43eea9fb778f820a097f2dae801026975 100644 (file)
@@ -580,8 +580,17 @@ int board_late_init(void)
                break;
        case EMMC_MODE:
                puts("EMMC_MODE\n");
-               mode = "mmc0";
-               env_set("modeboot", "emmcboot");
+               if (uclass_get_device_by_name(UCLASS_MMC,
+                                             "mmc@ff160000", &dev) &&
+                   uclass_get_device_by_name(UCLASS_MMC,
+                                             "sdhci@ff160000", &dev)) {
+                       puts("Boot from EMMC but without SD0 enabled!\n");
+                       return -1;
+               }
+               debug("mmc0 device found at %p, seq %d\n", dev, dev->seq);
+
+               mode = "mmc";
+               bootseq = dev->seq;
                break;
        case SD_MODE:
                puts("SD_MODE\n");