aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorStefan Nilsson XK <stefan.xk.nilsson@stericsson.com>2011-09-15 11:50:38 -0400
committerChris Ball <cjb@laptop.org>2011-10-26 16:32:03 -0400
commit44669034815a7ad263542ac605c581a10b22d146 (patch)
treee11820c9044f92a85d0efbb752f35673d92b20fc /drivers/mmc/core
parent9a0da648ff3a5020406ac7784eb3b519014f66f6 (diff)
mmc: core: Set correct bus mode before card init
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>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/core.c8
-rw-r--r--drivers/mmc/core/mmc.c8
-rw-r--r--drivers/mmc/core/sd.c2
-rw-r--r--drivers/mmc/core/sdio.c2
4 files changed, 11 insertions, 9 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 5ae6b159dbea..45ea968e7dd1 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1160,13 +1160,11 @@ static void mmc_power_up(struct mmc_host *host)
1160 bit = fls(host->ocr_avail) - 1; 1160 bit = fls(host->ocr_avail) - 1;
1161 1161
1162 host->ios.vdd = bit; 1162 host->ios.vdd = bit;
1163 if (mmc_host_is_spi(host)) { 1163 if (mmc_host_is_spi(host))
1164 host->ios.chip_select = MMC_CS_HIGH; 1164 host->ios.chip_select = MMC_CS_HIGH;
1165 host->ios.bus_mode = MMC_BUSMODE_PUSHPULL; 1165 else
1166 } else {
1167 host->ios.chip_select = MMC_CS_DONTCARE; 1166 host->ios.chip_select = MMC_CS_DONTCARE;
1168 host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; 1167 host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
1169 }
1170 host->ios.power_mode = MMC_POWER_UP; 1168 host->ios.power_mode = MMC_POWER_UP;
1171 host->ios.bus_width = MMC_BUS_WIDTH_1; 1169 host->ios.bus_width = MMC_BUS_WIDTH_1;
1172 host->ios.timing = MMC_TIMING_LEGACY; 1170 host->ios.timing = MMC_TIMING_LEGACY;
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 3b7c069a4ea6..b74e6f14b3ac 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -548,6 +548,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
548 BUG_ON(!host); 548 BUG_ON(!host);
549 WARN_ON(!host->claimed); 549 WARN_ON(!host->claimed);
550 550
551 /* Set correct bus mode for MMC before attempting init */
552 if (!mmc_host_is_spi(host))
553 mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN);
554
551 /* 555 /*
552 * Since we're changing the OCR value, we seem to 556 * Since we're changing the OCR value, we seem to
553 * need to tell some cards to go back to the idle 557 * need to tell some cards to go back to the idle
@@ -1022,6 +1026,10 @@ int mmc_attach_mmc(struct mmc_host *host)
1022 BUG_ON(!host); 1026 BUG_ON(!host);
1023 WARN_ON(!host->claimed); 1027 WARN_ON(!host->claimed);
1024 1028
1029 /* Set correct bus mode for MMC before attempting attach */
1030 if (!mmc_host_is_spi(host))
1031 mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN);
1032
1025 err = mmc_send_op_cond(host, 0, &ocr); 1033 err = mmc_send_op_cond(host, 0, &ocr);
1026 if (err) 1034 if (err)
1027 return err; 1035 return err;
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 4c281a4bf058..342b18c4afcb 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -929,8 +929,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
929 err = mmc_send_relative_addr(host, &card->rca); 929 err = mmc_send_relative_addr(host, &card->rca);
930 if (err) 930 if (err)
931 return err; 931 return err;
932
933 mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
934 } 932 }
935 933
936 if (!oldcard) { 934 if (!oldcard) {
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index ac492ac974e1..698d813cff3b 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -408,8 +408,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
408 */ 408 */
409 if (oldcard) 409 if (oldcard)
410 oldcard->rca = card->rca; 410 oldcard->rca = card->rca;
411
412 mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
413 } 411 }
414 412
415 /* 413 /*