Received: by 10.213.65.68 with SMTP id h4csp1399090imn; Wed, 21 Mar 2018 09:43:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELtdFgDHVGA7yWx51FqJvq8z1AyX1ZHDivNQWhO6h0m011isc4eFe/JHuNMT+jiDiRbu353z X-Received: by 2002:a17:902:20c9:: with SMTP id v9-v6mr21926526plg.41.1521650610406; Wed, 21 Mar 2018 09:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521650610; cv=none; d=google.com; s=arc-20160816; b=D/ukNy6rVuj9FR94UqCDXpBe7bJSO/OEe18zDkqYRshCnLT8nKZQG4wgB/RytfInl0 owUe+e0R2Sy1Vl0aEX7oXSy2XTCAlhv/XYV+GeftlgbL3Yjb96zqysKZgYJ6CMbUIf28 1m8XWfinOoHDiNEgZ5bPkJfIpXlX1fxQgWP3qlGgdTwvi7Dk0ExcWVGEsKlU3NiUNfF4 AENVUr12fQ9q5GX9alZU0W/A3Bu4e67cgdH+BPTK6mEdqtTTU7/DfyKy09piSjRVZ6VT UOl5k6yTFQdk4GCiouXeiYHrtJ6a34k/zd1qiy7rTHNEJ4FcoIm0x+cwDyVn2CLtO/lT R5Jg== 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=VScL5+GQvjqTdu4kyTkUM9KO2YStlRE5s+DVLwEW3V0=; b=pNeYrOSO+1FprxTCsKXqdGl9WS3JA/In/PGiy1Z6QISemE+4svMAwqn6fi4FFC8IMY b8Nbj2EPj0Pgr+CXBuckbW8kx+jPZeC2SnM0KtvfwME7qh48pqvdkAJBEJlc5K1Z2Bhu F8q7fc73cUqBTa90kBCg74mnA815+bs+9pWV0UFltNMtlJI/mQko8288oF8CBSjWNcx4 MFL2GW1cLWtEaa9ml+6gOv/JzN0h633Jo7G8nVFxdOkfdULmdCUKRm+UtfJVAbZZrGmb dZBWcD7hP3DVqIKmF8lxWzl+0/u2Prl69H3wR2tJeS6jZD73nUPnT/EDOvkLtFWNrVvH EFfQ== 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 s6si2979113pgp.577.2018.03.21.09.43.15; Wed, 21 Mar 2018 09:43: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 S1753061AbeCUQif (ORCPT + 99 others); Wed, 21 Mar 2018 12:38:35 -0400 Received: from ale.deltatee.com ([207.54.116.67]:56616 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752883AbeCUQh5 (ORCPT ); Wed, 21 Mar 2018 12:37:57 -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 1eygkL-0007W6-J7; Wed, 21 Mar 2018 10:37:55 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1eygkH-0003DR-7t; Wed, 21 Mar 2018 10:37:49 -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: Wed, 21 Mar 2018 10:37:44 -0600 Message-Id: <20180321163745.12286-10-logang@deltatee.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180321163745.12286-1-logang@deltatee.com> References: <20180321163745.12286-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=-6.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 Subject: [PATCH v13 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ă Cc: 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