]> err.no Git - linux-2.6/blobdiff - drivers/mmc/host/sdhci-pci.c
sdhci: handle bug in JMB38x for sizes < 4 bytes
[linux-2.6] / drivers / mmc / host / sdhci-pci.c
index 8554466e0f4e3200620313fd3f9d72a64544a3ac..fcb14c2346ccd186f0aef38b96f6405bb1380dc1 100644 (file)
@@ -91,6 +91,7 @@ static int ricoh_probe(struct sdhci_pci_chip *chip)
 
 static const struct sdhci_pci_fixes sdhci_ricoh = {
        .probe          = ricoh_probe,
+       .quirks         = SDHCI_QUIRK_32BIT_DMA_ADDR,
 };
 
 static const struct sdhci_pci_fixes sdhci_ene_712 = {
@@ -138,6 +139,14 @@ static int jmicron_probe(struct sdhci_pci_chip *chip)
 {
        int ret;
 
+       if (chip->pdev->revision == 0) {
+               chip->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR |
+                         SDHCI_QUIRK_32BIT_DMA_SIZE |
+                         SDHCI_QUIRK_32BIT_ADMA_SIZE |
+                         SDHCI_QUIRK_RESET_AFTER_REQUEST |
+                         SDHCI_QUIRK_BROKEN_SMALL_PIO;
+       }
+
        /*
         * JMicron chips can have two interfaces to the same hardware
         * in order to work around limitations in Microsoft's driver.
@@ -199,6 +208,22 @@ static void jmicron_enable_mmc(struct sdhci_host *host, int on)
 
 static int jmicron_probe_slot(struct sdhci_pci_slot *slot)
 {
+       if (slot->chip->pdev->revision == 0) {
+               u16 version;
+
+               version = readl(slot->host->ioaddr + SDHCI_HOST_VERSION);
+               version = (version & SDHCI_VENDOR_VER_MASK) >>
+                       SDHCI_VENDOR_VER_SHIFT;
+
+               /*
+                * Older versions of the chip have lots of nasty glitches
+                * in the ADMA engine. It's best just to avoid it
+                * completely.
+                */
+               if (version < 0xAC)
+                       slot->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA;
+       }
+
        /*
         * The secondary interface requires a bit set to get the
         * interrupts.
@@ -249,10 +274,6 @@ static int jmicron_resume(struct sdhci_pci_chip *chip)
 }
 
 static const struct sdhci_pci_fixes sdhci_jmicron = {
-       .quirks         = SDHCI_QUIRK_32BIT_DMA_ADDR |
-                         SDHCI_QUIRK_32BIT_DMA_SIZE |
-                         SDHCI_QUIRK_RESET_AFTER_REQUEST,
-
        .probe          = jmicron_probe,
 
        .probe_slot     = jmicron_probe_slot,