[U-Boot] [PATCH] spl_mmc: always use find_mmc_device() to get mmc handler

Alex Kiernan alex.kiernan at gmail.com
Thu Jul 25 10:50:50 UTC 2019


On Thu, Jul 25, 2019 at 11:32 AM jason.zhu at rock-chips.com
<jason.zhu at rock-chips.com> wrote:
>
> Hi,
>
>     We use the aliases to set the MMC device order. For example:
>         mmc0 = &emmc;
>         mmc1 = &sdmmc;
>     These define the MMC order in block layer.
>     But in the mmc layer, the MMC device order is defined in the dts MMC node.
>     It may make mistake to get MMC device order. So if we use the block layer interface to
> access mmc devices, use find_mmc_device to get current devnum but not uclass_get_device.
>

I get a similar (same?) problem too (and will test this patch) - I've
got no MMC1 on an AM335x, so the initialisation makes MMC2 the first
device, which then leads me to this revolting hack in my board.c:

void board_boot_order(u32 *spl_boot_list)
{
        u32 boot_device = spl_boot_device();

        /*
         * This is a filthy hack... we don't have MMC1, but the SPL boot
         * code works based on device numbers, not sequence numbers, so
         * we have to ensure that when we're booted from the eMMC we pick
         * the right entry from the DT
         */
        if (boot_device == BOOT_DEVICE_MMC2)
                spl_boot_list[0] = BOOT_DEVICE_MMC1;
        else
                spl_boot_list[0] = boot_device;
}

-- 
Alex Kiernan


More information about the U-Boot mailing list