From patchwork Mon Jun 12 12:24:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103616 Delivered-To: patches@linaro.org Received: by 10.182.29.35 with SMTP id g3csp861687obh; Mon, 12 Jun 2017 05:24:18 -0700 (PDT) X-Received: by 10.46.22.93 with SMTP id 29mr3589981ljw.56.1497270258008; Mon, 12 Jun 2017 05:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497270258; cv=none; d=google.com; s=arc-20160816; b=iitSlG/qCXLq/7tR/vLCvYQ9CN5XX55f1bS+uhONlm7dVBkKSD5Mwq3f+SAJX/T6K0 LrfuKRQ2UaHIpNFWyHpry9vvCTBkNKHSxnOpRS72Gj9gg9dNxi0kiquhVjPYgDBvPdjW ZQxIhF2gub8xrf0iwm7exdohQGaNO4cL6dsYl+c6DgIheR536LiwQKNVLWmixKIypQKd ILSY5aop39xXbY1uAQWMFdkyFDv6HaydhUDdOPHJYJT0aGzt87Q8IRiO7oyMes9CWUyN qMDbyfUgLRpl7qKHn1o3aFXZd+Nu8hSU3XALBae/z2ajywOutuOZaU7eZPoLFskv25Yp hgrw== 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=VmA7VhWM6/d+TwARwC0NKfahGWSxUPRcGRulyYIdQ4Y=; b=dDFgYsLxrmNRfrwMn0g227P7OREPxqtBPriuTr4A4l1wpbud5Au/HfKVffyf25Mg8e KWBJw6l3oof68hihcAdN/02jFzaeMPs5bKPWTie5iI3Tp5RCRj+hX462JntLgs36inqy qbEY8lCmeZH8wwHbPsOponCLltPyeQ04MYswqCY1UV4X8MkGFaQ+zuVP4aAqLEIS7AxK olwk6cXP+zFiQuas13QyBjwqPTo8Rix7Et3Dz+ikXqVIoNTkEeXpNI/creGtJFIN1Ba1 7IM9soy6uh/JMf8/7LWsUexlv9Wd16iJhi0TC6GLtGQeRQxwNWFQ4H+ZYBReRJbAZxQZ +l/Q== 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::22f 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-x22f.google.com (mail-lf0-x22f.google.com. [2a00:1450:4010:c07::22f]) by mx.google.com with ESMTPS id p191si4645935lfe.182.2017.06.12.05.24.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2017 05:24:17 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22f as permitted sender) client-ip=2a00:1450:4010:c07::22f; 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::22f 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-x22f.google.com with SMTP id o83so50102472lff.3 for ; Mon, 12 Jun 2017 05:24:17 -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=VmA7VhWM6/d+TwARwC0NKfahGWSxUPRcGRulyYIdQ4Y=; b=M+kKuB3EDZmvrRcMM38UKA/qKBFoCuZpL8uuyf7kIhfdn57+iTcjwAf/Fh/GUVrt4W xBmEmRd82QdlRJpRkODkpzTSKadtM5mu1CZMQwKjfsmrQNuuT5KxEuwNwYe/F4Yu5vw7 kBcYivWmvA2lpo4s0TGHx1THl7dLsBG0Yp0q8= 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=VmA7VhWM6/d+TwARwC0NKfahGWSxUPRcGRulyYIdQ4Y=; b=al5qF3nHED+1j2+lunl5jCI6pG28nInxasOkAAE5aCM8p4Ncemazi0IwRP7c3qfRqE PccnOJoU3t5xvAtzQrEpGUVMlLB86Yl9ILclCaYJePiBhNnKRKGV3eAhu8JCs3Yp2ZoH 6ixl3kErPwKutB2ulmXnaf+fi8lK9AaI2K51RE8j3EJNK3fSrDegRqGvZnBTE1ZLuuCI Hyb0dUKUxXsKin3IViPCZVdU5kAfS3dYQLAFjJqlnsDyquU8lt5pxP+ktStiZ69nFau0 3tJ/orXvDUoDASBLM6eL5pmUyjyX60BUtn51RIwp0F/zKFLB732LgHxMT8E5S2uR6Qa3 UcJg== X-Gm-Message-State: AODbwcBmv75ubvWpHXJ6VJOov74BPW+T1YuitWV4qadhcrWrzW/Mxyae XivZl8n1xFFn7sYHX8s= X-Received: by 10.46.15.2 with SMTP id 2mr15789510ljp.91.1497270257446; Mon, 12 Jun 2017 05:24:17 -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 r5sm2632868lfe.41.2017.06.12.05.24.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Jun 2017 05:24:13 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH V2] mmc: core: Remove MMC_CAP2_HC_ERASE_SZ Date: Mon, 12 Jun 2017 14:24:10 +0200 Message-Id: <1497270250-11353-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. 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 --- Changes in v2: - Make the behaviour from MMC_CAP2_HC_ERASE_SZ the default. - Update changelog to reflect the change. --- drivers/mmc/core/mmc.c | 8 ++------ 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, 3 insertions(+), 14 deletions(-) -- 2.7.4 Acked-by: Adrian Hunter Reviewed-by: Linus Walleij Reviewed-by: Shawn Lin Tested-by: Shawn Lin diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index e504b66..4ffea14 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -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); 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 */