Skip to contentSkip to conversation

MMC: SDHCI Auto-CMD23 fixes.

PATCH In review Andrei Warkentin 2 participants 4 messages May 25, 2011 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 MMC: SDHCI Auto-CMD23 fixes.

In reply to a message not in the archive

Fixes bugs in Auto-CMD23 feature enable decision. Auto-CMD23 shoud be enabled if host is >= v3, and SDMA is not in use.

USE_ADMA | USE_SDMA | Auto-CMD23
---------+----------+-----------

    0    |    0     |     1
---------+----------+-----------
    0    |    1     |     0
---------+----------+-----------
    1    |    0     |     1
---------+----------+-----------
    1    |    1     |     1
---
 drivers/mmc/host/sdhci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +2 -2
index fbb1842..a4e64b0 100644
@@ -2498,9 +2498,9 @@ int sdhci_add_host(struct sdhci_host *host)
 		host->flags |= SDHCI_AUTO_CMD12;
 
 	/* Auto-CMD23 stuff only works in ADMA or PIO. */
-	if ((host->version == SDHCI_SPEC_300) &&
+	if ((host->version >= SDHCI_SPEC_300) &&
 	    ((host->flags & SDHCI_USE_ADMA) ||
-	     !(host->flags & SDHCI_REQ_USE_DMA))) {
+	     !(host->flags & SDHCI_USE_SDMA))) {
 		host->flags |= SDHCI_AUTO_CMD23;
 		printk(KERN_INFO "%s: Auto-CMD23 available\n", mmc_hostname(mmc));
 	} else
Signature · 1 line
1.7.0.4
#2 lore raw

Chris,

Quoted 28 lines · Andrei Warkentin

Fixes bugs in Auto-CMD23 feature enable decision. Auto-CMD23 shoud be enabled if host is >= v3, and SDMA is not in use.

USE_ADMA | USE_SDMA | Auto-CMD23
---------+----------+-----------
   0    |    0     |     1
---------+----------+-----------
   0    |    1     |     0
---------+----------+-----------
   1    |    0     |     1
---------+----------+-----------
   1    |    1     |     1

---
 drivers/mmc/host/sdhci.c |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +1 -1
index fbb1842..a4e64b0 100644
@@ -2498,9 +2498,9 @@ int sdhci_add_host(struct sdhci_host *host)
                host->flags |= SDHCI_AUTO_CMD12;
 
        /* Auto-CMD23 stuff only works in ADMA or PIO. */
-       if ((host->version == SDHCI_SPEC_300) &&
+       if ((host->version >= SDHCI_SPEC_300) &&
Quoted 10 lines

           ((host->flags & SDHCI_USE_ADMA) ||
-            !(host->flags & SDHCI_REQ_USE_DMA))) {
+            !(host->flags & SDHCI_USE_SDMA))) {
               host->flags |= SDHCI_AUTO_CMD23;
               printk(KERN_INFO "%s: Auto-CMD23 available\n", mmc_hostname(mmc)); } else
--
1.7.0.4

The reason the older logic didn't work correctly is because SDHCI_REQ_USE_DMA is not set in sdhci_add_host, but set in sdhci_prepare_data. That means if you didn't have USE_ADMA, but had USE_SDMA, it would still enable AUTO_CMD23, since the SDHCI_REQ_USE_DMA bit would always be 0. I would be very grateful if you can try it out on your XO. I unfortunately can't test this out right now.

A

#3 lore raw
In reply to Andrei Warkentin

Hi,

Quoted 13 lines · Andrei Warkentin

Fixes bugs in Auto-CMD23 feature enable decision. Auto-CMD23 shoud be enabled if host is >= v3, and SDMA is not in use.

USE_ADMA | USE_SDMA | Auto-CMD23
---------+----------+-----------

    0    |    0     |     1
---------+----------+-----------
    0    |    1     |     0
---------+----------+-----------
    1    |    0     |     1
---------+----------+-----------
    1    |    1     |     1
Quoted 1 line

Great, this does the right thing on my XO now. I'll send it to Linus along with the rest of the merge shortly.

Thanks!

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#4 lore raw
Quoted 16 lines · Chris Ball

Hi,

Quoted 13 lines · Andrei Warkentin

Fixes bugs in Auto-CMD23 feature enable decision. Auto-CMD23 shoud be enabled if host is >= v3, and SDMA is not in use.

USE_ADMA | USE_SDMA | Auto-CMD23
---------+----------+-----------
    0    |    0     |     1
---------+----------+-----------
    0    |    1     |     0
---------+----------+-----------
    1    |    0     |     1
---------+----------+-----------
    1    |    1     |     1

Quoted 7 lines
Quoted 1 line

Great, this does the right thing on my XO now.  I'll send it to Linus along with the rest of the merge shortly.

Thanks!

Great :-)! Thanks!

A