From patchwork Wed Jul 25 09:46:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10543779 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 7756D112E for ; Wed, 25 Jul 2018 09:48:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6650029B4D for ; Wed, 25 Jul 2018 09:48:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A19B29B50; Wed, 25 Jul 2018 09:48:55 +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 D987729B4D for ; Wed, 25 Jul 2018 09:48:54 +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=EAD23ddrA2cy4Q GD0zxajRlg4G/7TgoWQA7EavVaT9s8D2coRDZRUbu026om4Z47LhDNAd0YuSU4qPCU8/vwbNG2guk 3F3/Qv/4tN4yOATvuanTTuUEJEjMdYMPvnbNrBHAf+8QPILNfhzRhW7cOAaoq9N75cC7Szmt64DFX 9yrE+1HgR1qRoDBqa+6BuIfSi78Fi4ywEthgUb41/o4duHH+AqCyGSonzy9ysSTm8Wqm/WbC/9+K2 qSnZSrRC/S+i3FHxiTmJoTpZKGx3VwokqfwPu0yYzMGSVP8VF5XY0XMRIDFxQjEwjSscZWjKyKT0W SiOkYyIZ3gkd0xK1NuJQ==; 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 1fiGPb-0002cO-Ug; Wed, 25 Jul 2018 09:48:51 +0000 Received: from mail-dm3nam03on0627.outbound.protection.outlook.com ([2a01:111:f400:fe49::627] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fiGPY-0002Zd-Gd for linux-arm-kernel@lists.infradead.org; Wed, 25 Jul 2018 09:48:50 +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=OhZfZ27qlc4FLzHpyhujBdRxmBGk5LyJxqkO/wng55WubtmMxjtt/Jrn1EHwrDJdTg2oqQkxyaF73KSFNGEKHK2bE+XmdzKbiGYXNB+K06gNRN4hu/PEgT5HjKHckhEyXD3N5QrdSeX1WDXcC4emBXmrW2sXvjh7wGKqp071OdA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by CY1PR0301MB1580.namprd03.prod.outlook.com (2a01:111:e400:529c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.22; Wed, 25 Jul 2018 09:48:33 +0000 Date: Wed, 25 Jul 2018 17:46:18 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH mmc-next 2/3] mmc: sdhci: introduce adma_write_desc() hook to struct sdhci_ops Message-ID: <20180725174618.1dc9bdd4@xhacker.debian> In-Reply-To: <20180725174235.1ca764cf@xhacker.debian> References: <20180725174235.1ca764cf@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: TY1PR01CA0142.jpnprd01.prod.outlook.com (2603:1096:402:1::18) To CY1PR0301MB1580.namprd03.prod.outlook.com (2a01:111:e400:529c::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aad1736a-dfa7-4e70-90ad-08d5f213ca04 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(2017052603328)(7153060)(7193020); SRVR:CY1PR0301MB1580; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1580; 3:2aHqziea3vj9+tx/Rv89Et6ZPC9hchjvPladp/OzLh1O2wtwWK/UE9Jtn+nRimvmys+RYvfgvQSZ32aHOf0OFwjNC7H+tuseyEsJvF9c9k6HA1xhY4rO9g8XkDoDhX7cBNLPBAmBY46xrZZ4bB+U3RKbWVdR1H+fCCI2vjlLjSHaD9svbkKsiUt5yvWrsyn5KNLkju1aSPzrSSc1PypFD4c5fpZWqgRstynykM9zJUbAWe+QBfIQN5iz9NgjQ5Yc; 25:Bv6ydgWCncNsExtm0u+eOD34XPAZF/B1ZKDVwaSJKzdbGTxODKM9bgNCLvSSkQfm/FlKd3w9gnG/vpn3EdWwlGwfDMiDJP6JYRI+wTSi0kMrKVtzV/XHLHilOuEFRVaRNCWdsjFzLAdmJUKSbzGntx0AFdjugPPbr0lvgNVnItK50DZOnB2OMQi8NpH+l2EfUTSt1WYLJV0osDauejJaTFJL0yn4Tf3lmbJww3Amb/QA4dBwfxJ5AWty8eHQzlj76kL++DerDSGO637s6lqq5DVo/nhbvi31gqX0D15FPyIn9g3JCugLWYdFgGPlThbCdEUnIZryRXFW7dvcvAc72Q==; 31:CB6jQUU20hMk5pby2k3PmLDUijK/NllCqfAxRN+4xElfpEEbygL+QBTUPek46Pd99QnwInz91OgfoAa2LDQawuFzLNgo6/HJaDWBB/G0umnqx35SzYOlzjJww1dVDbXbawH6MTpOd6UQ4dPQ5bbMKHNJRGr9/jXFjvmp1BOjaCF0XBVEZC6rnMTwRaMZQSVcyjln143YZUGeKJ4Tivqsifck5/QTM10INdWHRfCr8XI= X-MS-TrafficTypeDiagnostic: CY1PR0301MB1580: X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1580; 20:mXuQfZel/mN+d1BRlrXMc2m45iAlzzt3N1o1lqDmAT+FiVXLK8XQXmDaW/snQJXX+U/J0gWnAsom9pwK5ddEHj30s2TBMvXaT3bnF+Zywq3WvafTF9VRMznMgNgj5Hg16ZqiYPVEiqzW/w9jb17ya5k+FFrPtSb/jIyk+JYCsICoLehI3oyKAqlFuKJgocPZu/fxJpYmqzlqo1+zDJYr/5yF/lDEEAVFy298lj0qCaqMR945xbzYZwJ0WOgqfWMhymRVGc2mqP6afQOyYswEk2SK+Kj8jtCCchmEIWuIVhyJLPQbyVS+NrJ2MapcVxG2xkAXeipTwZ85fE9wiqyQ7NwTilxg96QD36Zrz6xUnklszS/hRoyl+I17lc6qoGXVMITC+SVObuu5khgdbq9zOSfhITpESxpv89SOO2oygbf+z0f4dsqWoIDs9CDasEzwIuoyxRLM+Wsa4aUxHGVawn/MnYKBZSlyBlLg5PIxV9u94FvEAWKokUljnur44P3S; 4:MI3rC+eTMJ/b6gh3vk7SA+NrZiXx2RQfEvGdShaH3AzUDgS9SctpiQzKlxB4zs9juvsgFiij8m5XYcWeOvN7fnSmQ++Vrw1s2Pm/BBcLIf1p0z8vk9ir6OwIACOfn7B0u6+N5B5lDQdBfmufdfJmXcUoR3Z46Q/KdHLq++z4bj8SXnvSsN/CcNcstL8dsrKoJPK/69WduwiAyD5TTkzN36yRETI1Sg2q0jxgOJfBedk8R7XeyenYHFAZoOtolpE773fdzRIsz4mLSNeLsGXvrA== 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)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:CY1PR0301MB1580; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1580; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(396003)(346002)(136003)(199004)(189003)(105586002)(14444005)(7696005)(486006)(9686003)(476003)(956004)(55016002)(47776003)(66066001)(1076002)(106356001)(3846002)(50226002)(86362001)(68736007)(25786009)(6116002)(5660300001)(575784001)(23726003)(2906002)(50466002)(305945005)(7736002)(97736004)(53936002)(8936002)(81166006)(8676002)(230700001)(386003)(6666003)(6506007)(76176011)(81156014)(33896004)(16526019)(186003)(4326008)(446003)(26005)(11346002)(110136005)(52116002)(316002)(478600001)(72206003)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1580; H:xhacker.debian; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =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KFkoa7lnbH1EJ+a3iLi6ioLt+FYBvBf++HmDPZTZMAhXA==; 5:gs4DFSSPDu1308hYxlgV8xGBaCZ2ubRMRvolf5zRGXYawJV/r3jbWv9ShEm6GNGHGT+6uv5Fb7XaiXtzUyEggO0hS87XzMXqb/P1xz5yrxmM1YFdPuGwhIth9aoHSHr55d3BkerDm+uWR2tn+4dS3iNZcog5xj4WCClczvY3XHA=; 7:LAbuh/LaEvBf+a/N8pmMMPkEE0hAQ2KVPToh3A+pKdx1DMYhyOtEhqZYELKDx/NcH2P1g7nCxFeyRwiuYw+HD7x3dVCLqLn24F2MiZ0RigVdTQ4vrciY6QNF/i+Qox/3o+ZBsKNks9FlrUjY0himPPmJ2gXarl9WkTVOBsJg5XK0xngclR8inZOLLvq/FHosvPxUo2bQfInAXN2LWe7mDmaBjYTJoCcetCqx0mJrgh8m+kAc2YSF86RX0AlGX6Kg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 09:48:33.6171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aad1736a-dfa7-4e70-90ad-08d5f213ca04 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1580 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180725_024848_710692_A18FAC86 X-CRM114-Status: GOOD ( 10.55 ) 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);