mmc: core: Remove MMC_CAP2_HC_ERASE_SZ
authorUlf Hansson <ulf.hansson@linaro.org>
Thu, 8 Jun 2017 13:23:08 +0000 (15:23 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 20 Jun 2017 08:30:48 +0000 (10:30 +0200)
The MMC_CAP2_HC_ERASE_SZ is used only by a few mmc host drivers. Its intent
is to enable eMMC's high-capacity erase size, as to improve the behaviour
of the erase operations.

We should strive to avoid software configuration options that aren't
necessary, but instead deploy common behaviours. For these reasons, let's
remove the capability bit for MMC_CAP2_HC_ERASE_SZ and make it the default
behaviour.

Note that this change doesn't affect eMMCs supporting trim/discard, because
these commands operates on sectors and takes precedence over erase
commands.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
drivers/mmc/core/mmc.c
drivers/mmc/host/sdhci-acpi.c
drivers/mmc/host/sdhci-brcmstb.c
drivers/mmc/host/sdhci-pci-core.c
include/linux/mmc/host.h

index e504b66bd41c8675107e0c69f7ae7b50e47e5ee3..4ffea14b7eb645d92a91d62907d64c97cf8a9998 100644 (file)
@@ -1651,12 +1651,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
                mmc_set_erase_size(card);
        }
 
-       /*
-        * If enhanced_area_en is TRUE, host needs to enable ERASE_GRP_DEF
-        * bit.  This bit will be lost every time after a reset or power off.
-        */
-       if (card->ext_csd.partition_setting_completed ||
-           (card->ext_csd.rev >= 3 && (host->caps2 & MMC_CAP2_HC_ERASE_SZ))) {
+       /* Enable ERASE_GRP_DEF. This bit is lost after a reset or power off. */
+       if (card->ext_csd.rev >= 3) {
                err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
                                 EXT_CSD_ERASE_GROUP_DEF, 1,
                                 card->ext_csd.generic_cmd6_time);
index 89d9a8c014f5bd83e803d0ce87c441667a7b7a98..cf66a3db71b815f934bf295d54c24e15aec9e19c 100644 (file)
@@ -274,7 +274,6 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = {
        .caps    = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
                   MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR |
                   MMC_CAP_CMD_DURING_TFR | MMC_CAP_WAIT_WHILE_BUSY,
-       .caps2   = MMC_CAP2_HC_ERASE_SZ,
        .flags   = SDHCI_ACPI_RUNTIME_PM,
        .quirks  = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
        .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
index 242c5dc7a81eadf565ba659b1a118b80fd8fb7ca..e2f638338e8fe0476a7a69404fb9341f493985da 100644 (file)
@@ -89,9 +89,6 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
                goto err_clk;
        }
 
-       /* Enable MMC_CAP2_HC_ERASE_SZ for better max discard calculations */
-       host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
-
        sdhci_get_of_property(pdev);
        mmc_of_parse(host->mmc);
 
index 8fa84a013be4f835e74982e827a89e1729a0b0a6..227a5cb4b3bf89acf8052f7d4202da9bb708d0b6 100644 (file)
@@ -347,8 +347,7 @@ static inline void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
 static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot)
 {
        slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE;
-       slot->host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC |
-                                 MMC_CAP2_HC_ERASE_SZ;
+       slot->host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC;
        return 0;
 }
 
@@ -587,7 +586,6 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
                                 MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR |
                                 MMC_CAP_CMD_DURING_TFR |
                                 MMC_CAP_WAIT_WHILE_BUSY;
-       slot->host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
        slot->hw_reset = sdhci_pci_int_hw_reset;
        if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BSW_EMMC)
                slot->host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
index 9209f95a510678af5bd3871908d850b72465ef7a..c81380a2181fb3c5838d4331b4a6db5ab5d4fffc 100644 (file)
@@ -287,7 +287,6 @@ struct mmc_host {
 #define MMC_CAP2_HS200_1_2V_SDR        (1 << 6)        /* can support */
 #define MMC_CAP2_HS200         (MMC_CAP2_HS200_1_8V_SDR | \
                                 MMC_CAP2_HS200_1_2V_SDR)
-#define MMC_CAP2_HC_ERASE_SZ   (1 << 9)        /* High-capacity erase size */
 #define MMC_CAP2_CD_ACTIVE_HIGH        (1 << 10)       /* Card-detect signal active high */
 #define MMC_CAP2_RO_ACTIVE_HIGH        (1 << 11)       /* Write-protect signal active high */
 #define MMC_CAP2_PACKED_RD     (1 << 12)       /* Allow packed read */