Skip to content
  • Samuel Holland's avatar
    sunxi: fix initial environment loading without MMC · e008e513
    Samuel Holland authored and André Przywara's avatar André Przywara committed
    Commit e42dad41 ("sunxi: use boot source for determining environment
    location") changed our implementation of env_get_location() and enabled
    it for every board, even those without MMC support (like the C.H.I.P.
    boards). However the default fallback location of ENVL_FAT requires MMC
    support compiled in, so the board hangs when trying to initially load
    the environment.
    
    Change the algorithm to only return configured environment locations,
    and improve the fallback algorithm on the way.
    
    The env_init() routine calling this function here does not behave well
    if the return value is ENVL_UNKNOWN on the very first call: it will make
    U-Boot proper silently hang very early.
    Work around this issue by making sure we return some configured (dummy)
    environment location when prio is 0. This for instance happens when
    booting via FEL.
    
    This fixes U-Boot loading on the C.H.I.P. boards.
    
    Fixes: e42dad41
    
     ("sunxi: use boot source for determining environment location")
    Reported-by: default avatarChris Morgan <macroalpha82@gmail.com>
    Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
    [Andre: fix FEL boot case by not returning ENVL_UNKNOWN when prio==0]
    Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
    e008e513