diff mbox series

[v3,15/20] rockchip: rk3588: bind MMC controllers in U-Boot proper pre-reloc

Message ID 20240221-jaguar-v3-15-1f256a82201b@theobroma-systems.com
State Superseded
Delegated to: Kever Yang
Headers show
Series rockchip: add support for Theobroma JAGUAR SBC-RK3588-AMR | expand

Commit Message

Quentin Schulz Feb. 21, 2024, 10:37 a.m. UTC
From: Quentin Schulz <quentin.schulz@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 allows something in the env_init() call stack to be able to use
uclasses for SD and eMMC controller on RK3588S/RK3588. This aligns the
behavior with what seems to be all SoCs except RK356x family.

Additionally, if any other env function (e.g. env_load) were to be used
before relocation, this is also required as otherwise it wouldn't be
able to find the MMC device(s).

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/dts/rk3588s-u-boot.dtsi | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kever Yang March 8, 2024, 10:06 a.m. UTC | #1
On 2024/2/21 18:37, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@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 allows something in the env_init() call stack to be able to use
> uclasses for SD and eMMC controller on RK3588S/RK3588. This aligns the
> behavior with what seems to be all SoCs except RK356x family.
>
> Additionally, if any other env function (e.g. env_load) were to be used
> before relocation, this is also required as otherwise it wouldn't be
> able to find the MMC device(s).
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/dts/rk3588s-u-boot.dtsi | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/dts/rk3588s-u-boot.dtsi b/arch/arm/dts/rk3588s-u-boot.dtsi
> index bf3b1ea8a3c..ac67c777ade 100644
> --- a/arch/arm/dts/rk3588s-u-boot.dtsi
> +++ b/arch/arm/dts/rk3588s-u-boot.dtsi
> @@ -188,11 +188,13 @@
>   
>   &sdmmc {
>   	bootph-pre-ram;
> +	bootph-some-ram;
>   	u-boot,spl-fifo-mode;
>   };
>   
>   &sdhci {
>   	bootph-pre-ram;
> +	bootph-some-ram;
>   	u-boot,spl-fifo-mode;
>   };
>   
>
diff mbox series

Patch

diff --git a/arch/arm/dts/rk3588s-u-boot.dtsi b/arch/arm/dts/rk3588s-u-boot.dtsi
index bf3b1ea8a3c..ac67c777ade 100644
--- a/arch/arm/dts/rk3588s-u-boot.dtsi
+++ b/arch/arm/dts/rk3588s-u-boot.dtsi
@@ -188,11 +188,13 @@ 
 
 &sdmmc {
 	bootph-pre-ram;
+	bootph-some-ram;
 	u-boot,spl-fifo-mode;
 };
 
 &sdhci {
 	bootph-pre-ram;
+	bootph-some-ram;
 	u-boot,spl-fifo-mode;
 };