Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Remove MMC_CAP2_HC_ERASE_SZ

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>

+3 -14
+2 -6
drivers/mmc/core/mmc.c
··· 1651 1651 mmc_set_erase_size(card); 1652 1652 } 1653 1653 1654 - /* 1655 - * If enhanced_area_en is TRUE, host needs to enable ERASE_GRP_DEF 1656 - * bit. This bit will be lost every time after a reset or power off. 1657 - */ 1658 - if (card->ext_csd.partition_setting_completed || 1659 - (card->ext_csd.rev >= 3 && (host->caps2 & MMC_CAP2_HC_ERASE_SZ))) { 1654 + /* Enable ERASE_GRP_DEF. This bit is lost after a reset or power off. */ 1655 + if (card->ext_csd.rev >= 3) { 1660 1656 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 1661 1657 EXT_CSD_ERASE_GROUP_DEF, 1, 1662 1658 card->ext_csd.generic_cmd6_time);
-1
drivers/mmc/host/sdhci-acpi.c
··· 274 274 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | 275 275 MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR | 276 276 MMC_CAP_CMD_DURING_TFR | MMC_CAP_WAIT_WHILE_BUSY, 277 - .caps2 = MMC_CAP2_HC_ERASE_SZ, 278 277 .flags = SDHCI_ACPI_RUNTIME_PM, 279 278 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, 280 279 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
-3
drivers/mmc/host/sdhci-brcmstb.c
··· 89 89 goto err_clk; 90 90 } 91 91 92 - /* Enable MMC_CAP2_HC_ERASE_SZ for better max discard calculations */ 93 - host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ; 94 - 95 92 sdhci_get_of_property(pdev); 96 93 mmc_of_parse(host->mmc); 97 94
+1 -3
drivers/mmc/host/sdhci-pci-core.c
··· 347 347 static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot) 348 348 { 349 349 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE; 350 - slot->host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC | 351 - MMC_CAP2_HC_ERASE_SZ; 350 + slot->host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC; 352 351 return 0; 353 352 } 354 353 ··· 586 587 MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR | 587 588 MMC_CAP_CMD_DURING_TFR | 588 589 MMC_CAP_WAIT_WHILE_BUSY; 589 - slot->host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ; 590 590 slot->hw_reset = sdhci_pci_int_hw_reset; 591 591 if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BSW_EMMC) 592 592 slot->host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
-1
include/linux/mmc/host.h
··· 287 287 #define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */ 288 288 #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 289 289 MMC_CAP2_HS200_1_2V_SDR) 290 - #define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ 291 290 #define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 292 291 #define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 293 292 #define MMC_CAP2_PACKED_RD (1 << 12) /* Allow packed read */