From patchwork Wed Aug 5 18:28:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victoria Milhoan X-Patchwork-Id: 6952371 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 8E801C05AD for ; Wed, 5 Aug 2015 18:29:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A81FD205CB for ; Wed, 5 Aug 2015 18:29:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A90FC205CD for ; Wed, 5 Aug 2015 18:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753237AbbHES26 (ORCPT ); Wed, 5 Aug 2015 14:28:58 -0400 Received: from mail-by2on0114.outbound.protection.outlook.com ([207.46.100.114]:28832 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753199AbbHES2y (ORCPT ); Wed, 5 Aug 2015 14:28:54 -0400 Received: from CO2PR03CA0038.namprd03.prod.outlook.com (10.141.194.165) by SN1PR0301MB1583.namprd03.prod.outlook.com (10.162.130.17) with Microsoft SMTP Server (TLS) id 15.1.225.19; Wed, 5 Aug 2015 18:28:52 +0000 Received: from BN1BFFO11FD019.protection.gbl (2a01:111:f400:7c10::1:179) by CO2PR03CA0038.outlook.office365.com (2a01:111:e400:1414::37) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Wed, 5 Aug 2015 18:28:52 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; kernel.org; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD019.mail.protection.outlook.com (10.58.144.82) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Wed, 5 Aug 2015 18:28:51 +0000 Received: from stc-hedley.am.freescale.net (stc-hedley.am.freescale.net [10.67.70.12]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t75ISmA6019320; Wed, 5 Aug 2015 11:28:50 -0700 From: Victoria Milhoan To: CC: , , , , , , Subject: [PATCH v2 02/14] crypto: caam - Add setbits32/clrbits32/clrsetbits primitives for ARM compatibility Date: Wed, 5 Aug 2015 11:28:36 -0700 Message-ID: <1438799328-10757-3-git-send-email-vicki.milhoan@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438799328-10757-1-git-send-email-vicki.milhoan@freescale.com> References: <1438228709-27650-1-git-send-email-vicki.milhoan@freescale.com> <1438799328-10757-1-git-send-email-vicki.milhoan@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD019; 1:sgeF5U/rGNmj+DWNV2P9f+9APipGl+ymlRb7oTJjRER/OM8B7sETI2rzRxiBe+lAJVNAAkZ5sTYmuJ+aVZxAzfkoRcAI483Cbuq3Y0+byNp2Z6YDq224xmYKKn0jimtrxK0S06R9NTAkIAaxC2SgJp+KeACtQ23GRj56XxSEiVHqMBZRkY4gsJauRpqMVDqebXS/nXRtV5BbIuSR+LA7l52h+mBKCKwGaohbxHJTz0aZXnd1l8D4Riy8uigGrEKJZ4BwdPLW5F6VwpKvgzn8WM0Z1MNHNCnjiwrgoUYe3O6aYmFhvhhsJyLsOT1mGrGEcW7Tbigqyae0xizT7XQhZA== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(110136002)(4001540100001)(77156002)(5003940100001)(62966003)(48376002)(33646002)(50466002)(189998001)(92566002)(36756003)(77096005)(97736004)(6806004)(2950100001)(86362001)(81156007)(19580395003)(87936001)(5001960100002)(68736005)(5001830100001)(5001860100001)(69596002)(47776003)(19580405001)(2351001)(104016003)(106466001)(229853001)(50226001)(85426001)(64706001)(50986999)(76176999)(105606002)(46102003); DIR:OUT; SFP:1102; SCL:1; SRVR:SN1PR0301MB1583; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1583; 2:indnuoKJFH7/CIYBTcJq3Q/bOsGkFL0nMBwdQ3pZyHbh1/0STfwf0NPJnh2WXwvmuUT1DqDsJ1/eQWKz5XykSGBdvUL6fxB5jA2xvvtrRjYskeJqhtspzswiSSursJ7/bbnLOOGx+Z4FTvqhKAJV/BdV5iRI0UDENOP7lKCw2gM=; 3:6YYCLgTvv1Li+75hINXE8Mo8eLZp9p9uFEJiSAVIymnXNy2K+KEDIHzWJJPlInq9UVRulD3r5XVkfNS/5Sv61Z06IN/3XAxdbUyv/LJspemtqGcXIVlcr0zPevwF18zeg4iT2xDlyJOttZO7HA4k5qAgvCtLlgmIinPjD3dbV9uXSW7XFJiBd2DGcgiNHLuY0yzD6UIcLc5ijQVY10bT+VrVCThKniwiFTIz0LoFZRo=; 25:0WlZrNfSI87xjhirUaBQl/wNsf6oZQ6luj6bEwjurArIcmDGSr/kfGDCMu7SfvoXbAh10jB5hy6xXfnz4aWyx1GVHCCaLm5Wn91M4WCpdiYzIsWkukgR+MlxnzirPtsAASRB19IH6+ZcFHFYcpWD6CtzSmqaz/9Zs8U3KsKbYWW5Q1U9d+onJHk8wC3e0p3eWM3dn5GTA5yEgSoEvanaoSwS602Wzqd05si7pD5STuTwBRv1mUA6sO8ZkgOyocAUUCUdbkicSgLp62qqsFF5DA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1583; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1583; 20:wlIvah21CCU1SEDNjX9mk1iKLjaI+zQBfo7uNKu3vsY0JLpMF3AVlb+iKStstEGYgo3wcEwcCdi79012hPMHlfc54dfQvGX6uSV+MjtJO2G51Wr9st1SDHXwL1qjViOEHmnQSHDFxxzUfqgp1HTUEwW5mrZFLuH2ON/C+5v+VVTP+FhmvzhP//i43dO3np4GRn/f4suOgZWrSEf+Pz+z0Rx6pJPiC3jMCIbPYjMmXj+fiPfgAkrdNT4uxneMUSk+7fpEH0KEvlgkLCb+xL+IEF4kFxvSqnhjN7t1kRvlD+zPFPjzcbLk9jmDkQELfFcSsyQWsyVhmX59hJoibTOfHPEF6xVkRP0xrQlUFsyLH5w=; 4:wGTOz6/TP+/oiymTsda8NCGF8t2djLqemqPTLzQFSPdF2A/CcVCfBgTuuPz96WJdmxyfmkSRVsYp8iJMeOcQxkmlWeG5JxzrqVTFFsYquRS/kZy45LHhfx5lPm2p9BWA0Y5iMIkiG+VdgP8IRIPCJD2dt6oJl015f22HN7/Fm66i/sMXjxdm0YBKWsxynVwbqL/6JeqhWyVC1LLcQWxjIsvuIOy1iJNCwDeFG1TCNfGxsZHuwkq+CN4AtIwSf3R0OHHv5lJhh12D+61PWOILbO0DSQHTPz29GV+DbPwESn8= 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:SN1PR0301MB1583; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0301MB1583; X-Forefront-PRVS: 06592CCE58 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0301MB1583; 23:sjQqMKqF4ED8rjG0gcO1JlzjZnx8EoHfmpW6Rr+?= =?us-ascii?Q?9RLnqcmjn5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ii?Q?2r5V0/yDhCVVtIKaE+QE8gINgrWwXtv8XnEZ7Tlj2CutNhzK3Yl27bUnAUV4?= =?us-ascii?Q?16jcy7x1Mx1runlN7xc9CXO7EZNq/dxbaImc1CJ3jkQbbhpedtfePjSEs3jI?= =?us-ascii?Q?n5kYW9d+wekdkaXBaVSp2cYTSerEgOVnqAfX6/otv9ms/ec/VbDKYYEoesxo?= =?us-ascii?Q?Vha6XLzMiahM=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1583; 5:3E6WBXJo3IoRUOmRLvyZhLzdi/Zj9eyAyMm2zrFA0FpRcRPZqWqgmYTBgvga3j+Y5b7fMa9dxmEud+eZDnH6YJ8M2NipvBDqvmD+V18V/P7NUzQbT0KDn/TSd8XKKCXLxz2AHefauEbGUUtwkqs8fA==; 24:1KKRp/x8dK2RA8OziK/TJ4SKg1jQpAGt3FwWJl1KYnSXGSMHU3pjNkSddTZ3zEq+aPQHRO1gPga+j75xS0FRJeqgl3QamT8hyPbZhUctdrc=; 20:LdibLMdYXjZntyxXTH0HCXspGvsGyRK5w0CCG8SRcu5R2ecdKMX0zxMrOP6OR5/QlLpqrqwWZ70Ib7VXZ+8b1A== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2015 18:28:51.1412 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB1583 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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)