From: Xu Ziyuan Date: Thu, 28 Jul 2016 02:25:47 +0000 (+0800) Subject: mmc: dw_mmc: transfer proper bytes to FIFO X-Git-Tag: v2016.09-rc2~98^2~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2990e07a33159b1c23325c2c789cdb3f9ab4d89c;p=u-boot mmc: dw_mmc: transfer proper bytes to FIFO 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 Acked-by: Jaehoon Chung Reviewed-by: Simon Glass Reviewed-by: Shawn Lin Signed-off-by: Jaehoon Chung --- diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index a6a5fc6579..a0a582b442 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -125,6 +125,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); @@ -138,6 +139,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++);