[PATCH 17/18] rockchip: rk3588: bind MMC controllers in U-Boot proper pre-reloc
Quentin Schulz
quentin.schulz at theobroma-systems.com
Wed Jan 24 12:04:56 CET 2024
Hi Kever,
On 1/24/24 11:35, Kever Yang wrote:
> Hi Quentin,
>
> On 2024/1/23 22:49, Quentin Schulz wrote:
>> From: Quentin Schulz <quentin.schulz at theobroma-systems.com>
>>
>> Since commit 9e644284ab81 ("dm: core: Report bootph-pre-ram/sram node as
>> pre-reloc after relocation"), bootph-pre-ram doesn't make U-Boot proper
>> bind the device before relocation.
>>
>> While this is usually not much of an issue, it is when there's a lookup
>> for devices by code running before the relocation. Such is the case of
>> env_init() which calls env_driver_lookup() which calls
>> env_get_location() which is a weak symbol and may call
>> arch_env_get_location() also a weak symbol. Those are two functions that
>> may traverse UCLASS to find some devices (e.g.
>> board/theobroma-systems/common/common.c:arch_env_get_location()).
>
> This sounds like we need to update arch_env_get_location() instead of
> enable mmc driver
>
> before relocate, because you we don't really need the mmc driver works
> here, there is no
>
> access requirement to mmc at this point, right?
>
All Rockchip SoCs except RK3588(S) and RK356x have it done this way, a
little bit of consistency wouldn't hurt :)
I need to be able to find out if the device that was used to load U-Boot
proper is an MMC device so that I can tell arch_env_get_location() to
return ENVL_MMC; in that case.
For that, I've used uclass_find_device_by_ofnode() which parses the list
of devices registered in the UCLASS_MMC (for that scenario). I assume
the only requirement is that the device needs to be bound, not probed
(haven't checked). If there's another way to do this **properly**, I'm
all ears. I would likely need to do the same for the SPI controllers but
since none of our RK3588-based products have SPI-NOR, I don't need those
(but it works on RK3399 just fine).
I still think there's value in having consistency between all Rockchip
SoCs (and if applicable to other SoC vendors, then those as well). We
could still do both though, have this and then fix the need for
requiring sdmmc/sdhci devices to be bound/probed for env_init()
(arch_env_get_location()) to work.
What is bothering you in enabling those drivers in U-Boot proper before
relocation?
Cheers,
Quentin
More information about the U-Boot
mailing list