From patchwork Tue Feb 11 18:40:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puthikorn Voravootivat X-Patchwork-Id: 3628921 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AA5EE9F39E for ; Tue, 11 Feb 2014 18:40:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC3A9201CE for ; Tue, 11 Feb 2014 18:40:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C314E201CD for ; Tue, 11 Feb 2014 18:40:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751071AbaBKSkj (ORCPT ); Tue, 11 Feb 2014 13:40:39 -0500 Received: from mail-qa0-f73.google.com ([209.85.216.73]:47742 "EHLO mail-qa0-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750978AbaBKSki (ORCPT ); Tue, 11 Feb 2014 13:40:38 -0500 Received: by mail-qa0-f73.google.com with SMTP id w5so1019712qac.0 for ; Tue, 11 Feb 2014 10:40:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ai3oZym9S+BbbKCxyNLbKVII5Hdo/7YN4ltbf5Sl5xY=; b=QqrKJmCk8VA4m8oZstaDCwsnwzxXPuTWIQt3bju7x7ZZFr8Wgf5VbYyUs3CTTx3hck 2X3peuHARhEws30ID/7E1qyYXP8mKgmzoTGo6R86UelKgBA5nI890T1mUVLPcqHzZW1s 9mPhuTujMrwtrXhtpyGJfdLK8ehK9mOL/5H7N/VlWp9E3wiAXTjddmjj6A0A8lnRoh/w MbkWnbfBd7JtzKsStWeOod/NP5KIiC80Q5q+jKCoIBtSfQIjY29Q3tBDw7HlCeUaEudr zJ9dqlq3vm0UAG3aNp4zh17nGCxJHep1+cipEgnUFYYKJGHgAbTu15yvxFxKVvSbKUu0 nZ3w== X-Gm-Message-State: ALoCoQnd9jBYEaF1kunJCgbubgREQD0686wMvGYEs39tKsuCP5gBkhtslfp0pmbb3u75xmc1QvLgTyTWWA/NogT7KfpADAkmzagC9/uPbvBy/UhHQfo0f5Nep5H6k1cUjqRVdhE783M/NulP3Q9GN5CDWh9xrxbQwihk3cPRmU74S4TyhBL7QQTVTaLXYn2GwYe6pkDEdqxd9xfaXIzyPtwwLxZu2vpAXg== X-Received: by 10.236.94.202 with SMTP id n50mr279000yhf.31.1392144037492; Tue, 11 Feb 2014 10:40:37 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id x29si2571360yha.0.2014.02.11.10.40.37 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Feb 2014 10:40:37 -0800 (PST) Received: from puthik.mtv.corp.google.com (puthik.mtv.corp.google.com [172.22.72.136]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 3C73631C22E; Tue, 11 Feb 2014 10:40:37 -0800 (PST) Received: by puthik.mtv.corp.google.com (Postfix, from userid 218808) id D7334204AF9; Tue, 11 Feb 2014 10:40:36 -0800 (PST) From: Puthikorn Voravootivat To: Chris Ball , Seungwon Jeon , Jaehoon Chung , Ulf Hansson Cc: MMC list , Gwendal Grignou , Grant Grundler , Puthikorn Voravootivat Subject: [PATCH v3] mmc: remove MMC_CAP_ERASE to enable trim in eMMC device Date: Tue, 11 Feb 2014 10:40:35 -0800 Message-Id: <1392144035-12895-1-git-send-email-puthik@chromium.org> X-Mailer: git-send-email 1.9.0.rc1.175.g0b1dcb5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove host erase capacity check to enable trim and discard feature in supported eMMC device. Signed-off-by: Puthikorn Voravootivat --- v3 change: As suggested by Jaehoon, this patch remove MMC_CAP_ERASE instead of force enable it. v2 change: Instead of add MMC_CAP_ERASE just only for dw_mmc, this patch adds this capability to all host. arch/arm/mach-ux500/board-mop500-sdi.c | 3 --- drivers/mmc/core/core.c | 6 ++---- drivers/mmc/host/omap_hsmmc.c | 2 +- drivers/mmc/host/sdhci.c | 2 +- include/linux/mmc/host.h | 1 - 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c index fcbf3a1..6d9feb8 100644 --- a/arch/arm/mach-ux500/board-mop500-sdi.c +++ b/arch/arm/mach-ux500/board-mop500-sdi.c @@ -48,7 +48,6 @@ struct mmci_platform_data mop500_sdi0_data = { .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | - MMC_CAP_ERASE | MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25, .gpio_wp = -1, @@ -119,7 +118,6 @@ struct mmci_platform_data mop500_sdi2_data = { MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | MMC_CAP_MMC_HIGHSPEED | - MMC_CAP_ERASE | MMC_CAP_CMD23, .gpio_cd = -1, .gpio_wp = -1, @@ -154,7 +152,6 @@ struct mmci_platform_data mop500_sdi4_data = { MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | MMC_CAP_MMC_HIGHSPEED | - MMC_CAP_ERASE | MMC_CAP_CMD23, .gpio_cd = -1, .gpio_wp = -1, diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 098374b..82de9f1 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2007,8 +2007,7 @@ int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr, { unsigned int rem, to = from + nr; - if (!(card->host->caps & MMC_CAP_ERASE) || - !(card->csd.cmdclass & CCC_ERASE)) + if (!(card->csd.cmdclass & CCC_ERASE)) return -EOPNOTSUPP; if (!card->erase_size) @@ -2062,8 +2061,7 @@ EXPORT_SYMBOL(mmc_erase); int mmc_can_erase(struct mmc_card *card) { - if ((card->host->caps & MMC_CAP_ERASE) && - (card->csd.cmdclass & CCC_ERASE) && card->erase_size) + if ((card->csd.cmdclass & CCC_ERASE) && card->erase_size) return 1; return 0; } diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index dbd32ad..99d8558 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1873,7 +1873,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) mmc->max_seg_size = mmc->max_req_size; mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | - MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_ERASE; + MMC_CAP_WAIT_WHILE_BUSY; mmc->caps |= mmc_slot(host).caps; if (mmc->caps & MMC_CAP_8_BIT_DATA) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 9ddef47..6a50141 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2943,7 +2943,7 @@ int sdhci_add_host(struct sdhci_host *host) mmc->max_discard_to = (1 << 27) / host->timeout_clk; - mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23; + mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_CMD23; if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) host->flags |= SDHCI_AUTO_CMD12; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 99f5709..8b1bfab 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -242,7 +242,6 @@ struct mmc_host { #define MMC_CAP_AGGRESSIVE_PM (1 << 7) /* Suspend (e)MMC/SD at idle */ #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ -#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ #define MMC_CAP_1_8V_DDR (1 << 11) /* can support */ /* DDR mode at 1.8V */ #define MMC_CAP_1_2V_DDR (1 << 12) /* can support */