mmc: Add 8-bit bus width support
authorJarkko Lavinen <jarkko.lavinen@nokia.com>
Mon, 17 Nov 2008 12:35:21 +0000 (14:35 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Wed, 31 Dec 2008 17:18:12 +0000 (18:18 +0100)
Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/core/mmc.c
include/linux/mmc/host.h

index fdd7c76..c232d11 100644 (file)
@@ -434,13 +434,24 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
         * Activate wide bus (if supported).
         */
        if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
-               (host->caps & MMC_CAP_4_BIT_DATA)) {
+           (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
+               unsigned ext_csd_bit, bus_width;
+
+               if (host->caps & MMC_CAP_8_BIT_DATA) {
+                       ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
+                       bus_width = MMC_BUS_WIDTH_8;
+               } else {
+                       ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
+                       bus_width = MMC_BUS_WIDTH_4;
+               }
+
                err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
-                       EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4);
+                                EXT_CSD_BUS_WIDTH, ext_csd_bit);
+
                if (err)
                        goto free_card;
 
-               mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
+               mmc_set_bus_width(card->host, bus_width);
        }
 
        if (!oldcard)
@@ -624,4 +635,3 @@ err:
 
        return err;
 }
-
index f842f23..4e45725 100644 (file)
@@ -41,6 +41,7 @@ struct mmc_ios {
 
 #define MMC_BUS_WIDTH_1                0
 #define MMC_BUS_WIDTH_4                2
+#define MMC_BUS_WIDTH_8                3
 
        unsigned char   timing;                 /* timing specification used */
 
@@ -116,6 +117,7 @@ struct mmc_host {
 #define MMC_CAP_SDIO_IRQ       (1 << 3)        /* Can signal pending SDIO IRQs */
 #define MMC_CAP_SPI            (1 << 4)        /* Talks only SPI protocols */
 #define MMC_CAP_NEEDS_POLL     (1 << 5)        /* Needs polling for card-detection */
+#define MMC_CAP_8_BIT_DATA     (1 << 6)        /* Can the host do 8 bit transfers */
 
        /* host specific block data */
        unsigned int            max_seg_size;   /* see blk_queue_max_segment_size */