aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/core/sdio.c30
-rw-r--r--include/linux/mmc/card.h3
2 files changed, 32 insertions, 1 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 6f221dc029ad..2d24a123f0b0 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -165,6 +165,29 @@ static int sdio_enable_wide(struct mmc_card *card)
165} 165}
166 166
167/* 167/*
168 * If desired, disconnect the pull-up resistor on CD/DAT[3] (pin 1)
169 * of the card. This may be required on certain setups of boards,
170 * controllers and embedded sdio device which do not need the card's
171 * pull-up. As a result, card detection is disabled and power is saved.
172 */
173static int sdio_disable_cd(struct mmc_card *card)
174{
175 int ret;
176 u8 ctrl;
177
178 if (!card->cccr.disable_cd)
179 return 0;
180
181 ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_IF, 0, &ctrl);
182 if (ret)
183 return ret;
184
185 ctrl |= SDIO_BUS_CD_DISABLE;
186
187 return mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
188}
189
190/*
168 * Test if the card supports high-speed mode and, if so, switch to it. 191 * Test if the card supports high-speed mode and, if so, switch to it.
169 */ 192 */
170static int sdio_enable_hs(struct mmc_card *card) 193static int sdio_enable_hs(struct mmc_card *card)
@@ -385,6 +408,13 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
385 goto remove; 408 goto remove;
386 409
387 /* 410 /*
411 * If needed, disconnect card detection pull-up resistor.
412 */
413 err = sdio_disable_cd(card);
414 if (err)
415 goto remove;
416
417 /*
388 * Initialize (but don't add) all present functions. 418 * Initialize (but don't add) all present functions.
389 */ 419 */
390 for (i = 0;i < funcs;i++) { 420 for (i = 0;i < funcs;i++) {
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 58f59174c64b..00db39cceadc 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -64,7 +64,8 @@ struct sdio_cccr {
64 low_speed:1, 64 low_speed:1,
65 wide_bus:1, 65 wide_bus:1,
66 high_power:1, 66 high_power:1,
67 high_speed:1; 67 high_speed:1,
68 disable_cd:1;
68}; 69};
69 70
70struct sdio_cis { 71struct sdio_cis {