diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2010-11-28 00:21:29 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-01-08 22:48:17 -0500 |
commit | 080bc9774b6f1e3866747b18631bad26f47c22ce (patch) | |
tree | 07ac4d1539b75036083d8b3c499e213fcca09cc4 | |
parent | e594573d790bd7e269f05955d316b88f7be0c14a (diff) |
mmc: sdio: don't reinitialize nonremovable powered-resumed cards
Upon system resume, SDIO core must reinitialize cards that were
powered off during suspend.
If the card had its power kept during suspend (and thus it is
'powered-resumed'), SDIO core performs only a limited reinitializing,
mainly needed to make sure that the card wasn't removed/replaced.
If a __nonremovable__ card is powered-resumed, we can safely skip the
reinitializing phase.
Note: 9b966aa (mmc: sdio: fully reconfigure oldcard on resume) removed
the bus width reconfiguration since mmc_sdio_init_card already does it.
It is brought back now in case mmc_sdio_init_card is skipped.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r-- | drivers/mmc/core/sdio.c | 16 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 5 |
2 files changed, 19 insertions, 2 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index c18810ab6465..82f4b9008987 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
@@ -627,15 +627,27 @@ static int mmc_sdio_suspend(struct mmc_host *host) | |||
627 | 627 | ||
628 | static int mmc_sdio_resume(struct mmc_host *host) | 628 | static int mmc_sdio_resume(struct mmc_host *host) |
629 | { | 629 | { |
630 | int i, err; | 630 | int i, err = 0; |
631 | 631 | ||
632 | BUG_ON(!host); | 632 | BUG_ON(!host); |
633 | BUG_ON(!host->card); | 633 | BUG_ON(!host->card); |
634 | 634 | ||
635 | /* Basic card reinitialization. */ | 635 | /* Basic card reinitialization. */ |
636 | mmc_claim_host(host); | 636 | mmc_claim_host(host); |
637 | err = mmc_sdio_init_card(host, host->ocr, host->card, | 637 | |
638 | /* No need to reinitialize powered-resumed nonremovable cards */ | ||
639 | if (mmc_card_is_removable(host) || !mmc_card_is_powered_resumed(host)) | ||
640 | err = mmc_sdio_init_card(host, host->ocr, host->card, | ||
638 | (host->pm_flags & MMC_PM_KEEP_POWER)); | 641 | (host->pm_flags & MMC_PM_KEEP_POWER)); |
642 | else if (mmc_card_is_powered_resumed(host)) { | ||
643 | /* We may have switched to 1-bit mode during suspend */ | ||
644 | err = sdio_enable_4bit_bus(host->card); | ||
645 | if (err > 0) { | ||
646 | mmc_set_bus_width(host, MMC_BUS_WIDTH_4); | ||
647 | err = 0; | ||
648 | } | ||
649 | } | ||
650 | |||
639 | if (!err && host->sdio_irqs) | 651 | if (!err && host->sdio_irqs) |
640 | mmc_signal_sdio_irq(host); | 652 | mmc_signal_sdio_irq(host); |
641 | mmc_release_host(host); | 653 | mmc_release_host(host); |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4a9d9d2589c7..3a85e73a38a9 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -320,5 +320,10 @@ static inline int mmc_card_is_removable(struct mmc_host *host) | |||
320 | return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable; | 320 | return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable; |
321 | } | 321 | } |
322 | 322 | ||
323 | static inline int mmc_card_is_powered_resumed(struct mmc_host *host) | ||
324 | { | ||
325 | return host->pm_flags & MMC_PM_KEEP_POWER; | ||
326 | } | ||
327 | |||
323 | #endif | 328 | #endif |
324 | 329 | ||