From patchwork Mon Jul 30 02:45:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10548393 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 4AFF914BC for ; Mon, 30 Jul 2018 02:48:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39BAD2997E for ; Mon, 30 Jul 2018 02:48:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DAFB29985; Mon, 30 Jul 2018 02:48:17 +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=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B7BEF2997E for ; Mon, 30 Jul 2018 02:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=baoEhWivsb6/2yF6VdWItofzFrDylYr4XmkBHpSDQO0=; b=bvSM2Y/cCpBWb5 iQAuhgs5DWjhjeoDLKndEc1VcTmEtnid/bRx19woKlbeNzLOEGnz6y4R57MXMtKg/IoLR5PFUyChY 3oXsKAPdCBY462AMbopKU3iEAYKoetZf/yx71gVC7vVYX6QjJD5m2AlTWpHuONSSqwQq4uB3etzwn 0TzOjwJN37Al5vg6+kTnZ47ED/NfmbRVR8DZHuXH/47yAT7Cl7+Z/3TNm9n26ATpi5XOkFLelIYGL oxkSvdsKCoH8z/MRNi7HHaXHAwufpkr0RiGlEL1WEjhlF2PzOThJgO+tcB9560i0pDSK7X57vmH/k m5vZf4bZhCWPbPC/36ww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fjyEF-0004dj-HH; Mon, 30 Jul 2018 02:48:11 +0000 Received: from mail-eopbgr720078.outbound.protection.outlook.com ([40.107.72.78] helo=NAM05-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fjyEB-0004bH-RY for linux-arm-kernel@lists.infradead.org; Mon, 30 Jul 2018 02:48:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J4u5uB4pyMz2QMMCboV1G5cEG2ARP2isXycosXVGyGw=; b=vV0ZaRvbHgOc+E9iBu2TRDBFO74dkH+zWJmhC3aqZERNabASl0iAmCFRbTOtBOVFZ26/XKWg1hDgT6hijk+GePpr4R9Srbzn55MaSlmgvcl6gyT8R8iJvhkivhb6P9lQO7K3U/+sVDEYfmH9ecAP1VhG3mpxr5P7+HJnqy4MPdg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by SN1PR0301MB1584.namprd03.prod.outlook.com (2a01:111:e400:5232::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.19; Mon, 30 Jul 2018 02:47:53 +0000 Date: Mon, 30 Jul 2018 10:45:31 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH mmc-next v3 2/3] mmc: sdhci: introduce adma_write_desc() hook to struct sdhci_ops Message-ID: <20180730104531.388b4f39@xhacker.debian> In-Reply-To: <20180730104228.28b58bd0@xhacker.debian> References: <20180730104228.28b58bd0@xhacker.debian> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Originating-IP: [124.74.246.114] X-ClientProxiedBy: TY1PR01CA0160.jpnprd01.prod.outlook.com (2603:1096:402::12) To SN1PR0301MB1584.namprd03.prod.outlook.com (2a01:111:e400:5232::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: da222d22-5b65-4da5-e54c-08d5f5c6d9c4 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:SN1PR0301MB1584; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1584; 3:9+hB5XNZX/exSi6Hf88QDLdSPrJqYG5+cdNf7od1G9rqjdAfGeECsUiNJyfejD1c2Qzn9BzlGvpyz0D5CPwDvzRusOy8OnH4ktGPV7hNqTx48my3rnPnGdQmT/gL+QFTAaMBJNYGOFAW2yd0zdMvQUzu/fMR8pKous69NyAItdJet1ts2XMafQ9KQiA+RNozaJ9ZlCcEtuZ0D0qCo/l5jjI4sXhvo0hCONF2wsuSjh+CZd0pgQDP2WjFK8LgZ4H4; 25:q5fg8FQcUkpTTNpeZGPxxsjPsV0uNAW2GL4GaLsx2TLPimib7C6/62J/NjRtmRZXU28kepvsgay2VsrSaAB/ZceGmuTXb++3+jQCTt8OpnqK4K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dJfPEJPJBMX049HhmW+c4CRs+S0O19nPAEq9cKCF0dBVxO7Q/0hJ3vhisAFkySQnozAEIMGJD8N7V7kx+Hc5CBXwlYKSi4QZY3BU5ArhkKsTzRw/Ht1GCXCKaYkrjG7lQsKVUNdOPjwHROajfPsV59c1pCHWg0RChU6R1OWwQFBhF5ZYO/4V2cRpcB1/ixTBOZnckm8NK4RlNb71Gfg2/S+4L7OW3wt1sNG1R9W8eByqnfrzDMlLADepl1+2q1BVcYYTNHNBU4w9txed0w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:SN1PR0301MB1584; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0301MB1584; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(136003)(346002)(366004)(396003)(39850400004)(376002)(189003)(199004)(105586002)(6116002)(3846002)(106356001)(23726003)(8936002)(230700001)(6666003)(50226002)(7736002)(6506007)(386003)(68736007)(186003)(16526019)(7696005)(2906002)(26005)(8676002)(81156014)(81166006)(52116002)(53936002)(76176011)(478600001)(4326008)(72206003)(1076002)(47776003)(25786009)(33896004)(97736004)(476003)(5660300001)(110136005)(316002)(305945005)(956004)(50466002)(486006)(575784001)(66066001)(446003)(11346002)(86362001)(55016002)(14444005)(9686003)(39210200001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB1584; H:xhacker.debian; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0301MB1584; 23:l9m0jEctKXTQezuVPtFSSE/1chWEhPLnq3bCYGt?= TuiThNUIrs4utTpoCaafYrv7ck4bq8fQQnOXVfTy31B69R6TDsprsxvv/4zFl1ApIFWEm0iVGfceMUgH+r5ykI++oMKHV6mGsg1XC9fAscg0BRJTk2DjroQ6GPN6ur5vXGS+3i9tkc2d9KS5gnZPQylDm7MeXaRPOWUHLHGoyxwGWcDEk0zDn0zg81z1Hd8o4UT0Le1p5V++7HjLO6FES9cHlpHaSFdyh50JgDKw8BFf20iHeTi4SZePQKEPk0Ou/qZASItOq/VLKS4LHIaMXFRWOoeDV7V+aqj8MoKK3bdt7d1eBXb/SdPii4lPAZLtTqBBfL4KIqvex3/neVihoutVxrgkPtX4Q4bRCI1lKXcKPZWdbmMVy02WCCXsLIZ4Nd83ClPP58EVBSBA0JwNLx6w9ma2TxYMz//KLNoh5SCaSzoi6djcNOA6iYLrYcq4/rIv1mMwjpUwNQAc3FwQPDlIx5NNDtzXYkH7ucVXOAsQSZ7Yl1Ayg6purlBKzcEfXmpEFiF1ZrTp/z0bZr5+FcVQQkxe8A6NOj1+amg/BK+Lygo+SwvcmJmM+hJNv5t/EG3eyKwIZiXI5Zd7I8FqewmyuOc8vYKSs2XYSB/tR8WAOTCvU7Dp9t42n1IrvNhUzYsvwCrdaNuj2Nbk/M0OPs0I6kNNcULqp2x68phXbSANQm7qO564aAtB3VLGQ87Sx+U1l1/PxVCm6NKD1whL/Y80Wn6f+fqKwn71luB5kZcmrfOZlc9jjWhZPYNiU10V3zLPiwj9sCEQ2svk2ltQjgYnDtjfOREJ4Hs4/9ya9mU5NrWYSl+qcFhp/L59DRSdaNcnNGskS5hmbfi2NHWGqBl8v06Eor/jPXLOBNNpba0S+5uxqhzJ/medp4rGZF0RRjvUOH1gkJow7pqGUURNnbodyUsEVQ5f62KbG2z/53rKBm5UD9081qhAFPg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bRwiiyUNnG8etlY10m+o7IpXIL39b2c6iIAs0iwMB+IorZbFFTPkN9as/PmeCzEEN83g3Kv8xWJNw3ylPtwx1y4gEEVvc3qj4rDNMxzNg7RUCvkSSgZP0BMSJO9gdjnfPNq3yqaLSs/zrL+grbwwuRmvJlk4bOZixoN6vFmAY99S8x2+gkXSiyOoKjhlUwg04oMg==; 5:dB8iLLo+7hG7vtQm8pDLQbvWXRxXQQhVjZWRzRy0tLfzPoL1i9IMrCK7NFaGCwZ9eFENbmCsbAxcji8UrWn+zKXV8xl2QHa7RL7jVjiwS1UaPmca0XKfI9QrW2Prl/wcBLWO6UqmP6Y11Nvvta3h9E4nxIPkONL9BFWy3nQETuM=; 7:3SDQ16PZPIaXuwapRydO+UakRCjcPYV42f1/zTlPtti+zDf3PyqDJElgBDSMixkZGBZT4b1NdbwDizDp9ffCODhNf+/1FW1HqceijLKf4VRdDzG6u7aq2pMnRCZHyrRJHw6rf7dQvc+OySquUgoU22npnbR4wvFfIjYebp5koMs+RV/Vdfxu0fSsMbQ6tbq4IHm73qlZompTvSV1C4+CJ0O+QKWMdn61MyjFE5g+HRiufhROL9Pm4liTIr0NS/ZY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 02:47:53.4380 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da222d22-5b65-4da5-e54c-08d5f5c6d9c4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB1584 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180729_194807_922275_B4109B2C X-CRM114-Status: GOOD ( 10.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add this hook so that it can be overridden with driver specific implementations. We also rename the original sdhci_adma_write_desc() to _sdhci_adma_write_desc() and export it, so that it could be reused by driver's specific implementations. Signed-off-by: Jisheng Zhang --- drivers/mmc/host/sdhci.c | 31 +++++++++++++++++++++++-------- drivers/mmc/host/sdhci.h | 6 ++++++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 14dd4a49e03b..50c846d99182 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -554,8 +554,8 @@ static void sdhci_kunmap_atomic(void *buffer, unsigned long *flags) local_irq_restore(*flags); } -static void sdhci_adma_write_desc(struct sdhci_host *host, void *desc, - dma_addr_t addr, int len, unsigned cmd) +unsigned int _sdhci_adma_write_desc(struct sdhci_host *host, void *desc, + dma_addr_t addr, int len, unsigned int cmd) { struct sdhci_adma2_64_desc *dma_desc = desc; @@ -566,6 +566,19 @@ static void sdhci_adma_write_desc(struct sdhci_host *host, void *desc, if (host->flags & SDHCI_USE_64_BIT_DMA) dma_desc->addr_hi = cpu_to_le32((u64)addr >> 32); + + return host->desc_sz; +} +EXPORT_SYMBOL_GPL(_sdhci_adma_write_desc); + +static unsigned int sdhci_adma_write_desc(struct sdhci_host *host, void *desc, + dma_addr_t addr, int len, + unsigned int cmd) +{ + if (host->ops->adma_write_desc) + return host->ops->adma_write_desc(host, desc, addr, len, cmd); + + return _sdhci_adma_write_desc(host, desc, addr, len, cmd); } static void sdhci_adma_mark_end(void *desc) @@ -585,6 +598,7 @@ static void sdhci_adma_table_pre(struct sdhci_host *host, void *desc, *align; char *buffer; int len, offset, i; + unsigned int desc_sz; /* * The spec does not specify endianness of descriptor table. @@ -618,15 +632,16 @@ static void sdhci_adma_table_pre(struct sdhci_host *host, } /* tran, valid */ - sdhci_adma_write_desc(host, desc, align_addr, offset, - ADMA2_TRAN_VALID); + desc_sz = sdhci_adma_write_desc(host, desc, + align_addr, offset, + ADMA2_TRAN_VALID); BUG_ON(offset > 65536); align += SDHCI_ADMA2_ALIGN; align_addr += SDHCI_ADMA2_ALIGN; - desc += host->desc_sz; + desc += desc_sz; addr += offset; len -= offset; @@ -636,9 +651,9 @@ static void sdhci_adma_table_pre(struct sdhci_host *host, if (len) { /* tran, valid */ - sdhci_adma_write_desc(host, desc, addr, len, - ADMA2_TRAN_VALID); - desc += host->desc_sz; + desc_sz = sdhci_adma_write_desc(host, desc, addr, len, + ADMA2_TRAN_VALID); + desc += desc_sz; } /* diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index d55fd7033e93..0aad0ee8f63b 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -605,6 +605,9 @@ struct sdhci_ops { void (*adma_workaround)(struct sdhci_host *host, u32 intmask); void (*card_event)(struct sdhci_host *host); void (*voltage_switch)(struct sdhci_host *host); + unsigned int (*adma_write_desc)(struct sdhci_host *host, void *desc, + dma_addr_t addr, int len, + unsigned int cmd); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS @@ -735,6 +738,9 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios); void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable); +unsigned int _sdhci_adma_write_desc(struct sdhci_host *host, void *desc, + dma_addr_t addr, int len, + unsigned int cmd); #ifdef CONFIG_PM int sdhci_suspend_host(struct sdhci_host *host);