diff mbox series

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

Message ID 20181018191402.1864-1-paweljarosz3691@gmail.com
State Deferred
Delegated to: Peng Fan
Headers show
Series [U-Boot] mmc: dw_mmc: fix dwmci_data_transfer not filling data buffer | expand

Commit Message

Paweł Jarosz Oct. 18, 2018, 7:14 p.m. UTC
From: Paweł Jarosz <paweljarosz3691@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@gmail.com>
---
 drivers/mmc/dw_mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

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,