[U-Boot,v2,1/2] rockchip: dwmmc: add handling for u-boot, spl-fifo-mode
diff mbox series

Message ID 20191119110402.17876-1-heiko@sntech.de
State Accepted
Commit c8dd0e42d709c9734f313c547d0707e27ca0de51
Delegated to: Kever Yang
Headers show
Series
  • [U-Boot,v2,1/2] rockchip: dwmmc: add handling for u-boot, spl-fifo-mode
Related show

Commit Message

Heiko Stübner Nov. 19, 2019, 11:04 a.m. UTC
From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>

Rockchips dwmmc controllers can't do dma to non-ddr addresses,
like for example the soc-internal sram but during boot parts of
TrustedFirmware need to be placed there from the read FIT image.

So add handling for a u-boot,spl-fifo-mode to not put the mmc
controllers into fifo mode for all time.

The regular fifo-mode property still takes precedent and only
if not set do we check for the spl-specific property.

Suggested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
---
 drivers/mmc/rockchip_dw_mmc.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Kever Yang Nov. 20, 2019, 7:19 a.m. UTC | #1
Heiko,

On 2019/11/19 下午7:04, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>
> Rockchips dwmmc controllers can't do dma to non-ddr addresses,
> like for example the soc-internal sram but during boot parts of
> TrustedFirmware need to be placed there from the read FIT image.
>
> So add handling for a u-boot,spl-fifo-mode to not put the mmc
> controllers into fifo mode for all time.
>
> The regular fifo-mode property still takes precedent and only
> if not set do we check for the spl-specific property.
>
> Suggested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>


Well, this is a alternative solution of using bounce buffer  for MMC in SPL.


Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever

> ---
>   drivers/mmc/rockchip_dw_mmc.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
> index b2a1201631..a0e1be8794 100644
> --- a/drivers/mmc/rockchip_dw_mmc.c
> +++ b/drivers/mmc/rockchip_dw_mmc.c
> @@ -72,6 +72,11 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
>   		return -EINVAL;
>   	priv->fifo_mode = dev_read_bool(dev, "fifo-mode");
>   
> +#ifdef CONFIG_SPL_BUILD
> +	if (!priv->fifo_mode)
> +		priv->fifo_mode = dev_read_bool(dev, "u-boot,spl-fifo-mode");
> +#endif
> +
>   	/*
>   	 * 'clock-freq-min-max' is deprecated
>   	 * (see https://github.com/torvalds/linux/commit/b023030f10573de738bbe8df63d43acab64c9f7b)
Philipp Tomsich Nov. 20, 2019, 11:09 a.m. UTC | #2
> On 19.11.2019, at 12:04, Heiko Stuebner <heiko@sntech.de> wrote:
> 
> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> 
> Rockchips dwmmc controllers can't do dma to non-ddr addresses,
> like for example the soc-internal sram but during boot parts of
> TrustedFirmware need to be placed there from the read FIT image.
> 
> So add handling for a u-boot,spl-fifo-mode to not put the mmc
> controllers into fifo mode for all time.
> 
> The regular fifo-mode property still takes precedent and only
> if not set do we check for the spl-specific property.
> 
> Suggested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

> ---
> drivers/mmc/rockchip_dw_mmc.c | 5 +++++
> 1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
> index b2a1201631..a0e1be8794 100644
> --- a/drivers/mmc/rockchip_dw_mmc.c
> +++ b/drivers/mmc/rockchip_dw_mmc.c
> @@ -72,6 +72,11 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
> 		return -EINVAL;
> 	priv->fifo_mode = dev_read_bool(dev, "fifo-mode");
> 
> +#ifdef CONFIG_SPL_BUILD
> +	if (!priv->fifo_mode)
> +		priv->fifo_mode = dev_read_bool(dev, "u-boot,spl-fifo-mode");
> +#endif

Nitpick: I would have used an “|=" instead of the "if(…)”.

> +
> 	/*
> 	 * 'clock-freq-min-max' is deprecated
> 	 * (see https://github.com/torvalds/linux/commit/b023030f10573de738bbe8df63d43acab64c9f7b)
> -- 
> 2.24.0
>
Philipp Tomsich Nov. 20, 2019, 11:10 a.m. UTC | #3
Sorry, I was confused and meant...

> On 20.11.2019, at 12:09, Philipp Tomsich <philipp.tomsich@theobroma-systems.com> wrote:
> 
> 
> 
>> On 19.11.2019, at 12:04, Heiko Stuebner <heiko@sntech.de> wrote:
>> 
>> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>> 
>> Rockchips dwmmc controllers can't do dma to non-ddr addresses,
>> like for example the soc-internal sram but during boot parts of
>> TrustedFirmware need to be placed there from the read FIT image.
>> 
>> So add handling for a u-boot,spl-fifo-mode to not put the mmc
>> controllers into fifo mode for all time.
>> 
>> The regular fifo-mode property still takes precedent and only
>> if not set do we check for the spl-specific property.
>> 
>> Suggested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Patch
diff mbox series

diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index b2a1201631..a0e1be8794 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -72,6 +72,11 @@  static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
 		return -EINVAL;
 	priv->fifo_mode = dev_read_bool(dev, "fifo-mode");
 
+#ifdef CONFIG_SPL_BUILD
+	if (!priv->fifo_mode)
+		priv->fifo_mode = dev_read_bool(dev, "u-boot,spl-fifo-mode");
+#endif
+
 	/*
 	 * 'clock-freq-min-max' is deprecated
 	 * (see https://github.com/torvalds/linux/commit/b023030f10573de738bbe8df63d43acab64c9f7b)