sdhci: handle bug in JMB38x for sizes < 4 bytes
authorPierre Ossman <drzeus@drzeus.cx>
Mon, 28 Jul 2008 22:11:16 +0000 (00:11 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Fri, 1 Aug 2008 17:03:35 +0000 (19:03 +0200)
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/host/sdhci-pci.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h

index deb607c52c0d8ebbee60751e7a120692a22ddd9f..fcb14c2346ccd186f0aef38b96f6405bb1380dc1 100644 (file)
@@ -143,7 +143,8 @@ static int jmicron_probe(struct sdhci_pci_chip *chip)
                chip->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR |
                          SDHCI_QUIRK_32BIT_DMA_SIZE |
                          SDHCI_QUIRK_32BIT_ADMA_SIZE |
-                         SDHCI_QUIRK_RESET_AFTER_REQUEST;
+                         SDHCI_QUIRK_RESET_AFTER_REQUEST |
+                         SDHCI_QUIRK_BROKEN_SMALL_PIO;
        }
 
        /*
index 5f95e10229b5f64cf55e79e8930b2c69d4f9181f..be09739f692d1675f04ecd274345d240ce1c0810 100644 (file)
@@ -278,6 +278,15 @@ static void sdhci_transfer_pio(struct sdhci_host *host)
        else
                mask = SDHCI_SPACE_AVAILABLE;
 
+       /*
+        * Some controllers (JMicron JMB38x) mess up the buffer bits
+        * for transfers < 4 bytes. As long as it is just one block,
+        * we can ignore the bits.
+        */
+       if ((host->quirks & SDHCI_QUIRK_BROKEN_SMALL_PIO) &&
+               (host->data->blocks == 1))
+               mask = ~0;
+
        while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) {
                if (host->data->flags & MMC_DATA_READ)
                        sdhci_read_block_pio(host);
index e354faee5df00ad0a0396992e8945ca626fb4e9e..197d4a05f4ae975ecf1fe600adcf9ec2ce79fbb5 100644 (file)
@@ -206,6 +206,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER            (1<<11)
 /* Controller provides an incorrect timeout value for transfers */
 #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL                 (1<<12)
+/* Controller has an issue with buffer bits for small transfers */
+#define SDHCI_QUIRK_BROKEN_SMALL_PIO                   (1<<13)
 
        int                     irq;            /* Device IRQ */
        void __iomem *          ioaddr;         /* Mapped address */