[U-Boot] [PATCH 1/2] mmc: dw_mmc: transfer proper bytes to FIFO

Shawn Lin shawn.lin at rock-chips.com
Tue Aug 2 04:37:16 CEST 2016


在 2016/7/28 10:25, Ziyuan Xu 写道:
> The former implement, dw_mmc will push and pop the redundant data to
> FIFO, we should transfer it according to the real size.
>

Bascially I never checked any bootloader code, but I get dw_mmc
of uboot to check your patch. Obviously it should be the case you
mentioned.

Feel free to add

Reviewed-by: Shawn Lin <shawn.lin at rock-chips.com>

> Signed-off-by: Ziyuan Xu <xzy.xu at rock-chips.com>
> ---
>
>  drivers/mmc/dw_mmc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> index 2cf7bae..38d4a64 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -126,6 +126,7 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>  					len = dwmci_readl(host, DWMCI_STATUS);
>  					len = (len >> DWMCI_FIFO_SHIFT) &
>  						    DWMCI_FIFO_MASK;
> +					len = min(size, len);
>  					for (i = 0; i < len; i++)
>  						*buf++ =
>  						dwmci_readl(host, DWMCI_DATA);
> @@ -139,6 +140,7 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>  					len = fifo_depth - ((len >>
>  						   DWMCI_FIFO_SHIFT) &
>  						   DWMCI_FIFO_MASK);
> +					len = min(size, len);
>  					for (i = 0; i < len; i++)
>  						dwmci_writel(host, DWMCI_DATA,
>  							     *buf++);
>


-- 
Best Regards
Shawn Lin



More information about the U-Boot mailing list