From patchwork Tue Dec 26 05:47:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen He X-Patchwork-Id: 10132859 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 7931B6023A for ; Tue, 26 Dec 2017 06:06:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 636CD2E577 for ; Tue, 26 Dec 2017 06:06:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54A862E58B; Tue, 26 Dec 2017 06:06: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=-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 71FAF2E577 for ; Tue, 26 Dec 2017 06:06:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750708AbdLZGGP (ORCPT ); Tue, 26 Dec 2017 01:06:15 -0500 Received: from mail-sn1nam01on0077.outbound.protection.outlook.com ([104.47.32.77]:5280 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750705AbdLZGGO (ORCPT ); Tue, 26 Dec 2017 01:06:14 -0500 Received: from DM5PR03CA0036.namprd03.prod.outlook.com (10.174.189.153) by DM5PR03MB2699.namprd03.prod.outlook.com (10.168.197.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Tue, 26 Dec 2017 06:06:13 +0000 Received: from BY2FFO11FD029.protection.gbl (2a01:111:f400:7c0c::166) by DM5PR03CA0036.outlook.office365.com (2603:10b6:4:3b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Tue, 26 Dec 2017 06:06:13 +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 BY2FFO11FD029.mail.protection.outlook.com (10.1.14.212) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.302.6 via Frontend Transport; Tue, 26 Dec 2017 06:05:54 +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 vBQ669pg012139; Mon, 25 Dec 2017 23:06:10 -0700 From: Wen He To: CC: , , , , Wen He Subject: [V2 1/6] dmaengine: fsldma: Replace DMA_IN/OUT by FSL_DMA_IN/OUT Date: Tue, 26 Dec 2017 13:47:03 +0800 Message-ID: <20171226054704.14909-1-wen.he_1@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131587419550498847; (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)(346002)(39380400002)(396003)(376002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(1076002)(68736007)(85426001)(51416003)(4326008)(498600001)(8656006)(5660300001)(2351001)(106466001)(2906002)(305945005)(8676002)(8936002)(105606002)(50226002)(81156014)(81166006)(86362001)(6916009)(6666003)(53936002)(97736004)(36756003)(50466002)(104016004)(77096006)(47776003)(356003)(54906003)(48376002)(316002)(16586007); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2699; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD029; 1:YXxBavIQSZVGbmjn6zopg535lGpjTtw1p+5eaDfqv3oOrhCiA4/levO3F3sXt5tuA7FeXCUGpV2fRcRzRUzYEFgDM8NPl4HqspLPZ/2r90c+cKlTtVWrsn1iKFT9c+63 MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a2b3df0-eeac-4cb4-c01f-08d54c26b9ae X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603307); SRVR:DM5PR03MB2699; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 3:S0gTG6oZm6Ate36j7kb2U/Y85SOsXbthkGmEO6AunMvHILfsCGKHBpgxhAHsAw1MAT2SrCbPuq0qVBxrQI75xfEGP86V9cemMSa7QGKfEI0CgSAk5sG2egi/hpV1YkQcd+a1ZmQOhwTD+CGU1/YgcdBWMITR99c8y6mEyNGe0QiAScDqsZXnSxOCtGF0ZGCTt/7FMg6LQzuIjWyAtAizgFJhqadM74peN7NzN9sYi1NM+hd7plFu8IiVP5524R/9sxDP/ZXyusdUSuejQaEZtGWk36E04l4bvSXjDn3ZsUk8ZVYJ660AxFqjJibzESAWzNlipRF4egIMZIGL8XtZj4TLVn8A9X27UFX1l38BdZw=; 25:PMnbiXd6gJKNZlbrfqIiIQjQmNGff4LQ3Uf6Yh9PBf+3g4QDkW7H7gqlOY0iMoljfvuzPivK2+hSkTBoouhB2Cps73V9TGZu9JiMfjlaaMB/iVRjWaTGeu5mnxgyg762sQGpGY5C4IoDsMu+tXbCzUejYC7V+IZRKhPrYmmOeJT/w5BAPA0qWkzvha7KXmfuYQSRXVW5dUgvhbPqPw9XDu7/CzkN7gHIeAZjyHckww0IipCG3+Qj4e2dGu8Q1jXcRsP6UHuHbCx9EEQ922XZAlLdQD3inOXLW7Nb7Gi81iWTCag+31IP9EaehqCHHuRrCzYnlsKTLlj2lRs2jeaHaA== X-MS-TrafficTypeDiagnostic: DM5PR03MB2699: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 31:Yv3NiCQmYJ5Q0trY8c9egHFnhZIyidbY06q60N7jaQQB5kxr2stvxS8ayX3bRyFuZCS84ZwwEG9BkVVAGoRR34l7z91CrBIxbW4xh7LACYTtbB/ExfJGx4YmxfoYlSad+ASb38MHPVxSCSbxG7nJNwoUi44ZVcmZLJTkpbU79gIRn7sqzK5lLsuZsZDvEcGJARv6VMuiYbSvNz1iQ9YNiyq5CoCRnR35IjGrl/PADLI=; 4:hWKxIvuW3cKQlsFx3PmUFG8Tu5UxVIWIYYQkqM0Y1oiEpV2FkGBFHXpGVXktjJLdz3tlFUwTn+oGysrQhnuL9i2DLzmEnmp8+CUoqQ/J2X8qJn5l1KSAEQF07iC9aG1KCJ4138uqWuLwdeDXzFGAgdcPbxop/PaJafJG0RfUS8auLkgspo0VGtb2RM153ACUivSgmSi8o/w5DcnbaEwE+Dx+swrgBfRN4onZwhZd9KM51c71YioMPmjUvGWdDj3Eh1/m4medOGt5gTEvi0yVvo0SWgSepvrsE3xmkB5QmZJLhZKaTkQhtscA/EkH4EZjWmQdQQHvJ6OBhc4c6mH/7g== 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)(93006095)(93001095)(10201501046)(3002001)(3231023)(944510075)(944921075)(946801075)(946901075)(6055026)(6096035)(20161123565025)(20161123559100)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(20161123561025)(20161123563025)(201708071742011); SRVR:DM5PR03MB2699; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM5PR03MB2699; X-Forefront-PRVS: 053315510E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2699; 23:pS4xZhYU75sUgOu0I9wu4BYN+Epcsp4cDTttQccjX?= =?us-ascii?Q?iZvzEgnhbY2Ommtgu6XXvjpgHbhwhWrW2dCfoo9PzTnxdjpXInR4W09zNiyV?= =?us-ascii?Q?w2PlqTrZb0lYIYghbH20F71dMlGkVFJx2oogRnl1VtfvV1LF8rIEqkxaSeEH?= =?us-ascii?Q?bwh39VEk9eHqWNyNcI21YSIQSLOJFCVsxaU+hkFkdS8X5na4NNlzz3dXnPCS?= =?us-ascii?Q?4Hb0gLTlscKcK0PipKNbFhgyQ5pZEG1V1HKXx1oWUaLg+XMHa9SJBNTfjY2a?= =?us-ascii?Q?efoZwtMVduiDwdAoOX3kAJ+PQP28fRyrCmLNThM1lzHyoBiMmL5UiwgvzCzj?= =?us-ascii?Q?KlWqn/YvCtDIlIeJ3Rv9ZSFeQmIPwH/ziDopbHWUmYMxzjR7qOvgIq9LBlbw?= =?us-ascii?Q?0JoDijbCyIHJ6SsBqBKEisNZeh/TA0ED61zSlqiNOxNavykERWDsfF71lk7c?= =?us-ascii?Q?7KnCeFCCFiRWq+7uybN7vaySkiXmbH7DQzpGCU7C3UlCDioO3ur8rD2W0unP?= =?us-ascii?Q?AxeDkSORIjWQ+oZjUeiflyM677fC6uDB1shz+KMCLv2uU/0/1qDDLC00KaNe?= =?us-ascii?Q?w/PI4nAmNMFhJ3BdrjgqpWzDY5FNpTuvztC6mD2ps48N4Jx8SybmnSdRCUUm?= =?us-ascii?Q?iieC7sU73n6h+tgwdWUVB0QZWfrTOM1MDUR6qXUrm64JhvuwddABaC1jKAow?= =?us-ascii?Q?lrlT1zXlI7asA1I2IUnJsD4x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7gMJ1UPTws6dsZNup9yhPmjSAV6+uOtebbFdGJioG9pWZPKfhcZzZY8ZJLa9ExTbtAIwvLnrfk=; 7:lCKwC9wcJnfbzMeQ8twmPzUW9srEpFmo6uv+uj5sV72kF73w15AtSDHTZWyTEJ72sKGKKG7KfSH5sYS5oW0J5O1Pyl9Bh3tNr7rp8NZTAdXfCl7LT6w49mvL8zDU9f5edRfdZrZJbJpkfRApUOGBWqp0Pfk0up1dtvwiuQ22qpSiKLmdTVloQsEOoPQ07pumJb+IFxJb4DiTBBmX3sm/6rkfW+9IICq1EK43vjozBEv2SLA1SPaXLRuiC4ipXHgI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2017 06:05:54.8626 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a2b3df0-eeac-4cb4-c01f-08d54c26b9ae 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: DM5PR03MB2699 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 --- change in v2: - Replace 'ioread##width##be(addr) : ioread##width(addr)' 'by fsl_ioread##width##be(addr) : fsl_ioread##width(addr)' - Fix marco FSL_DMA_IN/OUT build issues in powerpc drivers/dma/fsldma.c | 16 +++++++------- drivers/dma/fsldma.h | 57 +++++++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 27 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..4c33a53 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h @@ -196,39 +196,58 @@ 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 +#define fsl_ioread32(p) in_le32(p) +#define fsl_ioread32be(p) in_be32(p) +#define fsl_iowrite32(v, p) out_le32(p, v) +#define fsl_iowrite32be(v, p) out_be32(p, v) + #ifndef __powerpc64__ -static u64 in_be64(const u64 __iomem *addr) +static u64 fsl_ioread64(const u64 __iomem *addr) { - return ((u64)in_be32((u32 __iomem *)addr) << 32) | - (in_be32((u32 __iomem *)addr + 1)); + return ((u64)in_le32((u32 __iomem *)addr + 1) << 32) | + (in_le32((u32 __iomem *)addr)); } -static void out_be64(u64 __iomem *addr, u64 val) +static void fsl_iowrite64(u64 val, u64 __iomem *addr) { - out_be32((u32 __iomem *)addr, val >> 32); - out_be32((u32 __iomem *)addr + 1, (u32)val); + out_le32((u32 __iomem *)addr + 1, val >> 32); + out_le32((u32 __iomem *)addr, (u32)val); } -/* There is no asm instructions for 64 bits reverse loads and stores */ -static u64 in_le64(const u64 __iomem *addr) +static u64 fsl_ioread64be(const u64 __iomem *addr) { - return ((u64)in_le32((u32 __iomem *)addr + 1) << 32) | - (in_le32((u32 __iomem *)addr)); + return ((u64)in_be32((u32 __iomem *)addr) << 32) | + (in_be32((u32 __iomem *)addr + 1)); } -static void out_le64(u64 __iomem *addr, u64 val) +static void fsl_iowrite64be(u64 val, u64 __iomem *addr) { - out_le32((u32 __iomem *)addr + 1, val >> 32); - out_le32((u32 __iomem *)addr, (u32)val); + out_be32((u32 __iomem *)addr, val >> 32); + out_be32((u32 __iomem *)addr + 1, (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)) +#if defined(CONFIG_ARM64) || defined(CONFIG_ARM) +#define fsl_ioread32(p) ioread32(p) +#define fsl_ioread32be(p) ioread32be(p) +#define fsl_iowrite32(v, p) iowrite32(v, p) +#define fsl_iowrite32be(v, p) iowrite32be(v, p) +#define fsl_ioread64(p) ioread64(p) +#define fsl_ioread64be(p) ioread64be(p) +#define fsl_iowrite64(v, p) iowrite64(v, p) +#define fsl_iowrite64be(v, p) iowrite64be(v, p) +#endif + +#define FSL_DMA_IN(fsl_dma, addr, width) \ + (((fsl_dma)->feature & FSL_DMA_BIG_ENDIAN) ? \ + fsl_ioread##width##be(addr) : fsl_ioread##width(addr)) + +#define FSL_DMA_OUT(fsl_dma, addr, val, width) \ + (((fsl_dma)->feature & FSL_DMA_BIG_ENDIAN) ? \ + fsl_iowrite##width##be(val, addr) : fsl_iowrite \ + ##width(val, addr)) #define DMA_TO_CPU(fsl_chan, d, width) \ (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \