From patchwork Thu Jul 26 07:12:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10545337 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 5483B112B for ; Thu, 26 Jul 2018 07:15:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C4C12AD98 for ; Thu, 26 Jul 2018 07:15:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 305D32AD9E; Thu, 26 Jul 2018 07:15:42 +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 C39662AD98 for ; Thu, 26 Jul 2018 07:15:41 +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=UIfCezBEZ7IR7t BaB3SmQw8Uexuugu/7SaJw/PY94yHEaONh08eNYS1gNu1ErJrh3wY2nYlnPWS6SFH3Lw46q3w7FnP WiARVpWjcxAXqGMFaE8qpn47JNa3eYXCtaUNDpzCjOAnt6pjEoyhaPf1oQLJVpeZU5uVir/cuqJbk 31cRUPVUpf1kAkG8s80JTIjFuzYesu60vucbkNdoDQ11Em1HVFoaAPMXSkaFPHVPwV+DUMvWFPvkS PoIzdKjJOX2jWCccUQ8M+AVPpfLs3ex+Daj8X3SJa1nG7kM/ssjpLLl27kEssijGy9jJdbgJulB7L 7SzgbAqi9A1MNLgypXpg==; 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 1fiaUq-0001se-EO; Thu, 26 Jul 2018 07:15:36 +0000 Received: from mail-eopbgr680056.outbound.protection.outlook.com ([40.107.68.56] helo=NAM04-BN3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fiaUk-00019q-Br for linux-arm-kernel@lists.infradead.org; Thu, 26 Jul 2018 07:15:34 +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=KbADhssaK5tlwR6x5LIhoHCyDZd5JfwQkWkAYEQ7cZmzZa2m5SMubhjmYUKcbkOkco+5XCt6U2SKuowb/NTo0W0A0Ef2GdWQoWndkgrnm3BErDHRSZ9NpLXf1wgX7Qy8tfk5D6B+3MtYv6ghYH0zy1YUYamSETbDHwPErQMQh5U= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by BLUPR0301MB1570.namprd03.prod.outlook.com (2a01:111:e400:52a9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Thu, 26 Jul 2018 07:15:15 +0000 Date: Thu, 26 Jul 2018 15:12:55 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH mmc-next v2 2/3] mmc: sdhci: introduce adma_write_desc() hook to struct sdhci_ops Message-ID: <20180726151255.764aedb7@xhacker.debian> In-Reply-To: <20180726151017.4da1e336@xhacker.debian> References: <20180726151017.4da1e336@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: TY1PR01CA0140.jpnprd01.prod.outlook.com (2603:1096:402:1::16) To BLUPR0301MB1570.namprd03.prod.outlook.com (2a01:111:e400:52a9::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d5ce5c7-19ea-41a8-ce05-08d5f2c78a09 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:BLUPR0301MB1570; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB1570; 3:4mmWX5WdUnz++FpxK+ckNplyTPLIXCcpIjxNsTEHeOtmwtEG/g2/wRRl1ao+4lb6Lx0yRMTWMTdqxmc9odg8TqpOsemLwP7Iyn4nIpY/Sp+qN2LpM0DXzuIUtnRvoJQohCH28SqBQK63Wxkw4ylzONbmHJBIJiwpggLfK2rRANnDEyePBmbnYQbgpAhlZ3KXAwq2wQFj2GAvEs2Q2whU5DGiIKhBO6hJj9Uu1aGs3cmJD+WOmrZsHGO3mQ7X4D1Q; 25:pbyk/WlQEZt7EGs902XGMLv+ebUnL0JrMcsIGcdHm9QHrONqdQREvWt3yhkwrPJgdJeyyblyw4g9Dz+d61ZX8OF0WKX/mA71m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+5eykCnd/8PY9Bnq8JRjE; 4:En8HrnjrK5W36c1B0/XwHizZO39OvFvxGvVYwGa5sHp5zhq3J0H9AXBU/+dmOGfkl1ndgVHMNSGbVufu2uAq8gmIoUquYN8ma142TeuAC/YtVww3Yba0C5CeZ9eg/HTcJgc50t9zphzXG/uE+x92Xjiimlak8ud2FefQjdYqpQOon4CuHAhd2gPpUN6/PcWMRE7U8v2XTQx6HyGEYw4SaUxKxEkeng4dvZgOh/kFtqWD0hnDjCvBeocuyj7dtaMgh2rEHjCWBfWXaxAlC8ibNA== 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)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:BLUPR0301MB1570; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0301MB1570; X-Forefront-PRVS: 07459438AA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(396003)(376002)(136003)(199004)(189003)(53936002)(4326008)(50466002)(25786009)(50226002)(9686003)(486006)(446003)(26005)(956004)(476003)(14444005)(8936002)(55016002)(16526019)(68736007)(186003)(97736004)(305945005)(11346002)(7736002)(3846002)(6116002)(33896004)(2906002)(5660300001)(575784001)(86362001)(230700001)(6666003)(478600001)(81156014)(81166006)(23726003)(76176011)(6506007)(7696005)(386003)(52116002)(105586002)(106356001)(72206003)(1076002)(8676002)(110136005)(316002)(47776003)(66066001)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB1570; 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: =?us-ascii?Q?1; BLUPR0301MB1570; 23:VSgUW2dahq7NcCLIXLzVEjWmbEcPxVtioMlTwi3?= CbfqO2u4FzX+U100xN2lSWS8kSB4rAfws4aYqagVeoUbfr23TsLO2JRW0wOWuskr41g2aipr+WgDU9vNGEtIzPAUIGpiau5wnthWw3J26kQSQXxUfERwOSKdqoplf7w+PMtbjmnexWO2VQlYn3b/cesP+kYjoY59j6DcFv2qzIgvWChr9gPUGmmJqSIjVWMpn7L3w5LbQE/G95ltOe+BRVDe693SIxecYmMUgCf3DwXrczuUi63J0O03vR2nbiO2W9rV0s9j634wShqxR87UVNHp6xQ+GCYclszJP+SP8zRWExA1znloSZrJKrWT5+RGoMp6yW2xxDu4L0Dh1ca058i6xBFyQcEerIIpkhNpOt9OOzphHyKn86ALWVLHKitVswMT8QuUoMNIMP5ygRYvaefZTFsjSEK44eKjtp6zDtmDqPelq3ZWyiaQTwqAt/IJlLS+xvlA0VZgvgetwvi/0K5Cwkm1Rq/0yE0qSL5fsC4t6TCJeCcOA2URvUItg6suQ3/DYgNPhJROSzGYzid2903dpHQsDuP1ouhC8pnOPcxOd44oAmHPId5KOGLJ/wQBttalaxnNiwR+scu6PH7EoMPOFpv05IrD/fBwWK1ajxNkVwaaXLso5xV+qRqyPYCGWJciSCRZUMrxt9wZXlEc1ytt7RT/DfGQGUNsPR1KoQlOqli/3ItPajQQFx00lmae/Dn6BdDQmpuZjnHLMhcqrPD2PODEh8xZJu4VC1qV+/NSF2XhwVzzTykDxTISzEic/KPNIyl+EHG1t0RcuKuSx5d/FJMhR8WjYsrPFSGIpnE5PD3GkLmIW4bnRErUiBKLZvXrxNHxLI77b7qNnErS2XhRRacJy6lOjqxCETGBWYfFlpDDjdh7J26dl2A3cyYmWCcjU08yE1k8fOJtQiNMT/V62/gtD3m6toehVrowkcmYvreM+8q8ctFnKJhqqXCwXCVXVg2GZueYNGP3OyrhTR8/UDP+6xgNCZsSnB8SeNANYRz7xoYxhLy6ss88jRpmlwRov/oaO90AV2ejsuKwxUH6LE33X6qEGho1/5PJmAeNXD/tv5/J6l3tL50g3HcLUdveINpjZg69vU54JzziYbuxWKZIqYbIDy9rq36U/EoWQKNsqRZ+kd05L0prwbvpiSMA1I1KCauPKXVOJLP6gqnRDPmo5DdQUx3qoRinlqDARZXKzb0SRxkp6ILO1vK9TUZI1MqwXfd3MTGyb+/ys5eZw X-Microsoft-Antispam-Message-Info: kCrTuZkePOyQIEx8uCMwngL4bNF7CPbItTiLYz6w/VBns3GVPZnIdYqaR0RF2Tu+YwI07DEI8BDoBiAxISyhFOrh1tyZ5YaKQY6nAqRixiKXELOKXwrlkT6cD8uOvkrC5cof/538nhd7amF68/5PHxcIHdTYZWhBGZKLX/vzot+SlaHyK872LvBNQrR/p09r6qKbpI3afqLTfSqrhMT+61hIQhpQ9w6T66cUVnIhXNQlmof3+7alaIyRk60jQzIZjyUxi7Ig04P44BeZxDm3jd27hrf8UUcxkMQM/AMVZcP9Dfoucxj5tdvXiMJf7GPe3t8MSFCst/RVhHuDubch/LW51FJEewgIUY7czU/ASm4= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB1570; 6:IkDnlTs9wVFcPeGDLBi2IsmGNoIk45iSMwwu5JKVwX3rFvRmuFf45ZhhV5rjUtmqsXiFym7I3fsRNzdsVOF0h4HFKM9jV0pJ3kAOWAq64YPtSq0OzQVPtuJTXiLZJvhRtPhQkRkPXiW26OpSL6RBnGOhamLUJawEH/r89iuqANXCU/q4EtruhRxVUOXKro58Y8Z//wKKG+TU/aclIJZ0hVt7h9QVbMrraRc5ZL/kKnKArpzUkRNQikUGqOLviypgVauRslXo534omR8gkXrfC3sAxx/kow2Oi+ctoXXZS1FBf4Ll8FWmmhINfN6L7GQSKqfHhduPdFAuVyttFCbsWKWABQLyGO3Te0ie4YCgFG5gwtUAmQv3l61cDQAiQ45/05onFv30qvYS66w+avsWLXxqDYQmZ3UCBwErdawLruOjbwROuSg9K1P1/hun4yIV8D9pvfkffT6xOUK+YKBAzg==; 5:Gr1Sfr/xGm1mT5MHNvln0RBuGz6l7MXiEGQNo32Q1G4z9ANPjFE8Q7Ul8OsrV3S57Bes85E5y3e3AKh7moeRi8V9ZvvMBNHsEoiq0eMOPdtKjWOFzyBUxDnOLgTQSMAwxlWnMDJKZLGegOKbylMmvyR9DPK8HB0mzMzqp1mfM/Y=; 7:rPYUzcOHBX5zEp1q+V2XDb4elZmTjSDp7sU8EXvK+FxL1346JDFmUowYvJrnQULPFoqVfk2J4888pd42FToow69N5t40OFAy+oDRRVRgVpPtPK7kB0And6GBpsExuzKQIfi7BGaQ4FCZuyo4Ncry5SCIDAmECIDHhy1XaPHoHcclVaSijue9jTtQgcU0hPIB+PB9yWqWIXDcoglqAyneETeuuwb44hL4voGJfWF+ExcVNWiYyorr1CsRUVYX8ITH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2018 07:15:15.4855 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d5ce5c7-19ea-41a8-ce05-08d5f2c78a09 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0301MB1570 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180726_001530_591753_3CB0C0AF X-CRM114-Status: GOOD ( 10.27 ) 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);