diff mbox

[v18,6/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64

Message ID 6d8df4be-a2da-5ddb-3b13-ca47d903ac80@deltatee.com (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show

Commit Message

Logan Gunthorpe July 4, 2018, 12:02 a.m. UTC
On 03/07/18 05:57 PM, Logan Gunthorpe wrote:
> To confirm, can you try the patch below?

Actually, scratch that: try this patch as I forgot the read side on the
previous one.

Logan

--

 static inline u64 cpu_to_caam_dma64(dma_addr_t value)

Comments

Fabio Estevam July 4, 2018, 12:06 a.m. UTC | #1
On Tue, Jul 3, 2018 at 9:02 PM, Logan Gunthorpe <logang@deltatee.com> wrote:

> Actually, scratch that: try this patch as I forgot the read side on the
> previous one.

Yes, this fixes the boot regression, thanks!

You can add:

Tested-by: Fabio Estevam <fabio.estevam@nxp.com>
diff mbox

Patch

diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h
index 5826acd9194e..796ff764dcbf 100644
--- a/drivers/crypto/caam/regs.h
+++ b/drivers/crypto/caam/regs.h
@@ -138,18 +138,26 @@  static inline void clrsetbits_32(void __iomem
*reg, u32 clear, u32 set)
  */
 static inline void wr_reg64(void __iomem *reg, u64 data)
 {
-       if (!caam_imx && caam_little_end)
+       if (caam_imx && caam_little_end) {
+               iowrite32(data >> 32, reg);
+               iowrite32(data, reg + sizeof(u32));
+       } else if (caam_little_end) {
                iowrite64(data, reg);
-       else
+       } else {
                iowrite64be(data, reg);
+       }
 }

 static inline u64 rd_reg64(void __iomem *reg)
 {
-       if (!caam_imx && caam_little_end)
+       if (caam_imx && caam_little_end) {
+               return ((u64)ioread32(reg) << 32) |
+                       (u64)ioread32(reg + sizeof(u32));
+       } else if (caam_little_end) {
                return ioread64(reg);
-       else
+       } else {
                return ioread64be(reg);
+       }
 }