Skip to content

Commit

Permalink
mmc: do not switch to 1-bit mode if not required
Browse files Browse the repository at this point in the history
6b5eda3 followed SDIO spec part E1 section 8, which states that
in case SDIO interrupts are being used to wake up a suspended host,
then it is required to switch to 1-bit mode before stopping the clock.

Before switching to 1-bit mode (or back to 4-bit mode on resume),
make sure that SDIO interrupts are really being used to wake the host.

This is helpful for devices which have an external irq line (e.g.
wl1271), and do not use SDIO interrupts to wake up the host.

In this case, switching to 1-bit mode (and back to 4-bit mode on resume)
is not necessary.

Reported-by: Eliad Peller <[email protected]>
Signed-off-by: Ohad Ben-Cohen <[email protected]>
Signed-off-by: Chris Ball <[email protected]>
ohadbc authored and cjb committed May 25, 2011
1 parent a5e9425 commit 6b93d01
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mmc/core/sdio.c
Original file line number Diff line number Diff line change
@@ -625,7 +625,7 @@ static int mmc_sdio_suspend(struct mmc_host *host)
}
}

if (!err && mmc_card_keep_power(host)) {
if (!err && mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) {
mmc_claim_host(host);
sdio_disable_wide(host->card);
mmc_release_host(host);
@@ -648,7 +648,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
if (mmc_card_is_removable(host) || !mmc_card_keep_power(host))
err = mmc_sdio_init_card(host, host->ocr, host->card,
mmc_card_keep_power(host));
else if (mmc_card_keep_power(host)) {
else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) {
/* We may have switched to 1-bit mode during suspend */
err = sdio_enable_4bit_bus(host->card);
if (err > 0) {
4 changes: 4 additions & 0 deletions include/linux/mmc/host.h
Original file line number Diff line number Diff line change
@@ -325,5 +325,9 @@ static inline int mmc_card_keep_power(struct mmc_host *host)
return host->pm_flags & MMC_PM_KEEP_POWER;
}

static inline int mmc_card_wake_sdio_irq(struct mmc_host *host)
{
return host->pm_flags & MMC_PM_WAKE_SDIO_IRQ;
}
#endif

0 comments on commit 6b93d01

Please sign in to comment.