From patchwork Thu Jan 11 09:32:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen He X-Patchwork-Id: 10157701 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 464A1601A1 for ; Thu, 11 Jan 2018 09:51:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BF6C23201 for ; Thu, 11 Jan 2018 09:51:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3019E28417; Thu, 11 Jan 2018 09:51: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=-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 71FC123201 for ; Thu, 11 Jan 2018 09:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932369AbeAKJvl (ORCPT ); Thu, 11 Jan 2018 04:51:41 -0500 Received: from mail-cys01nam02on0050.outbound.protection.outlook.com ([104.47.37.50]:27136 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932316AbeAKJvj (ORCPT ); Thu, 11 Jan 2018 04:51:39 -0500 Received: from CY1PR03CA0002.namprd03.prod.outlook.com (10.174.128.12) by CO2PR03MB2360.namprd03.prod.outlook.com (10.166.93.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Thu, 11 Jan 2018 09:51:37 +0000 Received: from BN1BFFO11FD006.protection.gbl (2a01:111:f400:7c10::1:198) by CY1PR03CA0002.outlook.office365.com (2603:10b6:600::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Thu, 11 Jan 2018 09:51:37 +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 BN1BFFO11FD006.mail.protection.outlook.com (10.58.144.69) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Thu, 11 Jan 2018 09:51:04 +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 w0B9pXbT025528; Thu, 11 Jan 2018 02:51:33 -0700 From: Wen He To: , CC: , , , , , Wen He Subject: [v3 1/6] dmaengine: fsldma: Replace DMA_IN/OUT by FSL_DMA_IN/OUT Date: Thu, 11 Jan 2018 17:32:10 +0800 Message-ID: <20180111093215.12636-1-wen.he_1@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131601378651924237; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39860400002)(376002)(39380400002)(346002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(8656006)(16586007)(106466001)(97736004)(305945005)(86362001)(316002)(54906003)(356003)(105606002)(1076002)(77096006)(110136005)(85426001)(36756003)(5660300001)(48376002)(68736007)(50226002)(2906002)(81156014)(8936002)(6666003)(53936002)(81166006)(498600001)(50466002)(8676002)(4326008)(47776003)(104016004)(51416003); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2360; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD006; 1:Kby2xc888Gvd8u1TWQqm738YSgDshUpcQXNHbbC9RKUBwKXUVMAvT0gC5NRbMxnGi9i2aMZQXLxs0bjk7MQonrPVxaZZvXIDMraIukbVMtxa8RLngR79nbUYE0gYeTuu MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 55d5959b-5c34-4efa-e70d-08d558d8d4f6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:CO2PR03MB2360; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2360; 3:mdowENYglsErUZ1o1ng7olGT4eGZ9WDCIhYBHY8df/DrT+5kftsODhXxJFOUZq79LlnohpolZueLoAlpjNjbw72AEg2fsAc7svID4/bzNl9jmdEqZCf7xJltm3T0pFNVK3+Xzr2ekN4oYUW30MBAb10/kUk/ts9Q3oV8F/JQVSBmFFBvFvLarNEhXmZnH/DxXZkcMLrvzZ6GYoJwa4XTyrPgglpsWIHqtwSP7VVyAKrHK8YO7s1+1c4QkOiRyPRk4vQybU4T4n1JS/OCwW6wfo1ZBXeBItUPD0BJy5ktCUq6xKOKivBVYRcShvNz8bAMExoKkT2EYkWyvGpdFvtn+myWIkzIERsJUdXyZ6cOs1k=; 25:fKrVpVkkNPGOAuY3PCWg4P0s/Y5AfPpeAkn8kYxrr+Wk9GEyf8aheGu72cVO8KEUc1sBaJS716rI4zW5bznAYJ8cdWFAxwTdimcY+qVYuj1SR8tJVyLM3a8CAoi6G/lDP0I/jt7UM99RxwG2cXt1gJ6z8efOLRjSPjOfmILwY433Tf6B7iznTaBGRDq44cnBNDSpKyJFW/Y6cFk1pyNTyQzMEEm99zKIXmSgE/mCBDke4UkmLfeJubxz3ahDZfm4g80R/ZJS67HxcvLHcv9aA28vQDrurKS2FhheR1gE8FE+g05x8TyZza+RSi4Vf8V/uTpu2Yr5vmYOrBzJguDk7w== X-MS-TrafficTypeDiagnostic: CO2PR03MB2360: X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2360; 31:m7rmSyGmaKx3Cw3+nwXxRkTlyJOTHYxelJ1HGAM2xpH6AkApxZCv7V9QZjuq+xYLY0sPY9KhOfXY72os70dmGuXodFtgwBDY9R7PAPQ9DHqg2i5fxbYbzRNYL4uXuow4WkajzsumzTRTwga7jT+8879QcAu3b02GMJoJ/deC5MXc2H0i0/jEqeokimfhnQIUOiSxgbIZSuyadBZDFubU57aUcp9+o62fb2pSQk4x17Y=; 4:aD0LFlh5aJh7B5rHR047mUWVtYrm0//YM2QvP4MhogSfsHP+tls6cCmAKt9zmdyashYgRfWCe+wccs+LgcvsvPQWpKDWfAHyRXfIxryjZ/Y/SHPgaCi45RuDkmaDkEuihy19oVutBStkUS1Xdwtr1i7eXuxQQ8njwxTJcTY8N2fN+7gaT1UyBPiuy38TeJs9S931EfZ3n+QRQ6sKMqrR0X+CLMULrB9JMR0poavcHLqgNKu1SLI4R8XxnZ3dqQNth4hDWMFX5XyenbkfkDjfvL8tEjA2BEmLPp+KUIvizAUj38Bziq5Xay231o+iJ5/gIJZ3IHSkyY1SQlPRnSHniQ== 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)(5005006)(8121501046)(10201501046)(3231023)(944510075)(944921075)(946801075)(946901075)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123565025)(20161123561025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123563025)(20161123556025)(201708071742011); SRVR:CO2PR03MB2360; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CO2PR03MB2360; X-Forefront-PRVS: 0549E6FD50 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2360; 23:pVw20aV2+vcHUh4COORdgwcwvAeY/fKW9/5m16tCH?= =?us-ascii?Q?lVDs5LDrv3520S5JuWDPr43gPJ6/4ZXmtdbRBSONdJFHawZzrG2NWnpvJQa+?= =?us-ascii?Q?S5zXDiNUdwBSqaIl5ft6HW3cFtvfU+wS1NTdy4uKEobtXOUP7H1RBniCYVTs?= =?us-ascii?Q?M2PbNKX41BlHpegHWsQW1xK1J7gK9ykAU8OlHX77AdT9C6ZMwI14NZqMUtPn?= =?us-ascii?Q?sRZ0BDOdZXfUbNU5TTAaVbdJm0TGp4DOicZoGJNWF5Iy6w6M2xT2mdC2GL7L?= =?us-ascii?Q?IGyP8TDWwF5xEbFgvvac2SMlJTMtAqfPce3irwv3gqQVicz8HS0vPcS/icC8?= =?us-ascii?Q?x+PxvWsIjhjWIc9Fli6PPFuvLL3X8eN6JXMdYi7KFzI+JQmJGrn0FXu8OmdW?= =?us-ascii?Q?mfdKdf/K5VdIGsPADq/CkRGwnNYgpx1SvQV4N9KpFmhoy7zRKUECnrXIKgEf?= =?us-ascii?Q?B4tLwI/Ng7hbn3wm9VbWNl0Tf36EfaPcHDq/lrRxfEu2zGLTZoZZ9ETD/P9+?= =?us-ascii?Q?WYUlNL2umqBj2Ry8or5XAK9cbGXojtE40yzO5k/acYiIl/WKWQ1GbhUFhSml?= =?us-ascii?Q?vqnpvzPXVFqykeNHoh7VbqTMVVs/P0sSw9hlwjmEUBr8rkn5/npyDDzKWEni?= =?us-ascii?Q?XSz7xoKAzRwFR0AVtL8c2xyshWAcpGLHLGMtgIJwBTjae6sWYHvrdNgWJGEx?= =?us-ascii?Q?y3OkkoL3+5gob2lGE6TLdLJAuhikm8i56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lrqwTmKGUYSknET+8X1iNODUCvYVlCnmtXblXPBSzuQAhEx1VN/SgWLZrgCiygs11aYy+HyUSViEXurDhRwqCpDRCaTix66ZqIXlPet311OQcWE3lh10rj1aMYDJM3GJEZw91ebHARPYkmHslUhJTaO4NO34H8eYD5dct3kJKYSPGKbNbm8MO/ajP60WKt2kQFTfcbrOR6pZHz7EXct12N5+eZ6JVXZMyb0TUXOKTObYxKItZAS3hGUSC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2018 09:51:04.9272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55d5959b-5c34-4efa-e70d-08d558d8d4f6 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: CO2PR03MB2360 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 v3: - no change change in v2: - Replace 'ioread##width##be(addr) : ioread##width(addr)' by 'fsl_ioread##width##be(addr) : fsl_ioread##width(addr)' - Fix macro 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) ? \