From patchwork Mon Dec 12 08:41:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Damien_Th=C3=A9bault?= X-Patchwork-Id: 9470173 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A65B360760 for ; Mon, 12 Dec 2016 08:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 981702843A for ; Mon, 12 Dec 2016 08:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BF9A2844B; Mon, 12 Dec 2016 08:41:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D07492843A for ; Mon, 12 Dec 2016 08:41:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753827AbcLLIlU (ORCPT ); Mon, 12 Dec 2016 03:41:20 -0500 Received: from mail-db5eur01on0066.outbound.protection.outlook.com ([104.47.2.66]:31512 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752338AbcLLIlT (ORCPT ); Mon, 12 Dec 2016 03:41:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vitec365portal.onmicrosoft.com; s=selector1-vitec-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dNy/LtwTXMpaTC3wPqEkwZzoREPs4oYeIXaPxyWCGiw=; b=W7uy5zqgTCUug+ppvzq7ICzAkbRSGTlhJ+NHtZPiHp673LaH5JowJaeBiRaMOTMW+tdmFtXAv6wrCMonTIGW9aIQEIwOm3f6Q2aU09H5rd9RBzG5pLQT4oD6yvs4C7q6uVLg4aUFkUpKQFaYfw/wMGGV36+ldaFvaGa4gC1Sdec= Received: from VI1PR05MB1696.eurprd05.prod.outlook.com (10.165.235.158) by VI1PR05MB1693.eurprd05.prod.outlook.com (10.165.235.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Mon, 12 Dec 2016 08:41:15 +0000 Received: from VI1PR05MB1696.eurprd05.prod.outlook.com ([10.165.235.158]) by VI1PR05MB1696.eurprd05.prod.outlook.com ([10.165.235.158]) with mapi id 15.01.0771.011; Mon, 12 Dec 2016 08:41:15 +0000 From: =?utf-8?B?RGFtaWVuIFRow6liYXVsdA==?= To: "linux-mmc@vger.kernel.org" CC: "nico@fluxnic.net" , "sascha-pgp@silbe.org" Subject: mvsdio: Add ERASE caps Thread-Topic: mvsdio: Add ERASE caps Thread-Index: AQHSVFN/qZqVOUfAIEy5IfRUoFI2IQ== Date: Mon, 12 Dec 2016 08:41:15 +0000 Message-ID: <1481532074.21423.9.camel@vitec.com> Accept-Language: en-US, fr-FR Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=damien.thebault@vitec.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [46.218.234.67] x-ms-office365-filtering-correlation-id: 024266f5-2b1b-414a-c4aa-08d4226aa280 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:VI1PR05MB1693; x-microsoft-exchange-diagnostics: 1; VI1PR05MB1693; 7:TGwQE/boClm9qxtSXXQr0/tPapFVnZeddUr0zHXuR97HfIXWJzYCChANfiBDOpLVXs5UhJjUxQUF9Qc7b67RdVXzpFr7noGkU7WKvxZD7tJ4bNveDi19+Sogh1yaQ4zGWZ2hwXCfCHY5S8UGbA6mLLybWMOJpVL0Bz2aa9ijNiVDWbrAs7jpWtuCBZ7qbqHPlD+rE/pK/qq6rBXRjf0xae6qiBj6e3a5qXoPpA/WtwAPl4uniKBys+QwXKd8DgODZ+4pgj/r5+MkXaf4kkc9IAX/Li77qKZBczb4YoRh+IHqVLxlu0/VKA7CPAOJKFdaSL1ILGHBx2QQQ4hE+xhuPo2HfmoHnV8APmzqvca8TI47hCITLORoDkRiMc9uhiWPZktf1yTkfTMy1WMHefs9N9L1npyNbvu2y8AUUr/JulzieKez2LSbsPAdt78uVi2+FDCacaMA+sJhb46bmozXgQ==; 20:F++gbryDG1OlUBs7krV0Ww3z7SOGA91sKfM1aWYIjB+M1703YNFbQay7PZ94mYzB8PsXGj2asSxS7KHHiJpphaf97UP+cnZFA/COmwOdMinXYFxDU5Sz3KSwiLsKaa7EdZV0P1RyT1QlpllmE7D4c7PY+0ZkdTWVTTcQBvck1kVG/AOn5bHq3TIIk48Hi9mZqe8aw/qUpm8weG1bjjKJuC1U5EK1vkUUqD/cYlPgADIWRVwgw6BkNWC4fie+UF+J x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:VI1PR05MB1693; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB1693; x-forefront-prvs: 0154C61618 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39450400003)(39830400002)(39410400002)(199003)(189002)(6436002)(50986999)(77096006)(106116001)(189998001)(8676002)(54356999)(101416001)(106356001)(8936002)(3846002)(3660700001)(102836003)(81166006)(105586002)(85202003)(3280700002)(6916009)(103116003)(122556002)(5660300001)(81156014)(85182001)(7736002)(68736007)(2906002)(2900100001)(33646002)(6116002)(110136003)(305945005)(36756003)(4326007)(38730400001)(2501003)(2351001)(6506006)(92566002)(66066001)(6486002)(86362001)(6512006)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB1693; H:VI1PR05MB1696.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: vitec.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <322B3F9910465E4EBA656BA5FD3FBE25@eurprd05.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: vitec.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2016 08:41:15.0475 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 417d3214-b611-4fca-a1d5-e4446a9f50f4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB1693 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, I was trying to use ERASE with mvsdio and it did not have the capability. But the Marvell SDIO host controller does support sending ERASE commands. This is similar to the patch that Sascha Silbe sent a few years ago [1], but this one is based on the latest kernel sources. [1]: https://lkml.org/lkml/2011/3/17/297 The patch stays in the spirit of what have been done in other drivers like dw_mmc or sunxi-mmc, setting MMC_CAP_ERASE before calling mmc_of_parse(). This has been tested successfully with blkdiscard and blkdiscard -s on an eMMC card. ---  drivers/mmc/host/mvsdio.c | 5 +++++  1 file changed, 5 insertions(+) --  2.10.2 diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index 42296e5..e14247e 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c @@ -749,6 +749,11 @@ static int mvsd_probe(struct platform_device *pdev)   mmc->max_seg_size = mmc->max_blk_size * mmc->max_blk_count;   mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;   + /* +  * Support MMC_CAP_ERASE, needed to use trim/discard/erase commands. +  */ + mmc->caps |= MMC_CAP_ERASE; +   host->base_clock = clk_get_rate(host->clk) / 2;   ret = mmc_of_parse(mmc);   if (ret < 0)