]> Pileus Git - ~andy/linux/commitdiff
mmc: core: Set correct bus mode before card init
authorStefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
Thu, 15 Sep 2011 15:50:38 +0000 (17:50 +0200)
committerChris Ball <cjb@laptop.org>
Wed, 26 Oct 2011 20:32:03 +0000 (16:32 -0400)
Earlier all cards where initiated with bus mode set as OPENDRAIN, and then
later switched to PUSHPULL. According to the MMC/SD/SDIO specifications
only MMC cards use OPENDRAIN during init. For both SD and SDIO the bus
mode shall be PUSHPULL before attempting to init the card.

The consequence of having incorrect bus mode can lead to not being able
to detect the card. Therefore the default behavior have now been changed
to PUSHPULL in mmc_power_up, and will only be temporarily switched when
trying to attach or init a MMC card.

Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
Signed-off-by: Ulf HANSSON <ulf.hansson@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/core.c
drivers/mmc/core/mmc.c
drivers/mmc/core/sd.c
drivers/mmc/core/sdio.c

index 5ae6b159dbea1af4c327402d33e86e7c95ff400d..45ea968e7dd1df17615a75b9c21c324564058254 100644 (file)
@@ -1160,13 +1160,11 @@ static void mmc_power_up(struct mmc_host *host)
                bit = fls(host->ocr_avail) - 1;
 
        host->ios.vdd = bit;
-       if (mmc_host_is_spi(host)) {
+       if (mmc_host_is_spi(host))
                host->ios.chip_select = MMC_CS_HIGH;
-               host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
-       } else {
+       else
                host->ios.chip_select = MMC_CS_DONTCARE;
-               host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
-       }
+       host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
        host->ios.power_mode = MMC_POWER_UP;
        host->ios.bus_width = MMC_BUS_WIDTH_1;
        host->ios.timing = MMC_TIMING_LEGACY;
index 3b7c069a4ea6e2e8be6edbacc8f15f0a1a76c26d..b74e6f14b3ace62198beb682f1dacd38537ab6ee 100644 (file)
@@ -548,6 +548,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
        BUG_ON(!host);
        WARN_ON(!host->claimed);
 
+       /* Set correct bus mode for MMC before attempting init */
+       if (!mmc_host_is_spi(host))
+               mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN);
+
        /*
         * Since we're changing the OCR value, we seem to
         * need to tell some cards to go back to the idle
@@ -1022,6 +1026,10 @@ int mmc_attach_mmc(struct mmc_host *host)
        BUG_ON(!host);
        WARN_ON(!host->claimed);
 
+       /* Set correct bus mode for MMC before attempting attach */
+       if (!mmc_host_is_spi(host))
+               mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN);
+
        err = mmc_send_op_cond(host, 0, &ocr);
        if (err)
                return err;
index 4c281a4bf0589d6f8393f16e38e341bc31ffd45d..342b18c4afcb02cbcbd2cfed5257d99fe39699c0 100644 (file)
@@ -929,8 +929,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
                err = mmc_send_relative_addr(host, &card->rca);
                if (err)
                        return err;
-
-               mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
        }
 
        if (!oldcard) {
index ac492ac974e16458bec3dfce48cc858357b8dbea..698d813cff3b31d279b0e18f175485a5995ab79a 100644 (file)
@@ -408,8 +408,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
                 */
                if (oldcard)
                        oldcard->rca = card->rca;
-
-               mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
        }
 
        /*