mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-10 11:30:08 +01:00
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. [[email protected]: simplify sdio_disable_cd() a bit] Signed-off-by: Ohad Ben-Cohen <[email protected]> Acked-by: Matt Fleming <[email protected]> Cc: Ian Molton <[email protected]> Cc: "Roberto A. Foglietta" <[email protected]> Cc: Philip Langdale <[email protected]> Cc: Pierre Ossman <[email protected]> Cc: David Vrabel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
653f41b52d
commit
006ebd5de1
2 files changed
+32
-1
No files matched your search
@@ -164,6 +164,29 @@ static int sdio_enable_wide(struct mmc_card *card)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
@@ -384,6 +407,13 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
|
||||
if (err)
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -64,7 +64,8 @@ struct sdio_cccr {
|
||||
low_speed:1,
|
||||
wide_bus:1,
|
||||
high_power:1,
|
||||
high_speed:1;
|
||||
high_speed:1,
|
||||
disable_cd:1;
|
||||
};
|
||||
|
||||
struct sdio_cis {
|
||||
|
||||
Reference in new issue
Block a user