mmc: host: sdhci: fix suspend/resume issue
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>
Sun, 24 Apr 2016 14:49:25 +0000 (16:49 +0200)
committerDominik Sliwa <dominik.sliwa@toradex.com>
Wed, 22 Jun 2016 13:29:34 +0000 (15:29 +0200)
This fixes the following eMMC suspend/resume issue as seen on
Colibri T30 1GB IT V1.1A:

[   75.479664] mmcblk0: error -110 transferring data, sector 287240, nr 2,
 cmd response 0x900, card status 0xc00
[   75.580923] end_request: I/O error, dev mmcblk0, sector 287240
[   75.586782] Buffer I/O error on device mmcblk0p2, logical block 123140
[   75.593313] lost page write due to I/O error on mmcblk0p2

(fixes an issue probably caused by a merge conflict introduced by
commit 7f7b042a978edfc6c7d1e14ec9c6ec01ffcc284b)

Signed-off-by: Mirza Krak <mirza.krak@hostmobility.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
drivers/mmc/host/sdhci.c

index 1aed27869b3c90bdc08f8f1b9ae8a15563bb5693..41b578299e6692ab8c60946e8feb73e4d8acd3a2 100644 (file)
@@ -2439,6 +2439,15 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
        }
 
        if (mmc->card) {
+               /*
+               * If eMMC cards are put in sleep state, Vccq can be disabled
+               * but Vcc would still be powered on. In resume, we only restore
+               * the controller context. So, set MMC_PM_KEEP_POWER flag.
+               */
+               if (mmc_card_can_sleep(mmc) &&
+                   !(mmc->caps & MMC_CAP2_NO_SLEEP_CMD))
+                       mmc->pm_flags = MMC_PM_KEEP_POWER;
+
                ret = mmc_suspend_host(host->mmc);
                if (ret)
                        goto err_suspend_host;