[U-Boot] Converting to SPL_OF_CONTROL

Alex Kiernan alex.kiernan at gmail.com
Wed Aug 1 10:41:40 UTC 2018


I've long been trying to convert our board (AM3352) to all DM, after
knocking out lots of problems, I've run into one I can't seem to
configure my way around, when I enable SPL_OF_CONTROL.

We have MMC2 as our boot device, with no MMC1 (and hence not present
in the DTB). Once we're into full U-Boot this is all okay, we get the
board's MMC2 appearing as mmc0 and everything's fine.

My problem's during SPL, where the boot device is MMC2, the code tries
to lookup by devnum (which is 1 because it numbers from 0 at this
point), which doesn't exist. I'd expected aliases to work, but we
don't seem to lookup up by alias, only index, so I don't have any way
that I can see of overriding it.

If I make this change, then everything works (with the addition of an
an alias for mmc1 = &mmc2):

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 0b2f059570..b7544ba183 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -131,7 +131,7 @@ static int spl_mmc_find_device(struct mmc **mmcp,
u32 boot_device)
        }

 #if CONFIG_IS_ENABLED(DM_MMC)
-       err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev);
+       err = uclass_get_device_by_seq(UCLASS_MMC, mmc_dev, &dev);
        if (!err)
                *mmcp = mmc_get_mmc_dev(dev);
 #else

But that feels like a pretty fundamental change to make across every
board and I've no real idea if that would even be the right thing to
do, or if I should be trying to fix this some other way.

-- 
Alex Kiernan


More information about the U-Boot mailing list