Skip to content

Commit 077d407

Browse files
ldesrochescjb
authored andcommitted
mmc: atmel-mci: not busy flag has also to be used for read operations
Even if the datasheet says that the not busy flag has to be used only for write operations, it's false except for version lesser than v2xx. Not waiting on the not busy flag for read operations can cause the controller to hang-up during the initialization of some SD cards with DMA after the first CMD6 -- the next command is sent too early. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Cc: stable <stable@vger.kernel.org> [3.5, 3.6] Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent 74f330b commit 077d407

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/mmc/host/atmel-mci.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct atmel_mci_caps {
8181
boolhas_bad_data_ordering;
8282
boolneed_reset_after_xfer;
8383
boolneed_blksz_mul_4;
84+
boolneed_notbusy_for_read_ops;
8485
};
8586

8687
struct atmel_mci_dma {
@@ -1625,7 +1626,8 @@ static void atmci_tasklet_func(unsigned long priv)
16251626
__func__);
16261627
atmci_set_completed(host, EVENT_XFER_COMPLETE);
16271628

1628-
if (host->data->flags & MMC_DATA_WRITE) {
1629+
if (host->caps.need_notbusy_for_read_ops ||
1630+
(host->data->flags & MMC_DATA_WRITE)) {
16291631
atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
16301632
state = STATE_WAITING_NOTBUSY;
16311633
} else if (host->mrq->stop) {
@@ -2218,6 +2220,7 @@ static void __init atmci_get_cap(struct atmel_mci *host)
22182220
host->caps.has_bad_data_ordering = 1;
22192221
host->caps.need_reset_after_xfer = 1;
22202222
host->caps.need_blksz_mul_4 = 1;
2223+
host->caps.need_notbusy_for_read_ops = 0;
22212224

22222225
/* keep only major version number */
22232226
switch (version & 0xf00) {
@@ -2238,6 +2241,7 @@ static void __init atmci_get_cap(struct atmel_mci *host)
22382241
case 0x200:
22392242
host->caps.has_rwproof = 1;
22402243
host->caps.need_blksz_mul_4 = 0;
2244+
host->caps.need_notbusy_for_read_ops = 1;
22412245
case 0x100:
22422246
host->caps.has_bad_data_ordering = 0;
22432247
host->caps.need_reset_after_xfer = 0;

0 commit comments

Comments
 (0)