From patchwork Mon May 26 08:29:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 4240491 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 A763BBF90B for ; Mon, 26 May 2014 08:29:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BACFE201CE for ; Mon, 26 May 2014 08:29:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B1ED0201B4 for ; Mon, 26 May 2014 08:29:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751626AbaEZI30 (ORCPT ); Mon, 26 May 2014 04:29:26 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:17566 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751518AbaEZI3Z (ORCPT ); Mon, 26 May 2014 04:29:25 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6600JMBA8ZQV70@mailout1.samsung.com> for linux-mmc@vger.kernel.org; Mon, 26 May 2014 17:29:23 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.115]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id FF.DC.13369.36BF2835; Mon, 26 May 2014 17:29:23 +0900 (KST) X-AuditID: cbfee690-b7fb56d000003439-59-5382fb636db2 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id C8.7D.08203.36BF2835; Mon, 26 May 2014 17:29:23 +0900 (KST) Received: from localhost.localdomain ([10.252.81.186]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N66002SWA8YJE00@mmp1.samsung.com>; Mon, 26 May 2014 17:29:22 +0900 (KST) From: Jaehoon Chung To: linux-mmc@vger.kernel.org Cc: Chris Ball , Ulf Hansson , Seungwon Jeon , Linus Walleij , Gwendal Grignou , Grant Grundler , Puthikorn Voravootivat Subject: [PATCHv5] mmc: remove MMC_CAP_ERASE to enable trim in eMMC/SD Device Date: Mon, 26 May 2014 17:29:19 +0900 Message-id: <1401092960-16547-1-git-send-email-jh80.chung@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRmVeSWpSXmKPExsWyRsSkWDf5d1OwwdUjkhYTLm9ntHh15AeT xezFR1kspvxZzmRx5H8/o8Xcf5YWH+5fZLY4vjbcgcNjdsNFFo871/awedx4tZDJo2/LKkaP z5vkAlijuGxSUnMyy1KL9O0SuDI2tKxkLDimVPHn+juWBsa/0l2MnBwSAiYSS5o2sEHYYhIX 7q0Hs4UEljJKvJ4tBlOzqmMKUxcjF1B8EaPE1A87WSGcNiaJV1O+MoJUsQnoSGz/dpwJxBYR kJX4+ecCG0gRs8B8Jom/Z84ygySEBXwlnu+/BFbEIqAq0XphMwuIzSvgJvHm/Q6gqRxA6xQk 5kyyAemVEGhnl3h6fDkzRL2AxLfJh1ggamQlNh1ghrhOUuLgihssExgFFzAyrGIUTS1ILihO Si8y0StOzC0uzUvXS87P3cQIDN7T/55N2MF474D1IcZkoHETmaVEk/OBwZ9XEm9obGZkYWpi amxkbmlGmrCSOK/ao6QgIYH0xJLU7NTUgtSi+KLSnNTiQ4xMHJxSDYwqDKts5W59VTsXx3N0 0QTP45EixuWH2C8cvGB1zv3wIpsD7/9xGDsIttcskT8YErCvYIfFr8NFF3kOLviSJ97UJmIw 3YH3l9X/7U5r3wZ3THhVHvzyp8mr/M5WAcE3guJFfGaqhmv43Za8Z11yRS9levWfnyGNFdev crbvPNz06u1XnWOf1vUosRRnJBpqMRcVJwIA/B6ECXQCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsVy+t9jAd3k303BBpfn8lpMuLyd0eLVkR9M FrMXH2WxmPJnOZPFkf/9jBZz/1lafLh/kdni+NpwBw6P2Q0XWTzuXNvD5nHj1UImj74tqxg9 Pm+SC2CNamC0yUhNTEktUkjNS85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvMTbVVcvEJ0HXL zAE6RUmhLDGnFCgUkFhcrKRvh2lCaIibrgVMY4Sub0gQXI+RARpIWMOYsaFlJWPBMaWKP9ff sTQw/pXuYuTkkBAwkVjVMYUJwhaTuHBvPVsXIxeHkMAiRompH3ayQjhtTBKvpnxlBKliE9CR 2P7tOFiHiICsxM8/F8A6mAXmM0n8PXOWGSQhLOAr8Xz/JbAiFgFVidYLm1lAbF4BN4k373cA TeUAWqcgMWeSzQRG7gWMDKsYRVMLkguKk9JzDfWKE3OLS/PS9ZLzczcxgqPjmdQOxpUNFocY BTgYlXh4D3g3BQuxJpYVV+YeYpTgYFYS4W3+ABTiTUmsrEotyo8vKs1JLT7EmAy0fCKzlGhy PjBy80riDY1NzIwsjcwNLYyMzUkTVhLnPdBqHSgkkJ5YkpqdmlqQWgSzhYmDU6qBkUc18/iO 1+5XTFY8VVo4f7plFkvJxd+NWhwzOZZINvZl+Qfd9S3eWShnsPPd6veWHbtStOc1Lypnt6+b /v3K5vPrw8MslnA+lNuS6FAc5Gedt2+iEmP/yY4TU45YSp4/GLWhrnveSebE+SIqWZ52NfMX 2yTcu3Anv0Yp/MwspZ1bhRyus6teU2Ipzkg01GIuKk4EAAYfkirSAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected 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=unavailable 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 From: Puthikorn Voravootivat 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 --- v5 change: Rebased on latest mmc-next. 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 7dc0c85..e80daad 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2008,8 +2008,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) @@ -2063,8 +2062,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 6b7b755..d5b1286 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1964,7 +1964,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 47055f3..edf8134 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2926,7 +2926,7 @@ int sdhci_add_host(struct sdhci_host *host) mmc->max_busy_timeout = (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; mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 7960424..d626a89 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 */