From patchwork Mon Jun 12 08:49:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103607 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp91771qgd; Mon, 12 Jun 2017 01:49:31 -0700 (PDT) X-Received: by 10.46.32.42 with SMTP id g42mr10770085ljg.20.1497257371749; Mon, 12 Jun 2017 01:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497257371; cv=none; d=google.com; s=arc-20160816; b=TLHO/ChgifnkuMlQm8t++edidNZU0eXnenP7N/zY4Emj+jj0KYOUCfsScAkIJni91s JtoeK1tRh2IAuSrfOc2MdbRX5nuPZ0eAxedGBtDClY+B861MvSR55911wZIBJi/tIst/ pOgJQ+h46atMn1BGH5T8rwdgWzAgWR7R0sNgO8L+XkrzhgGWgwA453Iu3Q7CW4qPRTHm C5iblEiVN0q6kxX4rvNOL7YzEGHIbnLZcTV16Gw2Obehmr902oPH5n26eF+slKvcJAEy QNkf9i7azTV4lgSLVAaDQjWQJ2wlrB0vomWXBt8SLc5lwelSSzrb2KU3hnKMBM8igR0N jUMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ANV7NyrP0qzxMRyoZtxSl3TNIq+AH8aqzDzpJeliM88=; b=EbDTw/jIUr0Zvbc2XCuQjngQ30QhQcjzcdESXuSt/r5edXOrWERdDg/D0UZDcBW5+W ZjMVZUQ3ZpVq81QAv5nDtZTK97qoR48FCNWT498aO4FK483z5K6AK0RHMeilT0t1hv7i S46SLhmfc3ka5RAW5QCvGufk0QBR9dQ1k6o9+Co4Z3hqkW8KFfJdhBFbcOQDvZSj4eP+ Afqp52lQ0e2InucqX3xnyPtN2gL9M9NtdexuX50e+MgXe48HQIMxGuzXc2qeitsKmNAl TyE0oyygvEd3tivA/eoJMW/MjcmZZZ7oUTM32WHtNF0GSJuGIpvaxwmuIJwNSjWvX/DD TSng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::230 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com. [2a00:1450:4010:c07::230]) by mx.google.com with ESMTPS id x23si4469393lfi.326.2017.06.12.01.49.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2017 01:49:31 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::230 as permitted sender) client-ip=2a00:1450:4010:c07::230; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::230 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x230.google.com with SMTP id p189so48132036lfe.2 for ; Mon, 12 Jun 2017 01:49:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ANV7NyrP0qzxMRyoZtxSl3TNIq+AH8aqzDzpJeliM88=; b=hZOOa78e+S2jN0Q3FRO8vj0U2GQGe6siK3HJiWMSYxaq8mwT5+IJWngYLbiTeuPSWF Z0amyvtc1c5eJe5WNioFkeWS1/lVRnJlpOQz4yJ+uWB4Zh71FbRQcYcXQaUdXpaZFT7n axrnqf92LpdbHqXy/wjmzfqZFtNQLshcJYggA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ANV7NyrP0qzxMRyoZtxSl3TNIq+AH8aqzDzpJeliM88=; b=ZGHLrFL3SIuTJwNDrjHl2aS/Pn+TKZXoKsBZfzGkTFmmIWd2h3xWEfhA8OTPjNjhn+ b5RG4Hf3qn2tYm6Ey25ASIby9mONqEfx2o64JM6benV90EErlspopsERGQZV6LoBfdy4 OQCuQVUZ8w1XyUg4kFGvFMR4STC+cjpuimGrjPe8NrZsx6E4bxIjCyS65w0EbmvxYcdl 8zmNcbGsD5BlpUg/fxry+avKt5Zk8Frd1x97kZd7nwu0rCA4ixsUaFDlOXEza5tN2eez buPK9+cI9QaELad7HZiimkFMZw8hLTh6MUz6kNfD6EkX/v+5Yq6rR5gYMMSUAT9hZxLA kmsQ== X-Gm-Message-State: AODbwcCp80Q4UitTKYwsc4DGkQ/+1PV8J7JHXFo4NIue8Ax+IILTUah+ e8g9WaDOFzuwPWt4UPs= X-Received: by 10.25.92.208 with SMTP id u77mr14544550lfi.69.1497257371368; Mon, 12 Jun 2017 01:49:31 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-67.NA.cust.bahnhof.se. [158.174.22.67]) by smtp.gmail.com with ESMTPSA id z10sm2482703lja.24.2017.06.12.01.49.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Jun 2017 01:49:30 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH] mmc: core: Remove MMC_CAP2_HC_ERASE_SZ Date: Mon, 12 Jun 2017 10:49:26 +0200 Message-Id: <1497257366-4223-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 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 --- 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(-) -- 2.7.4 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) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_ERASE_GROUP_DEF, 1, card->ext_csd.generic_cmd6_time); diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index 89d9a8c..cf66a3d 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -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 | diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index 242c5dc..e2f6383 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -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); diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c index 8fa84a0..227a5cb 100644 --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c @@ -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 */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 9209f95..c81380a 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -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 */