aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2009-09-22 16:45:07 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 07:39:36 -0700
commit006ebd5de13854d6250eecc76866bbfad1ff7daf (patch)
tree49cf0715227e1da36745bbb50b6b94f341db3986 /drivers/mmc
parent653f41b52dfc63fecf4a2333f13be28b159a918c (diff)
downloadkernel_samsung_tuna-006ebd5de13854d6250eecc76866bbfad1ff7daf.zip
kernel_samsung_tuna-006ebd5de13854d6250eecc76866bbfad1ff7daf.tar.gz
kernel_samsung_tuna-006ebd5de13854d6250eecc76866bbfad1ff7daf.tar.bz2
sdio: add CD disable support
Add support to disconnect the pull-up resistor on CD/DAT[3] (pin 1) of the card. This may be desired on certain setups of boards, controllers and embedded sdio devices which do not need the card's pull-up. As a result, card detection is disabled and power is saved. [akpm@linux-foundation.org: simplify sdio_disable_cd() a bit] Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Acked-by: Matt Fleming <matt@console-pimps.org> Cc: Ian Molton <ian@mnementh.co.uk> Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com> Cc: Philip Langdale <philipl@overt.org> Cc: Pierre Ossman <pierre@ossman.eu> Cc: David Vrabel <david.vrabel@csr.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/sdio.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 6f221dc..2d24a12 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)
}
/*
+ * If desired, disconnect the pull-up resistor on CD/DAT[3] (pin 1)
+ * of the card. This may be required on certain setups of boards,
+ * controllers and embedded sdio device which do not need the card's
+ * pull-up. As a result, card detection is disabled and power is saved.
+ */
+static int sdio_disable_cd(struct mmc_card *card)
+{
+ int ret;
+ u8 ctrl;
+
+ if (!card->cccr.disable_cd)
+ return 0;
+
+ ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_IF, 0, &ctrl);
+ if (ret)
+ return ret;
+
+ ctrl |= SDIO_BUS_CD_DISABLE;
+
+ return mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
+}
+
+/*
* Test if the card supports high-speed mode and, if so, switch to it.
*/
static int sdio_enable_hs(struct mmc_card *card)
@@ -385,6 +408,13 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
goto remove;
/*
+ * If needed, disconnect card detection pull-up resistor.
+ */
+ err = sdio_disable_cd(card);
+ if (err)
+ goto remove;
+
+ /*
* Initialize (but don't add) all present functions.
*/
for (i = 0;i < funcs;i++) {