From patchwork Wed Feb 12 00:10:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puthikorn Voravootivat X-Patchwork-Id: 3633551 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 54127BF13A for ; Wed, 12 Feb 2014 00:18:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFA862013A for ; Wed, 12 Feb 2014 00:18:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC93E20136 for ; Wed, 12 Feb 2014 00:18:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751973AbaBLASb (ORCPT ); Tue, 11 Feb 2014 19:18:31 -0500 Received: from mail-vb0-f74.google.com ([209.85.212.74]:51249 "EHLO mail-vb0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbaBLASb (ORCPT ); Tue, 11 Feb 2014 19:18:31 -0500 Received: by mail-vb0-f74.google.com with SMTP id x14so1075618vbb.1 for ; Tue, 11 Feb 2014 16:18:30 -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=0iTlSFTOOWxzeeMpY8bGpxC1+r/m3bEhCGok9/9r3zc=; b=TE+rrRkjaYSUbEkfS6LkPoXwLfLSRW1E0IcBmwHro1MO+tll0PCdcjW3onqoTZWLgu QDXbUFxtoXYHxVG/oaiOCAPVVYdAl9coXcikfgmK6NULRwBBfjMVPcA8x7UR7wZHb/ml S6f9m4HSRxJoRnXWNiI6MPKaRDPqg5YUVTySxYykqPHY7J4l21ZjnAdfsGf7FXWNpCwy Fn/280GJpULt4XSKYOYbKwaAJE/tgpwld+bLfniXCpDTvgWez9M1dIrTIoQOFY3Q4ULP IuFuFb0KOgr8yzRFdC5Afpv1u1/3JsN6cUxVvO/yc3TUXPSFnlBmU2S8IY2j8Elt2IKM cWBQ== X-Gm-Message-State: ALoCoQl6j5RguRRNOrk8SAoVkSPoRUGQ98X/wmMh0iCE3i2d0AZufG6XQ3J7BcELfBmRF94J96mz2iYlqI+PKge69YFhWFfv5kl4AZY4AeCNvIMH7DpQVwEJ8R0kdtRDwMJPk7qZgGvFjkAvMSdJFET68l10f9BSmip5lczuWl3o4xfv74qAMp4HSdGshUe2GLYq/Yk51FOyMgyO1X4wGqymq6QUZUKnbw== X-Received: by 10.58.219.196 with SMTP id pq4mr622134vec.4.1392163816078; Tue, 11 Feb 2014 16:10:16 -0800 (PST) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id x29si2718503yha.0.2014.02.11.16.10.16 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Feb 2014 16:10:16 -0800 (PST) Received: from puthik.mtv.corp.google.com (puthik.mtv.corp.google.com [172.22.72.136]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id C22C65A4217; Tue, 11 Feb 2014 16:10:15 -0800 (PST) Received: by puthik.mtv.corp.google.com (Postfix, from userid 218808) id 62D56201F8A; Tue, 11 Feb 2014 16:10:15 -0800 (PST) From: Puthikorn Voravootivat To: Chris Ball , Seungwon Jeon , Jaehoon Chung , Ulf Hansson , Linus Walleij Cc: MMC list , Gwendal Grignou , Grant Grundler , Puthikorn Voravootivat Subject: [PATCH v4] mmc: remove MMC_CAP_ERASE to enable trim in eMMC/SD Device Date: Tue, 11 Feb 2014 16:10:06 -0800 Message-Id: <1392163806-28818-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 MMC_CAP_ERASE from all host as it does not make sense that the eMMC/SD device erase feature should be controlled by the host cap. This make trim and/or discard feature usable in the supported eMMC/SD device. Signed-off-by: Puthikorn Voravootivat Acked-by: Jaehoon Chung --- Resend to ux500 maintainer v4 change: Change commit message to mention SD cards. 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 */