aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/mmc.c
diff options
context:
space:
mode:
authorGirish K S <girish.shivananjappa@linaro.org>2011-10-13 02:34:16 -0400
committerChris Ball <cjb@laptop.org>2011-10-26 16:32:23 -0400
commitbec8726abc72bf30d2743a722aa37cd69e7a0580 (patch)
treeeed4a3c441ff64f5719b021fce419de0fc5196d9 /drivers/mmc/core/mmc.c
parent326adda53a50ece492c3edaa60afc26fba5e3232 (diff)
mmc: core: Add Power Off Notify Feature eMMC 4.5
This patch adds support for the power off notify feature, available in eMMC 4.5 devices. If the host has support for this feature, then the mmc core will notify the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value of 1 (POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. Signed-off-by: Girish K S <girish.shivananjappa@linaro.org> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core/mmc.c')
-rw-r--r--drivers/mmc/core/mmc.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 4e869d371a03..f8ea9387d75c 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -458,10 +458,12 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
458 else 458 else
459 card->erased_byte = 0x0; 459 card->erased_byte = 0x0;
460 460
461 if (card->ext_csd.rev >= 6) 461 if (card->ext_csd.rev >= 6) {
462 card->ext_csd.generic_cmd6_time = 10 * 462 card->ext_csd.generic_cmd6_time = 10 *
463 ext_csd[EXT_CSD_GENERIC_CMD6_TIME]; 463 ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
464 else 464 card->ext_csd.power_off_longtime = 10 *
465 ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
466 } else
465 card->ext_csd.generic_cmd6_time = 0; 467 card->ext_csd.generic_cmd6_time = 0;
466 468
467out: 469out:
@@ -846,6 +848,23 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
846 } 848 }
847 849
848 /* 850 /*
851 * If the host supports the power_off_notify capability then
852 * set the notification byte in the ext_csd register of device
853 */
854 if ((host->caps2 & MMC_CAP2_POWEROFF_NOTIFY) &&
855 (card->poweroff_notify_state == MMC_NO_POWER_NOTIFICATION)) {
856 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
857 EXT_CSD_POWER_OFF_NOTIFICATION,
858 EXT_CSD_POWER_ON,
859 card->ext_csd.generic_cmd6_time);
860 if (err && err != -EBADMSG)
861 goto free_card;
862 }
863
864 if (!err)
865 card->poweroff_notify_state = MMC_POWERED_ON;
866
867 /*
849 * Activate high speed (if supported) 868 * Activate high speed (if supported)
850 */ 869 */
851 if ((card->ext_csd.hs_max_dtr != 0) && 870 if ((card->ext_csd.hs_max_dtr != 0) &&