From patchwork Mon Dec 25 07:39:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen He X-Patchwork-Id: 10132327 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 8DB7260388 for ; Mon, 25 Dec 2017 07:58:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7170A28AEA for ; Mon, 25 Dec 2017 07:58:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64AA728AF4; Mon, 25 Dec 2017 07:58:47 +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.9 required=2.0 tests=BAYES_00,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 7DA3928AEA for ; Mon, 25 Dec 2017 07:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750882AbdLYH6p (ORCPT ); Mon, 25 Dec 2017 02:58:45 -0500 Received: from mail-sn1nam02on0065.outbound.protection.outlook.com ([104.47.36.65]:20560 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750862AbdLYH6o (ORCPT ); Mon, 25 Dec 2017 02:58:44 -0500 Received: from BLUPR0301CA0024.namprd03.prod.outlook.com (10.162.113.162) by BN6SPR00MB045.namprd03.prod.outlook.com (10.174.239.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.15; Mon, 25 Dec 2017 07:58:42 +0000 Received: from BY2FFO11FD001.protection.gbl (2a01:111:f400:7c0c::176) by BLUPR0301CA0024.outlook.office365.com (2a01:111:e400:5259::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Mon, 25 Dec 2017 07:58:42 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD001.mail.protection.outlook.com (10.1.14.123) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.302.6 via Frontend Transport; Mon, 25 Dec 2017 07:58:21 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vBP7wZku015517; Mon, 25 Dec 2017 00:58:35 -0700 From: Wen He To: CC: , , , , Wen He Subject: [PATCH] dmaengine: fsldma: Replace DMA_IN/OUT by FSL_DMA_IN/OUT Date: Mon, 25 Dec 2017 15:39:11 +0800 Message-ID: <20171225073912.30773-1-wen.he_1@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131586623040809302; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(396003)(39860400002)(346002)(39380400002)(376002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(316002)(16586007)(5660300001)(81166006)(81156014)(8676002)(106466001)(6916009)(6666003)(105606002)(2351001)(47776003)(54906003)(48376002)(4326008)(498600001)(50466002)(8656006)(51416003)(50226002)(68736007)(8936002)(36756003)(1076002)(53936002)(77096006)(97736004)(356003)(104016004)(2906002)(85426001)(305945005)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6SPR00MB045; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD001; 1:jGH8NTo3PU06CzQaGle4dQRErhN89yuc0DzKwXCsVsDYfJsCjw5zRCgdlNCzTf2uxjLSKKw6VWF6hgkSHEc0g1CTZefQQZaQz3iAnrEfR6ujokCdt6qvzMUI4Lgdx8jn MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ed27df6d-28c3-4d0a-6956-08d54b6d4601 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:BN6SPR00MB045; X-Microsoft-Exchange-Diagnostics: 1; BN6SPR00MB045; 3:9s3h+EMyJIqvBHAf+jBctsj255BllLUyNI2ZjrYOZPiuK+o7yMp7I9nUnVTQDSSLS8la6Nk+88Z9BSTJe+URk7V0AuqcFxV//JDGHbyfay3b7MSWRsrOYnd+zNm24P1BMgyY2fIsapLm1sgT1C/EiCRWH53l9szEjsFvM598l68esg+uP2xaJ82USDpgbTTH2q+RadTxU1/kRrKI2ldv0f2b2H90FieGoB6GJzUA+UM83tZtyk2fuTBsWR2X1upLzhdbcODOIC2k4Ej+L5EwoA8DIeQDBxFkHXsTeLMsBoUSk2Qnb9TehJi4AeQdV4YJSn5HN/2pQEBLPkx7tWYMvFmoFxfdhPDF9KxW1d1GiNU=; 25:VTizb7C3vEUnUG0y/UaEiH1Ac6q1TNHT5PvnkMHWL0+Qn0jUxIqo/JUQfeOTeViHiBbTCE2xru5pvSxr5RMBTsT7qPPefgrlmdSi7ENYlDNjSOdUBy3fHJ7hLNkS/5TKuiy9y1vF9jeWvJVeuV4BMCV6fALp7mPI4FgID4+Gp1ciH4XFc77JDXm0JSTaxj5eM0/6KvWReLoRjzMuPu9xGV21UzWfry9IhwJ76pNVNNQ9WQrBCDaFK+OQHlYM27lXgoep024yVXiRCiXGE0GDprbeUhMhquEWnQErETRxLhPn483Scz67RN4FcnPFCNpDbfpWtSd1h/umuI4lGwTvmA== X-MS-TrafficTypeDiagnostic: BN6SPR00MB045: X-Microsoft-Exchange-Diagnostics: 1; BN6SPR00MB045; 31:JOOR1p/El4h5HQpYkvGd2G0BeLKJRlpE16qXuYE53RHqp6WCOcoj9MO6LOo8sb9ckpXXQAAFXDvc/4JaT1rdUIWXP/Xj/1S0xGShMXeV4Eobhz4bd+Jnvhc9HcYnIeDmGUwVtAjEVviA+CD+D5l6jUWq8iRfDBtwBpAFVN4hHNiMqg66bGjkp7P3UqfAvW8qlya9BZUwVTTlReeecChqVt+H5J8tC4ENM2rW14RWrmY=; 4:7ytxg+zVeT0XkXS2cppsJovvAqexqIn58UoIFsOpEKkfqctIv2DZdfdvGYqkvx7U058GTNlt/WmR8BWCRadWvVGjktry6z3f49ldf51f97pTwSyxhbrwl3VE9ujx+v2t04dqUTZ+Womvf+g1enVIV+zdzz7vFqFDBqzdB24VXZmes4/VHVkcquheIgX6hAFoNm2W8kFNwV9pxI1VYtRq4ECifuC9e8CSeTmyAaL8UuIUNCswzKaolBZe5MwnXLWjo4q+uAKLyXLyISsqKveORr//R5tP8Mh8KTElr+TG/caSIp8Nmw6eRQPDOfGrAlma6UkGU3esOI87p3OdJqqSRw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3231023)(944510075)(944921075)(946801075)(946901075)(3002001)(93006095)(93001095)(10201501046)(6055026)(6096035)(20161123563025)(20161123565025)(20161123559100)(20161123561025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(201708071742011); SRVR:BN6SPR00MB045; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN6SPR00MB045; X-Forefront-PRVS: 0532BF6DC2 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6SPR00MB045; 23:Z2OPjJxyjas3EiqWsvEYucKrDV3V2dzQGHk0V+8Uf?= =?us-ascii?Q?CTxDmkErb7pC8lEug7H6kDO+SNYCq1yMwSxBtMqBkMITyzoD3DHJlCru4Gn1?= =?us-ascii?Q?nhNZ1rzGyAPhWDa/ly4iKvXIHIq2OonWuBCFd+Oc0It2xXhIfvNqHPn0aobY?= =?us-ascii?Q?yB8Brq3Xk2PMOm6iPwbDAkfs+2gvfGmL/7XfjqupJkqP5A69qeh0wLnKDlCf?= =?us-ascii?Q?Ct6Dd5IbDDf8alMUxWtzJmZmatSFyIy9Brg++K0ISeOR4G7yCUkdHoWrG+fb?= =?us-ascii?Q?lhebOlAMr0FzAIW4KVfOWyux2y0wjSf6UyIOw794TD+LwfMU4oWLJKP4WWlk?= =?us-ascii?Q?b2VDObz1vpDaim1U6LMMfQUVS2O9Y4BCvlDM1H8BoYTXpxMWm1Zz5YuUBDC0?= =?us-ascii?Q?rcl5LuO7epzejf35neO1WiRYfngMmEeRXoWGHckbRHDS78uhB5QMzimLQtyl?= =?us-ascii?Q?q5KV3C3gZvW95m12qlEj9MtB2kaV5kMDnwuXNe0np2gMejEUr23IM7LWKs7X?= =?us-ascii?Q?MZgAacmqhmUhdRSqSPZk6YeQmfNbWtlfOTDG6Gvz13zNehbfMHVlfB6f3rm5?= =?us-ascii?Q?Wj+uTjN6HvbDnX23HH87pCjuTp4yhG165xgauptkLQc/xwzKQjjQ+C4JdmOV?= =?us-ascii?Q?xfz56oB51NDABNUnNScBmlHghISm8c5EI4M5Ujgi6JyeyqDwOIYfJdmMVZMN?= =?us-ascii?Q?oiOHuhVu8L/rCVBoFlVqIZvPac+VNAZH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m71Q60mM++hy/dlfBsFjMpF1w+a6FBQ=; 7:0Bi+e6l1zGUL1ocBhkGs4FU01aNc4b1fVQuoaaJ1ofJarVMIzLVvVbStYrKnh0u8xZFLnAHY7x2jsi9yvgoLFNcemIqxavV5Ia5QPzknuR4ZyFTZq5xrU/cgL7iuPNpzM1DsxGFwEswglNRQws47e5u5vQ7E03K+/aCaZapg6fHxqSd9VB0/qpBPR1v4jY5Ntwsos3EE/zWAPnlTFH/LtgLMPDZ6xXnAY8rRTROJhKp+UpDtueY0YS82q1X+LbZb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Dec 2017 07:58:21.7877 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed27df6d-28c3-4d0a-6956-08d54b6d4601 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6SPR00MB045 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP using FSL_DMA_IN/OUT instead DMA_IN/OUT for implement a dma drivers standard macro call interface. Signed-off-by: Wen He --- drivers/dma/fsldma.c | 16 ++++++++-------- drivers/dma/fsldma.h | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 3eaece8..75479d6 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -53,42 +53,42 @@ static void set_sr(struct fsldma_chan *chan, u32 val) { - DMA_OUT(chan, &chan->regs->sr, val, 32); + FSL_DMA_OUT(chan, &chan->regs->sr, val, 32); } static u32 get_sr(struct fsldma_chan *chan) { - return DMA_IN(chan, &chan->regs->sr, 32); + return FSL_DMA_IN(chan, &chan->regs->sr, 32); } static void set_mr(struct fsldma_chan *chan, u32 val) { - DMA_OUT(chan, &chan->regs->mr, val, 32); + FSL_DMA_OUT(chan, &chan->regs->mr, val, 32); } static u32 get_mr(struct fsldma_chan *chan) { - return DMA_IN(chan, &chan->regs->mr, 32); + return FSL_DMA_IN(chan, &chan->regs->mr, 32); } static void set_cdar(struct fsldma_chan *chan, dma_addr_t addr) { - DMA_OUT(chan, &chan->regs->cdar, addr | FSL_DMA_SNEN, 64); + FSL_DMA_OUT(chan, &chan->regs->cdar, addr | FSL_DMA_SNEN, 64); } static dma_addr_t get_cdar(struct fsldma_chan *chan) { - return DMA_IN(chan, &chan->regs->cdar, 64) & ~FSL_DMA_SNEN; + return FSL_DMA_IN(chan, &chan->regs->cdar, 64) & ~FSL_DMA_SNEN; } static void set_bcr(struct fsldma_chan *chan, u32 val) { - DMA_OUT(chan, &chan->regs->bcr, val, 32); + FSL_DMA_OUT(chan, &chan->regs->bcr, val, 32); } static u32 get_bcr(struct fsldma_chan *chan) { - return DMA_IN(chan, &chan->regs->bcr, 32); + return FSL_DMA_IN(chan, &chan->regs->bcr, 32); } /* diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index 4787d48..94c0773 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h @@ -196,6 +196,7 @@ struct fsldma_chan { #define to_fsl_desc(lh) container_of(lh, struct fsl_desc_sw, node) #define tx_to_fsl_desc(tx) container_of(tx, struct fsl_desc_sw, async_tx) +#ifdef CONFIG_PPC #ifndef __powerpc64__ static u64 in_be64(const u64 __iomem *addr) { @@ -222,13 +223,38 @@ static void out_le64(u64 __iomem *addr, u64 val) out_le32((u32 __iomem *)addr, (u32)val); } #endif +#endif -#define DMA_IN(fsl_chan, addr, width) \ - (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ - in_be##width(addr) : in_le##width(addr)) -#define DMA_OUT(fsl_chan, addr, val, width) \ - (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ - out_be##width(addr, val) : out_le##width(addr, val)) +#ifdef CONFIG_PPC +static void ioread32(const u32 __iomem *addr) +{ + return in_le32(addr); +} + +static void iowrite32(u32 __iomem *addr, u32 val) +{ + out_le32(addr, val); +} + +static void ioread32be(const u32 __iomem *addr) +{ + return in_be32(addr); +} + +static void iowrite32be(u32 __iomem *addr, u32 val) +{ + out_be32(addr, val); +} +#endif + +#define FSL_DMA_IN(fsl_dma, addr, width) \ + (((fsl_dma)->feature & FSL_DMA_BIG_ENDIAN) ? \ + ioread##width##be(addr) : ioread##width(addr)) + +#define FSL_DMA_OUT(fsl_dma, addr, val, width) \ + (((fsl_dma)->feature & FSL_DMA_BIG_ENDIAN) ? \ + iowrite##width##be(val, addr) : iowrite##width \ + (val, addr)) #define DMA_TO_CPU(fsl_chan, d, width) \ (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \