2014-06-23 08:02:37

by Ruchika Gupta

[permalink] [raw]
Subject: [PATCH] crypto: caam - Add definition of rd/wr_reg64 for little endian platform

CAAM IP has certain 64 bit registers . 32 bit architectures cannot force
atomic-64 operations. This patch adds definition of these atomic-64
operations for little endian platforms. The definitions which existed
previously were for big endian platforms.

Signed-off-by: Ruchika Gupta <[email protected]>
---
Tested on LS1021 platform

drivers/crypto/caam/regs.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h
index cbde8b9..2825067 100644
--- a/drivers/crypto/caam/regs.h
+++ b/drivers/crypto/caam/regs.h
@@ -84,6 +84,7 @@
#endif

#ifndef CONFIG_64BIT
+#ifdef __BIG_ENDIAN
static inline void wr_reg64(u64 __iomem *reg, u64 data)
{
wr_reg32((u32 __iomem *)reg, (data & 0xffffffff00000000ull) >> 32);
@@ -95,6 +96,21 @@ static inline u64 rd_reg64(u64 __iomem *reg)
return (((u64)rd_reg32((u32 __iomem *)reg)) << 32) |
((u64)rd_reg32((u32 __iomem *)reg + 1));
}
+#else
+#ifdef __LITTLE_ENDIAN
+static inline void wr_reg64(u64 __iomem *reg, u64 data)
+{
+ wr_reg32((u32 __iomem *)reg + 1, (data & 0xffffffff00000000ull) >> 32);
+ wr_reg32((u32 __iomem *)reg, data & 0x00000000ffffffffull);
+}
+
+static inline u64 rd_reg64(u64 __iomem *reg)
+{
+ return (((u64)rd_reg32((u32 __iomem *)reg + 1)) << 32) |
+ ((u64)rd_reg32((u32 __iomem *)reg));
+}
+#endif
+#endif
#endif

/*
--
1.8.1.4


2014-06-25 13:48:35

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: caam - Add definition of rd/wr_reg64 for little endian platform

On Mon, Jun 23, 2014 at 06:49:30PM +0530, Ruchika Gupta wrote:
> CAAM IP has certain 64 bit registers . 32 bit architectures cannot force
> atomic-64 operations. This patch adds definition of these atomic-64
> operations for little endian platforms. The definitions which existed
> previously were for big endian platforms.
>
> Signed-off-by: Ruchika Gupta <[email protected]>

Patch applied.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt