[U-Boot] [PATCH] mmc: dw_mmc: fix dwmci_data_transfer not filling data buffer

paweljarosz3691 at gmail.com paweljarosz3691 at gmail.com
Thu Oct 18 19:14:02 UTC 2018


From: Paweł Jarosz <paweljarosz3691 at gmail.com>

In current version of the driver when data size is low (observed with 2 bytes or 16 bytes)
like in case when mmc tries to read card capabilities or switch card mode, data buffer in
function dwmci_data_transfer not being filled.
The reason is that interrupt Receive FIFO Data Request (RXDR) not being fired but instead
Data Transfer Over (DTO) fires.
This results in card not being properly detected (i.e. SD version 1.0 instead of 3.0,
buswidth 1 instead 4).

So fix this by checking both interrupts status before reading data.

Signed-off-by: Paweł Jarosz <paweljarosz3691 at gmail.com>
---
 drivers/mmc/dw_mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 3b601b0e43..f1736c7abf 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -138,7 +138,8 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 		if (host->fifo_mode && size) {
 			len = 0;
 			if (data->flags == MMC_DATA_READ &&
-			    (mask & DWMCI_INTMSK_RXDR)) {
+			    (mask & DWMCI_INTMSK_RXDR ||
+			     mask & DWMCI_INTMSK_DTO)) {
 				while (size) {
 					ret = dwmci_fifo_ready(host,
 							DWMCI_FIFO_EMPTY,
-- 
2.17.1



More information about the U-Boot mailing list