Received: by 10.213.65.68 with SMTP id h4csp870983imn; Thu, 22 Mar 2018 10:21:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELuFm3Apj48TCEoH/QGqo4pvi7VF1md56q70ZoXbbPmJAegbxwrgnXY6ItEDVwwYHJEBFnV8 X-Received: by 10.99.141.200 with SMTP id z191mr18358690pgd.418.1521739290159; Thu, 22 Mar 2018 10:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521739290; cv=none; d=google.com; s=arc-20160816; b=Tp2HqA57ITL6DBELh9tE/oy8qyjixEwzMaQMh1QBb334jb2l/JUFOKrzXHh5PpZDC+ dE0/XMcVm4v9xu8xYye7l8ZCD30UztBlLaCrMfwoZFf93TyhmDJ5UDZSVS8UTE4VhT36 2v92T/YKEIcAmayh3fssPeuH821VlnpabEyU2b9MqijEHsraf6lG82NoEFtJIPxhZTCa mUoQor2OzSiD7KRs+ruYmekAUHfNC3pKeuM6UbE4djA+Dw4EJrRF4eDaFWmzWy7wIxD3 LBkQxa96IbOyG7AsaE55lhDmMvt0weT7w4MXpDnE8ITk2gLA1f8FivbVPKV2vJHAsoLh 9nTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:cc:to:from :arc-authentication-results; bh=I0mQAG6uuC+hyAVaFbO7lBUDJGoy/57bE5IwTmzt9Gs=; b=goE7V31iZu6QRc4VlZEDcUmYBrWWwQHV3hsH6pFuAOA7/DB+oJ9Rhga2H1M5tfdaOG lk8xKdn0D2ZWCrooldMVBn3YcIycziAunZ8Etq9zisuZsNU7ocsvPzpJlu3wXbMZ0MdF tSFFYYTwzo+q8KKKPRqE6d8krL8ld7eFEUONBMV/XEBa5oQoRMxhuRZrBgQd5sGzd5EZ Klk7WOI9wsIScoEpUQe6PIcQQCa8MSjVLH439BXoaOVykatAXX8jeZ74KP+ncc88KBAL dQc5g3nAanHD2tFPf+mm9D9qExnH2HmsgZbShSaCHoL/tx84Ns9GLC8UlKECArn1wXiL mk0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si4683221pgq.59.2018.03.22.10.21.15; Thu, 22 Mar 2018 10:21:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752122AbeCVRRR (ORCPT + 99 others); Thu, 22 Mar 2018 13:17:17 -0400 Received: from ale.deltatee.com ([207.54.116.67]:35164 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751995AbeCVRRM (ORCPT ); Thu, 22 Mar 2018 13:17:12 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ez3pt-00073N-Ng; Thu, 22 Mar 2018 11:17:12 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1ez3pr-00018d-AY; Thu, 22 Mar 2018 11:17:07 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-ntb@googlegroups.com, linux-crypto@vger.kernel.org, Greg Kroah-Hartman Cc: Arnd Bergmann , Andy Shevchenko , =?UTF-8?q?Horia=20Geant=C4=83?= , Logan Gunthorpe , Dan Douglass , Herbert Xu , "David S. Miller" Date: Thu, 22 Mar 2018 11:17:02 -0600 Message-Id: <20180322171703.4300-10-logang@deltatee.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180322171703.4300-1-logang@deltatee.com> References: <20180322171703.4300-1-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, gregkh@linuxfoundation.org, arnd@arndb.de, andy.shevchenko@gmail.com, logang@deltatee.com, horia.geanta@nxp.com, dan.douglass@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 Subject: [PATCH v14 09/10] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clean up the extra ifdefs which defined the wr_reg64 and rd_reg64 functions in non-64bit cases in favour of the new common io-64-nonatomic-lo-hi header. To be consistent with CAAM engine HW spec: in case of 64-bit registers, irrespective of device endianness, the lower address should be read from / written to first, followed by the upper address. Indeed the I/O accessors in CAAM driver currently don't follow the spec, however this is a good opportunity to fix the code. Signed-off-by: Logan Gunthorpe Reviewed-by: Horia Geantă Reviewed-by: Andy Shevchenko Cc: Dan Douglass Cc: Herbert Xu Cc: "David S. Miller" --- drivers/crypto/caam/regs.h | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index fee363865d88..f887b371040f 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -10,7 +10,7 @@ #include #include -#include +#include /* * Architecture-specific register access methods @@ -136,10 +136,9 @@ static inline void clrsetbits_32(void __iomem *reg, u32 clear, u32 set) * base + 0x0000 : least-significant 32 bits * base + 0x0004 : most-significant 32 bits */ -#ifdef CONFIG_64BIT static inline void wr_reg64(void __iomem *reg, u64 data) { - if (caam_little_end) + if (!caam_imx && caam_little_end) iowrite64(data, reg); else iowrite64be(data, reg); @@ -147,35 +146,12 @@ static inline void wr_reg64(void __iomem *reg, u64 data) static inline u64 rd_reg64(void __iomem *reg) { - if (caam_little_end) + if (!caam_imx && caam_little_end) return ioread64(reg); else return ioread64be(reg); } -#else /* CONFIG_64BIT */ -static inline void wr_reg64(void __iomem *reg, u64 data) -{ - if (!caam_imx && caam_little_end) { - wr_reg32((u32 __iomem *)(reg) + 1, data >> 32); - wr_reg32((u32 __iomem *)(reg), data); - } else { - wr_reg32((u32 __iomem *)(reg), data >> 32); - wr_reg32((u32 __iomem *)(reg) + 1, data); - } -} - -static inline u64 rd_reg64(void __iomem *reg) -{ - if (!caam_imx && caam_little_end) - return ((u64)rd_reg32((u32 __iomem *)(reg) + 1) << 32 | - (u64)rd_reg32((u32 __iomem *)(reg))); - - return ((u64)rd_reg32((u32 __iomem *)(reg)) << 32 | - (u64)rd_reg32((u32 __iomem *)(reg) + 1)); -} -#endif /* CONFIG_64BIT */ - static inline u64 cpu_to_caam_dma64(dma_addr_t value) { if (caam_imx) -- 2.11.0