mmc: sdhci: add quirk for max len ADMA descriptors
authorOlof Johansson <olof@lixom.net>
Sun, 2 Jan 2011 00:37:32 +0000 (18:37 -0600)
committerChris Ball <cjb@laptop.org>
Sun, 9 Jan 2011 04:52:23 +0000 (23:52 -0500)
Some controllers misparse segment length 0 as being 0, not 65536. Add
a quirk to deal with it.

Signed-off-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/sdhci.c
include/linux/mmc/sdhci.h

index d5febe584b050c2b36d23e31c178f3a6860effab..9e15f41f87be8f4a79bd61b94ace660942512eb6 100644 (file)
@@ -1949,10 +1949,14 @@ int sdhci_add_host(struct sdhci_host *host)
         * of bytes. When doing hardware scatter/gather, each entry cannot
         * be larger than 64 KiB though.
         */
-       if (host->flags & SDHCI_USE_ADMA)
-               mmc->max_seg_size = 65536;
-       else
+       if (host->flags & SDHCI_USE_ADMA) {
+               if (host->quirks & SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC)
+                       mmc->max_seg_size = 65535;
+               else
+                       mmc->max_seg_size = 65536;
+       } else {
                mmc->max_seg_size = mmc->max_req_size;
+       }
 
        /*
         * Maximum block size. This varies from controller to controller and
index 0d953f513d81464b7da8821e29b90c1aed56e53e..83bd9f76709aa90b32ad76a175a408bf7725b468 100644 (file)
@@ -83,6 +83,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12             (1<<28)
 /* Controller doesn't have HISPD bit field in HI-SPEED SD card */
 #define SDHCI_QUIRK_NO_HISPD_BIT                       (1<<29)
+/* Controller treats ADMA descriptors with length 0000h incorrectly */
+#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC           (1<<30)
 
        int irq;                /* Device IRQ */
        void __iomem *ioaddr;   /* Mapped address */