From patchwork Wed Feb 6 11:28:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avri Altman X-Patchwork-Id: 10799167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDE02922 for ; Wed, 6 Feb 2019 11:28:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC91C2A812 for ; Wed, 6 Feb 2019 11:28:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B065E2A8B5; Wed, 6 Feb 2019 11:28:41 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 48C312A812 for ; Wed, 6 Feb 2019 11:28:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728246AbfBFL2k (ORCPT ); Wed, 6 Feb 2019 06:28:40 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:52535 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729778AbfBFL2k (ORCPT ); Wed, 6 Feb 2019 06:28:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549452521; x=1580988521; h=from:to:cc:subject:date:message-id; bh=MD0RpfSJyPYnPMaLg3A2LN6EW2fPmTxLI420Z4nlS7A=; b=ZZwa+5hPCxEemMTHxwoLGP2/MRPOyjUTV8s/wAMQV08t+8UzTh15f5B+ sxMfmDC9SbkvUQ+4o/LT2RI2qlzJSKsDul3WcOiUwTgRbOgVIdrcLHyth Ni55Ung4JUPbxNRBT0e32VXCCnPWfq9gozb8t6x7n0AscpyB/X7uG/Wnd wMbmHHI+tmLokbgdWNCuo+tPY5OPCpZcGR8r9kMfkgpQnJBNGl+IZPPh/ MJW+ou6VDpiLQJMkJsQUSDsXuMezqXifH/490adS4P6B88XRUvpxiyyT8 n1S5cD6Q2lt0dVoGFg2FxhyPquZl2bPOIzMoyS3z/pj/+93mrNqPz2sRX A==; X-IronPort-AV: E=Sophos;i="5.56,564,1539619200"; d="scan'208";a="105601449" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 06 Feb 2019 19:28:40 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 06 Feb 2019 03:09:26 -0800 Received: from kfae422988.sdcorp.global.sandisk.com ([10.0.230.227]) by uls-op-cesaip02.wdc.com with ESMTP; 06 Feb 2019 03:28:37 -0800 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Wolfram Sang , Adrian Hunter , Jaehoon Chung , Shawn Lin , Avi Shchislowski , Alex Lemberg , linux-kernel@vger.kernel.org, Avri Altman Subject: [PATCH v2 0/3] mmc: core: Add SD Discard support Date: Wed, 6 Feb 2019 13:28:04 +0200 Message-Id: <1549452487-17193-1-git-send-email-avri.altman@wdc.com> X-Mailer: git-send-email 1.9.1 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 SD spec v5.1 adds discard support. The flows and commands matches those in eMMC, Which leaves to set the appropriate discard arg in CMD38 if DISCARD_SUPPORT (b313) is set in the SD_STATUS register. We set this arg on card init: not in mmc_init_erase as one might expect but arbitrarily once the card indicated its discard support. This is because unlike erase, it doesn't really involve any logic, and we want to avoid the unnecessary complication. V1->v2: In the first patch, assign the discard arg for SD cards as well to keep the code consistent. Rename "discard_arg" to "erase_arg", and elaborate the change log. Avri Altman (3): mmc: core: Calculate the discard arg only once mmc: core: Indicate SD specs higher than 4.0 mmc: core: Add discard support to sd drivers/mmc/core/block.c | 12 +++--------- drivers/mmc/core/core.c | 8 ++++++-- drivers/mmc/core/mmc.c | 8 ++++++++ drivers/mmc/core/sd.c | 15 +++++++++++++++ include/linux/mmc/card.h | 3 +++ include/linux/mmc/sd.h | 6 ++++++ 6 files changed, 41 insertions(+), 11 deletions(-)