From patchwork Fri May 25 11:19:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen He X-Patchwork-Id: 10427139 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 14EE36032C for ; Fri, 25 May 2018 11:20:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D72F295D9 for ; Fri, 25 May 2018 11:20:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01A9529644; Fri, 25 May 2018 11:20:49 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 420D6295D9 for ; Fri, 25 May 2018 11:20:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966069AbeEYLUs (ORCPT ); Fri, 25 May 2018 07:20:48 -0400 Received: from mail-by2nam03on0109.outbound.protection.outlook.com ([104.47.42.109]:47899 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965964AbeEYLUr (ORCPT ); Fri, 25 May 2018 07:20:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freescale.onmicrosoft.com; s=selector1-freescale-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cHwwmNbyuQeHIyu2GgMp7vjnIKcx+jnjCzMdLqQUTm0=; b=XnS9OxHuXBBglmH1fGfZgzng1nbwKnSlEO+tuSD8KTkqwMDY2aBQgrBLySSGPoSTQ7/E1mEfcE39XY6g7oG0hIbL715ip8+uP/kFMBTtCUsIVy8cyXqB4v+Ra9pyHtVbPinfZGm7mCcSI1nzF+48OosEhl6ZEjvZlSa5623bV04= Received: from MWHPR03CA0025.namprd03.prod.outlook.com (2603:10b6:301:3b::14) by SN2PR03MB2191.namprd03.prod.outlook.com (2603:10b6:804:c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Fri, 25 May 2018 11:20:44 +0000 Received: from BN1BFFO11FD002.protection.gbl (2a01:111:f400:7c10::1:179) by MWHPR03CA0025.outlook.office365.com (2603:10b6:301:3b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.776.16 via Frontend Transport; Fri, 25 May 2018 11:20:44 +0000 Authentication-Results: spf=fail (sender IP is 64.157.242.222) smtp.mailfrom=nxp.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 64.157.242.222 as permitted sender) receiver=protection.outlook.com; client-ip=64.157.242.222; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (64.157.242.222) by BN1BFFO11FD002.mail.protection.outlook.com (10.58.144.65) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.735.16 via Frontend Transport; Fri, 25 May 2018 11:20:42 +0000 Received: from az84smr01.freescale.net (az84smr01.freescale.net [10.64.34.197]) by tx30smr01.am.freescale.net (8.14.3/8.14.3) with ESMTP id w4PBKfaT007449; Fri, 25 May 2018 04:20:41 -0700 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id w4PBKcZn012285; Fri, 25 May 2018 04:20:39 -0700 From: Wen He To: , CC: , , , , , Subject: [v5 1/6] dmaengine: fsldma: Replace DMA_IN/OUT by FSL_DMA_IN/OUT Date: Fri, 25 May 2018 19:19:15 +0800 Message-ID: <20180525111920.24498-1-wen.he_1@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:64.157.242.222; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(39380400002)(39860400002)(396003)(376002)(346002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(110136005)(50226002)(54906003)(305945005)(8656006)(97736004)(316002)(16586007)(336012)(4326008)(2616005)(476003)(356003)(6666003)(50466002)(486006)(86362001)(126002)(36756003)(47776003)(105606002)(106466001)(51416003)(48376002)(2906002)(85426001)(8936002)(81166006)(81156014)(53936002)(8676002)(498600001)(5660300001)(77096007)(26005)(1076002); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR03MB2191; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; LANG:en; PTR:ErrorRetry; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD002; 1:PiBNS0iVMIeFWUaFstwUmD9KKHcPbVc1289XFF7s+QTFOsy6GNyCqcfU0LmJ+mUl9oSvOeD/g+63eW5X+cbwkC78l8tReW09Bvgq59gAp1rMWqdNxWzz9y1IbVZASFSi MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(2017052603328); SRVR:SN2PR03MB2191; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2191; 3:acyMUjDoa3jPmKC4iOZhXDVh+tSekU0hR+kYOzh+T0bvpykVSqrfbEtAflESP1gRAQH6V6Nu0xXDWKhh2+ZU2O049djmlX++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c8//TKQVUzh5Ix19Yjj/KUqv522qakuT9d9RZ5WQ4KE0scmaxvS1AWL6My12EGUa+gs+yhFi2ubr7oOTwrpi2nEQWje9tFFgUvX3KtHpu4uH1P7CwVKLldnN3iXLXw4aLYDSfu997jBhlTuY/uiwYpW83V9Yr/jKi92wQGjgQgKiGULEdWROPvvR+Z1saRXZFisNt+xRybrUJsNZ+/nwWHJcIScAlDJA4M9D+epY5lPtZ9Eti8IwvvC0dOW+61PO+1SNjdIsjCMwbB4JMApJp5adCdn/6ftufEbjH7LqmwjuADZlsg7nDZkjsCo9ooqJTLRBVi3cbk3iOc/fp6RaXwrhbEvDr3qDcqNexDzZUZjX8WP+L69HTSMyB7Z6wL3qfFh+YE1+bdUmbooQBnCSmQqMFHgnACidKcMK4TjTxThBpeHqnF/BK5vt7gEmXDVvPZ+gNXM0633o+uq2KIDsq+J8gp/Pfqc/0fYeq30V7dxs8SQy8ua7xcKJYUeT+7LXVEmBYBLXaQTo0I= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(788757137089); X-MS-Exchange-SenderADCheck: 0 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(93006095)(93003095)(3002001)(10201501046)(6055026)(149027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061750153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:SN2PR03MB2191; BCL:0; PCL:0; RULEID:; SRVR:SN2PR03MB2191; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2191; 4:FDLUq3J6qFFmz5QePDRqBqSM0qauwBaz4wexkQJnTKs8mDPrbLmCghyAD/lza80BfIDqykvN7ovBt/67VQiu2LkVMxfRRhccCvspK60VZkkRzfAV7qfRSgNZ2nZW0Jm5afAvUwAzKDVLUiQ6cp8LcfoO4W7s5g10OBEQElaCzPcn07RLFb32qL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OG45ijDLpXdwnZ0rkzIJ5uk6Ue/Qoj7AE3ed66grwRn/cqCOAZFuhoMhiO4aL7yc0kNqCvQUm7tG5ai+yP3MYMG5bn1UKvrFTAh41K3Pc1+ckP08g0JbSh0C6iMHIyfOamHCV566Rk5EjSKpBtHjg==; 5:ADT5qY7Q1/2jc7/UJq8AxKvATjEhWoJw0fSFfOozooL6P7rQZVVQHmDfmY5S9ZDzkRScqXbGrv3orqhOxFuYy1aXyEBWjwU+nG3fqu/98MGeR4bHvbiy7R2V9xzz5loT13jMire286PiKxaF8f4diwEBlC/Pm9Ya4mje1oRWAmQ=; 24:b2/gx+ninE16SrvQazQRxGMVIl9lv3U8NTqqXMxVcJYyVL71Uhc+4fyp1ALjWN9BgeqxoBYCspQvYvYKbPf5gKQOs9gloYrNG3huWCnt4gM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2191; 7:iGEsAaUP8SsXeJi3OXhYuRPHF3Ao9aFvbiC2+X7RLyWRhD22nA5e1NNxs/wWsVmtT2hsTxEgEJxEsFAs3fRIvFEG1+PA0LEEM8XgVIlB7dR8Ugrg8Gg8EbBq2OqThD74mHjTIZN50bfwY+UWMgLnDjIasmK2OyGsnJBgJtTM2fL6JDLTHJWLOWWv6SBQn8pGOb5GIrIzz5cyNWr7igKHyXtHnE7wlD84MeP/WCeGXwCIDI/M8YEx3x1NCmJmxJUA X-MS-Office365-Filtering-Correlation-Id: eb4df198-fffa-4999-9cbf-08d5c2318d58 X-OriginatorOrg: freescale.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2018 11:20:42.1658 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb4df198-fffa-4999-9cbf-08d5c2318d58 X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[64.157.242.222]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2191 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch implenment a standard macro call functions is used to NXP dma drivers. Signed-off-by: Wen He --- change in v5: - no change in v4: - no 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) ? \