From 14bb9249c188f9f0b85b1840f6e7912399a88658 Mon Sep 17 00:00:00 2001 From: Ziyan Date: Sun, 1 May 2016 13:04:39 +0200 Subject: [PATCH] mmc: sync with the new kernel --- drivers/mmc/core/core.c | 26 ++++---------------------- drivers/mmc/core/mmc.c | 4 ++++ include/linux/mmc/card.h | 3 ++- include/linux/mmc/core.h | 1 - 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index b5e67be7077e..d8d34091510b 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1576,9 +1576,9 @@ EXPORT_SYMBOL(mmc_can_trim); int mmc_can_discard(struct mmc_card *card) { /* - * As there's no way to detect the discard support bit at v4.5 - * use the s/w feature support filed. - */ + * As there's no way to detect the discard support bit at v4.5 + * use the s/w feature support filed. + */ if (card->ext_csd.feature_support & MMC_DISCARD_FEATURE) return 1; return 0; @@ -1701,12 +1701,6 @@ void mmc_rescan(struct work_struct *work) mmc_claim_host(host); for (i = 0; i < ARRAY_SIZE(freqs); i++) { - if (!mmc_rescan_try_freq(host, max(freqs[i], host->f_min))) { - extend_wakelock = true; - break; - } - /*retry again after power off/on if detection is failed*/ - mdelay(50); if (!mmc_rescan_try_freq(host, max(freqs[i], host->f_min))) { extend_wakelock = true; break; @@ -1896,9 +1890,6 @@ int mmc_suspend_host(struct mmc_host *host) if (!err && !mmc_card_keep_power(host)) mmc_power_off(host); - if (host->nesting_cnt < 0) - host->nesting_cnt = 0; - return err; } @@ -1961,7 +1952,6 @@ int mmc_pm_notify(struct notifier_block *notify_block, { struct mmc_host *host = container_of( notify_block, struct mmc_host, pm_notify); - struct omapsdcc_host *omaphost = mmc_priv(host); unsigned long flags; @@ -1988,10 +1978,6 @@ int mmc_pm_notify(struct notifier_block *notify_block, host->bus_ops->remove(host); mmc_detach_bus(host); - /* for BCM WIFI */ - if (host->card && omaphost) - printk(KERN_WARNING"%s(): WIFI SKIP MMC POWER OFF\n",__func__); - else mmc_power_off(host); mmc_release_host(host); host->pm_flags = 0; @@ -2008,11 +1994,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, } host->rescan_disable = 0; spin_unlock_irqrestore(&host->lock, flags); - /* for BCM WIFI */ - if (host->card && omaphost) - printk(KERN_WARNING"%s(): WIFI SKIP DETECT CHANGE\n",__func__); - else - mmc_detect_change(host, 0); + mmc_detect_change(host, 0); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 1320383c2753..87bb2647d048 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -407,6 +407,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) if (card->ext_csd.rev >= 5) card->ext_csd.rel_param = ext_csd[EXT_CSD_WR_REL_PARAM]; + /* eMMC v4.5 or later */ + if (card->ext_csd.rev >= 6) + card->ext_csd.feature_support |= MMC_DISCARD_FEATURE; + /* moviNAND VHX 4.41 device supports a discard*/ if (card->cid.movi_pnm == 0x47324741 || card->cid.movi_pnm == 0x47344741 || diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index b0e24f1105ce..c7ab3665b0cd 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -78,8 +78,9 @@ struct mmc_ext_csd { u8 raw_sec_feature_support;/* 231 */ u8 raw_trim_mult; /* 232 */ u8 raw_sectors[4]; /* 212 - 4 bytes */ + unsigned int feature_support; -#define MMC_DISCARD_FEATURE BIT(0) /* CMD38 feature */ +#define MMC_DISCARD_FEATURE BIT(0) /* CMD38 feature */ }; struct sd_scr { diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index eb2b680f05a8..5fa9f6e73c70 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -138,7 +138,6 @@ extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *); extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, struct mmc_command *, int); extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); -extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd); #define MMC_ERASE_ARG 0x00000000 #define MMC_SECURE_ERASE_ARG 0x80000000