]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
sdhci: Add quirk for forcing maximum block size to 2048 bytes
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Mon, 16 Mar 2009 21:14:03 +0000 (00:14 +0300)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 24 Mar 2009 20:30:10 +0000 (21:30 +0100)
FSL eSDHC controllers can support maximum block size up to 4096 bytes,
the MBL (Maximum Block Length) field in the capabilities register
extended by one bit, and is set to 0x3.

But the SDHCI core doesn't support blocks of 4096 bytes, and thus
forces blksz to the lowest value -- 512 bytes. With this patch we can
pin up the blksz to the maximum supported block size, i.e. 2048 bytes.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h

index 3a72fe2cf1cf0d11a58d50a15a803554315cbd49..30d8e3d4e6fdbc727605aa3f99563980c38940dd 100644 (file)
@@ -1777,13 +1777,19 @@ int sdhci_add_host(struct sdhci_host *host)
         * Maximum block size. This varies from controller to controller and
         * is specified in the capabilities register.
         */
-       mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT;
-       if (mmc->max_blk_size >= 3) {
-               printk(KERN_WARNING "%s: Invalid maximum block size, "
-                       "assuming 512 bytes\n", mmc_hostname(mmc));
-               mmc->max_blk_size = 512;
-       } else
-               mmc->max_blk_size = 512 << mmc->max_blk_size;
+       if (host->quirks & SDHCI_QUIRK_FORCE_BLK_SZ_2048) {
+               mmc->max_blk_size = 2;
+       } else {
+               mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >>
+                               SDHCI_MAX_BLOCK_SHIFT;
+               if (mmc->max_blk_size >= 3) {
+                       printk(KERN_WARNING "%s: Invalid maximum block size, "
+                               "assuming 512 bytes\n", mmc_hostname(mmc));
+                       mmc->max_blk_size = 0;
+               }
+       }
+
+       mmc->max_blk_size = 512 << mmc->max_blk_size;
 
        /*
         * Maximum block count.
index 2962102b6953f6451a9e23089d6628aa35463da7..f20a834f430925827d9b8490ab481f058ff97696 100644 (file)
@@ -224,6 +224,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK_PIO_NEEDS_DELAY                    (1<<18)
 /* Controller losing signal/interrupt enable states after reset */
 #define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET           (1<<19)
+/* Controller has to be forced to use block size of 2048 bytes */
+#define SDHCI_QUIRK_FORCE_BLK_SZ_2048                  (1<<20)
 
        int                     irq;            /* Device IRQ */
        void __iomem *          ioaddr;         /* Mapped address */