diff mbox

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

Message ID 1469672748-21986-1-git-send-email-xzy.xu@rock-chips.com
State Accepted
Commit 2990e07a33159b1c23325c2c789cdb3f9ab4d89c
Delegated to: Jaehoon Chung
Headers show

Commit Message

Xu Ziyuan July 28, 2016, 2:25 a.m. UTC
The former implement, dw_mmc will push and pop the redundant data to
FIFO, we should transfer it according to the real size.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
---

 drivers/mmc/dw_mmc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jaehoon Chung July 28, 2016, 8:09 a.m. UTC | #1
Hi Ziyuan,

On 07/28/2016 11:25 AM, Ziyuan Xu wrote:
> The former implement, dw_mmc will push and pop the redundant data to
> FIFO, we should transfer it according to the real size.

Looks good to me.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: Ziyuan Xu <xzy.xu@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++);
>
Simon Glass Aug. 1, 2016, 2:21 a.m. UTC | #2
On 27 July 2016 at 20:25, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
> The former implement, dw_mmc will push and pop the redundant data to
> FIFO, we should transfer it according to the real size.
>
> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> ---
>
>  drivers/mmc/dw_mmc.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Shawn Lin Aug. 2, 2016, 2:37 a.m. UTC | #3
在 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@rock-chips.com>

> Signed-off-by: Ziyuan Xu <xzy.xu@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++);
>
Jaehoon Chung Aug. 5, 2016, 2:27 a.m. UTC | #4
On 07/28/2016 11:25 AM, Xu Ziyuan wrote:
> The former implement, dw_mmc will push and pop the redundant data to
> FIFO, we should transfer it according to the real size.
> 
> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>


Applied on u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung


> ---
> 
>  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++);
>
diff mbox

Patch

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++);