On 12 June 2017 at 11:26, Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote: > On 12/06/17 11:49, Ulf Hansson wrote: >> 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. >> >> However, for eMMCs supporting trim/discard, the MMC_CAP2_HC_ERASE_SZ >> becomes somewhat redundant. This because trim/discard operates on sectors >> and these commands takes precedence over erase commands, when supported. >> >> In addition, we should really avoid software configuration options that >> isn't necessary, but instead strive to deploy common behaviours. For these >> reasons, let's remove the capability bit for MMC_CAP2_HC_ERASE_SZ and the >> corresponding behaviour. >> >> Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx> >> --- >> drivers/mmc/core/mmc.c | 3 +-- >> drivers/mmc/host/sdhci-acpi.c | 1 - >> drivers/mmc/host/sdhci-brcmstb.c | 3 --- >> drivers/mmc/host/sdhci-pci-core.c | 4 +--- >> include/linux/mmc/host.h | 1 - >> 5 files changed, 2 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c >> index e504b66..d1a6d74 100644 >> --- a/drivers/mmc/core/mmc.c >> +++ b/drivers/mmc/core/mmc.c >> @@ -1655,8 +1655,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, >> * 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))) { >> + if (card->ext_csd.partition_setting_completed) { > > PARTITION_SETTING_COMPLETED was added in eMMC v4.4 but ERASE_GROUP_DEF was > added in eMMC v4.3, so this doesn't work for v4.3 devices. > > Why not enable it always? i.e. > > if (card->ext_csd.rev >= 3) { Yes, that makes sense! Thanks for spotting this! However, that actually means this didn't work as expected for hosts that didn't specify MMC_CAP2_HC_ERASE_SZ. [...] Kind regards Uffe -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html