All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: dw_mmc: fix dwmci_data_transfer not filling data buffer
@ 2018-10-18 19:14 paweljarosz3691 at gmail.com
  0 siblings, 0 replies; only message in thread
From: paweljarosz3691 at gmail.com @ 2018-10-18 19:14 UTC (permalink / raw)
  To: u-boot

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 --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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-18 19:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 19:14 [U-Boot] [PATCH] mmc: dw_mmc: fix dwmci_data_transfer not filling data buffer paweljarosz3691 at gmail.com

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.