Skip to contentSkip to conversation

dmaengine: fsldma: Add 64-bit I/O accessors for powerpc64

DISCUSSION Vinod Koul 1 participant 1 message Jan 19, 2019 dmaengine

lore
Share & tools
lore

Vinod Koul

author maintainer
#0 lore raw
Quoted 4 lines · Peng Ma

Hi Scott,

Oh, I did not see the in_XX64/out_XX64 supported only __powerpc64__ just now. Thanks for your reminder.

Can you send the formal patch for this...

FWIW, fsl patches were not merged last cycle because of reported regression...

Quoted 98 lines

#ifdef __powerpc64__

#ifdef __BIG_ENDIAN__
DEF_MMIO_OUT_D(out_be64, 64, std);
DEF_MMIO_IN_D(in_be64, 64, ld);

/* There is no asm instructions for 64 bits reverse loads and stores */ static inline u64 in_le64(const volatile u64 __iomem *addr)

{
        return swab64(in_be64(addr));
}

static inline void out_le64(volatile u64 __iomem *addr, u64 val)

{
        out_be64(addr, swab64(val));
}

#else
DEF_MMIO_OUT_D(out_le64, 64, std);
DEF_MMIO_IN_D(in_le64, 64, ld);

/* There is no asm instructions for 64 bits reverse loads and stores */ static inline u64 in_be64(const volatile u64 __iomem *addr)

{
        return swab64(in_le64(addr));
}

static inline void out_be64(volatile u64 __iomem *addr, u64 val)

{
        out_le64(addr, swab64(val));
}

#endif
#endif /* __powerpc64__ */

Best Regards,
Peng

Quoted 60 lines

-----Original Message-----
From: Scott Wood <[email protected]>
Sent: 2018年12月24日 12:46
To: Peng Ma <[email protected]>; Leo Li <[email protected]>; Zhang Wei <[email protected]>
Cc: [email protected]; [email protected]; Wen He <[email protected]>
Subject: Re: [PATCH] dmaengine: fsldma: Add 64-bit I/O accessors for powerpc64

Quoted 33 lines · Peng Ma

Hi Scott,

You are right, we should support powerpc64, so could I changed it as fallows:

drivers/dma/fsldma.h index renamed from drivers/dma/fsldma.h +0 -0

88db939..057babf 100644

drivers/dma/fsldma.h +0 -20
@@ -202,35 +202,10 @@ struct fsldma_chan {
 #define fsl_iowrite32(v, p)    out_le32(p, v)
 #define fsl_iowrite32be(v, p)  out_be32(p, v)
 
-#ifndef __powerpc64__
-static u64 fsl_ioread64(const u64 __iomem *addr) -{
-       u32 fsl_addr = lower_32_bits(addr);
-       u64 fsl_addr_hi = (u64)in_le32((u32 *)(fsl_addr + 1)) << 32;
-
-       return fsl_addr_hi | in_le32((u32 *)fsl_addr);
-}
-
-static void fsl_iowrite64(u64 val, u64 __iomem *addr) -{
-       out_le32((u32 __iomem *)addr + 1, val >> 32);
-       out_le32((u32 __iomem *)addr, (u32)val);
-}
-
-static u64 fsl_ioread64be(const u64 __iomem *addr) -{
-       u32 fsl_addr = lower_32_bits(addr);
-       u64 fsl_addr_hi = (u64)in_be32((u32 *)fsl_addr) << 32;
-
-       return fsl_addr_hi | in_be32((u32 *)(fsl_addr + 1));
-}
-

drivers/dma/fsldma.h struct fsldma_chan { · line 209

Quoted 10 lines
drivers/dma/fsldma.h +4 -5
-static void fsl_iowrite64be(u64 val, u64 __iomem *addr) -{
-       out_be32((u32 __iomem *)addr, val >> 32);
-       out_be32((u32 __iomem *)addr + 1, (u32)val);
-}
-#endif
+#define fsl_ioread64(p)                in_le64(p)
+#define fsl_ioread64be(p)      in_be64(p)
+#define fsl_iowrite64(v, p)    out_le64(p, v)
+#define fsl_iowrite64be(v, p)  out_be64(p, v)
 #endif

Then you'll break 32-bit, assuming those fake-it-with-two-32-bit-accesses were actually needed.

-Scott