From patchwork Thu Jul 30 03:58:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victoria Milhoan X-Patchwork-Id: 6898041 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5502FC05AD for ; Thu, 30 Jul 2015 03:58:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FF5B204D8 for ; Thu, 30 Jul 2015 03:58:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2558B20515 for ; Thu, 30 Jul 2015 03:58:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752273AbbG3D6h (ORCPT ); Wed, 29 Jul 2015 23:58:37 -0400 Received: from mail-bn1on0144.outbound.protection.outlook.com ([157.56.110.144]:1252 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752505AbbG3D6g (ORCPT ); Wed, 29 Jul 2015 23:58:36 -0400 Received: from BN3PR0301CA0072.namprd03.prod.outlook.com (10.160.152.168) by BLUPR03MB566.namprd03.prod.outlook.com (10.141.77.155) with Microsoft SMTP Server (TLS) id 15.1.225.19; Thu, 30 Jul 2015 03:58:34 +0000 Received: from BL2FFO11OLC006.protection.gbl (2a01:111:f400:7c09::175) by BN3PR0301CA0072.outlook.office365.com (2a01:111:e400:401e::40) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Thu, 30 Jul 2015 03:58:34 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; arm.linux.org.uk; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.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 BL2FFO11OLC006.mail.protection.outlook.com (10.173.160.95) with Microsoft SMTP Server (TLS) id 15.1.231.11 via Frontend Transport; Thu, 30 Jul 2015 03:58:33 +0000 Received: from stc-hedley.am.freescale.net (stc-hedley.am.freescale.net [10.67.70.12]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t6U3wUbb025418; Wed, 29 Jul 2015 20:58:32 -0700 From: Victoria Milhoan To: CC: , , , , , Subject: [PATCH 02/12] crypto: caam - Add setbits32/clrbits32/clrsetbits primitives for ARM compatibility Date: Wed, 29 Jul 2015 20:58:19 -0700 Message-ID: <1438228709-27650-3-git-send-email-vicki.milhoan@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438228709-27650-1-git-send-email-vicki.milhoan@freescale.com> References: <1438228709-27650-1-git-send-email-vicki.milhoan@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC006; 1:EttcvdDXTVw4n+PL54d3yNMk2j0fR3mIOGfx+abwbO380tU2VtvMvwx5qOBKNb/BGNMDJqZVYF8u5eXu16vY7rYTNi+0l2VgnhrSlL/oA1Z0/ZNvmWXm+iRQ5HdNu34g64Z6i3DYqm9sgLJlcn2xhbW2yGAB3FGjmoUuSMO/GurPm7370nfPysOQOkssUbk73IREC9ivRL4lkdkeNK/XZcA+V4rO9lKCIdhmNApDJjA9cDtRo/yTw3+Drc/otMKcy53uH5Ynv1CCGBpyHhdfKGNAVLrcicTO0V6qJkBn2EjBD2aTf89UqvTsosUESAt9EFF3fWDaU6mBg9fXBjjZXg== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(105606002)(46102003)(106466001)(47776003)(33646002)(62966003)(50226001)(5001960100002)(110136002)(189998001)(104016003)(92566002)(86362001)(229853001)(87936001)(2351001)(85426001)(36756003)(77156002)(50986999)(77096005)(5001920100001)(2950100001)(19580405001)(6806004)(50466002)(19580395003)(76176999)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR03MB566; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB566; 2:FGU78SXA5ncIw9w7vKcRXAEvsFENvOmrPpaEEkaS9yamSbfKiXDHtFqp51tXgLVqI7Vw9V8Zw86kMI+Pxg9vqRH6N0JeaMDj+EgslQRHvp2NEChRak7P/Zv/3YmNX/swPLkWg9xe5VUw0OvYH3EtBlONSSnZePmRg2X5ELpvwlg=; 3:OYcP4epuK0OVGbxxZ7cIIDhRXrwgcUYVeTAwuM1lKmLRTCd7WK8hlgyZtGMsSk9sHToo7i8UIKkS1crPoFQCKn9487GlKKzqlJE2HE0l2oZbhjfPqKAvkR+AyVtYVKgSfaZFxWNfchBPzW4CTW/vHiBg+Ev3+VIH8/nu9nEqPz4yNa/Cc7e9D5SiBXr5rnj41nlAPCcYdOHgpUIHFc4IPegZ5vhmu5QNWU3GXzibMT4=; 25:LzB8WYhGYWO3Jefa6vrBoCMNAwz/qc+gq8NE/5WMGV5IdR4v9QGUWb/66BPDKbVo4CXvaeEnWCTdZrh4SlftSUH/ybgy32cc/b5fSauw1mSoKUJXfRaLENqn/ZIINsPLz3XCCvB0kQF5uaVLafjxywt1OyiiOfHtTmGAcF1+JYdzBPYvRFZCkiKhirb+L9KR2eH2gWR8choWJv9ZCROEmKQhYIs4Nk8Knf6TQAIyHu2fg19q70iZDz7nustMiTlozBuev7lo0EZy0y3XNIdaJQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB566; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB566; 20:q50RoRRvUxYUPoLcFad+upu5tanC6DYnTV0uKW5xcpfqyj+oDHVGuY3Hxh+JN7OrPr3iBwrI+C0puIdVV8OwzW1FrRxNj0BYxPy9agKuL8KVybPAWxqxcJYC+CppUb4oHpYuXbT0NZHCgRRi1PonjlK9lvkvR923xOB92cHhkSvXRGLwEKr0sjN8EN5wJr60lDFKC4A57jbu7zlvjkYo++TDxJHKjdx3vxG7080mpuOQ/94tociULP7wS7CEw5hOvEK0QFiLvHzUWIS6z/kKnogybX6P0t/yK/KNm39lzY1snUeUIVX1Y1lvwq5ohzLjeIvhiVLqDJCMFqOa6Ct42wpgL1vFgBjiidGy2qELSRU=; 4:ef0s9FcGvR3nNwU6GOaLeifuwUCp9DKSXlFohxymsmUoRSmAg2Ay914UOjea9KJxNzAXkHvE4t2dLmMlaA4t4/J6ZOKNN9CxUl+xbJ9Cw47rHMsSZYNJ2ipiWb7jXRH7EPh56pwHu0/los/hXyWHylXwMR0Eim3QLvQekM1AB5yzjlr0XCPwfSLxm/raI/vcyRVREvfy6un65ZHxZklAohVoHv4RYc525sCk0V71+ZT34VxkhTZMxRzMPdkJ4vuRwJhyb5T1KCqAH9tCN68bUV9xx8JfWFgmwyieMnHAvyw= BLUPR03MB566: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BLUPR03MB566; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB566; X-Forefront-PRVS: 06530126A4 X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB566; 23:y7LxjXRXFv4s1QcIvIUPot9nNvT628XTlA/HBhls5bYYzcCJl00eVAcqgPpGQU+YgmzTs/pEb46Uqk4X9eXundjEEgkd3keArPj47fh9cjiGeCWxyvtL9jRCsxi4NY1R7be7fYy64ewWOGh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=; 20:xhmit3pAxZFcTy8r+TiQjOs6tT3KbHSxdEJL1FMoLMxxnH0owBHE59REsGifLPNxM+0ayuDE2qQJ6offq1TGbA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2015 03:58:33.8344 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB566 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add set/clear 32-bit primitives for compatibility with ARM devices since the primitives were previously only defined for the Power architecture. Signed-off-by: Victoria Milhoan --- drivers/crypto/caam/ctrl.c | 6 +++--- drivers/crypto/caam/regs.h | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 1891809..660cc3e 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -445,9 +445,9 @@ static int caam_probe(struct platform_device *pdev) * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel, * long pointers in master configuration register */ - clrsetbits_be32(&ctrl->mcr, MCFGR_AWCACHE_MASK, MCFGR_AWCACHE_CACH | - MCFGR_WDENABLE | (sizeof(dma_addr_t) == sizeof(u64) ? - MCFGR_LONG_PTR : 0)); + clrsetbits_32(&ctrl->mcr, MCFGR_AWCACHE_MASK, MCFGR_AWCACHE_CACH | + MCFGR_WDENABLE | (sizeof(dma_addr_t) == sizeof(u64) ? + MCFGR_LONG_PTR : 0)); /* * Read the Compile Time paramters and SCFGR to determine diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index 5e64352..3a2a788 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -65,9 +65,31 @@ * */ +#ifdef CONFIG_ARM +/* These are common macros for Power, put here for ARM */ +#define setbits32(_addr, _v) writel((readl(_addr) | (_v)), (_addr)) +#define clrbits32(_addr, _v) writel((readl(_addr) & ~(_v)), (_addr)) + +#define out_arch(type, endian, a, v) __raw_write##type(cpu_to_##endian(v), a) +#define in_arch(type, endian, a) endian##_to_cpu(__raw_read##type(a)) + +#define out_le32(a, v) out_arch(l, le32, a, v) +#define in_le32(a) in_arch(l, le32, a) + +#define out_be32(a, v) out_arch(l, be32, a, v) +#define in_be32(a) in_arch(l, be32, a) + +#define clrsetbits(type, addr, clear, set) \ + out_##type((addr), (in_##type(addr) & ~(clear)) | (set)) + +#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set) +#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set) +#endif + #ifdef __BIG_ENDIAN #define wr_reg32(reg, data) out_be32(reg, data) #define rd_reg32(reg) in_be32(reg) +#define clrsetbits_32(addr, clear, set) clrsetbits_be32(addr, clear, set) #ifdef CONFIG_64BIT #define wr_reg64(reg, data) out_be64(reg, data) #define rd_reg64(reg) in_be64(reg) @@ -76,6 +98,7 @@ #ifdef __LITTLE_ENDIAN #define wr_reg32(reg, data) __raw_writel(data, reg) #define rd_reg32(reg) __raw_readl(reg) +#define clrsetbits_32(addr, clear, set) clrsetbits_le32(addr, clear, set) #ifdef CONFIG_64BIT #define wr_reg64(reg, data) __raw_writeq(data, reg) #define rd_reg64(reg) __raw_readq(reg)