Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc85ef50 authored by Josh Cartwright's avatar Josh Cartwright Committed by Matt Wagantall
Browse files

ARM: msm: add 64-bit IO accessor support



This is a snapshot of the 64-bit IO accessor support as of msm-3.10
commit

acdce027751d5a7488b283f0ce3111f873a5816d (Merge "defconfig: arm64: Enable
ONESHOT_SYNC for msm8994")

Signed-off-by: default avatarJosh Cartwright <joshc@codeaurora.org>
parent ccca34b8
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -101,6 +101,17 @@ static inline void __raw_writel_no_log(u32 val, volatile void __iomem *addr)
		     : "r" (val));
}

static inline void __raw_writeq_no_log(u64 val, volatile void __iomem *addr)
{
	register u64 v asm ("r2");

	v = val;

	asm volatile("strd %1, %0"
		     : "+Qo" (*(volatile u64 __force *)addr)
		     : "r" (v));
}

static inline u8 __raw_readb_no_log(const volatile void __iomem *addr)
{
	u8 val;
@@ -119,6 +130,15 @@ static inline u32 __raw_readl_no_log(const volatile void __iomem *addr)
	return val;
}

static inline u64 __raw_readq_no_log(const volatile void __iomem *addr)
{
	register u64 val asm ("r2");

	asm volatile("ldrd %1, %0"
		     : "+Qo" (*(volatile u64 __force *)addr),
		       "=r" (val));
	return val;
}

/*
 * There may be cases when clients don't want to support or can't support the
@@ -350,21 +370,30 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
					__raw_readw(c)); __r; })
#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
					__raw_readl(c)); __r; })
#define readq_relaxed(c) ({ u64 __r = le64_to_cpu((__force __le64) \
					__raw_readq(c)); __r; })
#define readl_relaxed_no_log(c) ({ u32 __r = le32_to_cpu((__force __le32) \
					__raw_readl_no_log(c)); __r; })
#define readq_relaxed_no_log(c) ({ u64 __r = le64_to_cpu((__force __le64) \
					__raw_readq_no_log(c)); __r; })


#define writeb_relaxed(v,c)	__raw_writeb(v,c)
#define writew_relaxed(v,c)	__raw_writew((__force u16) cpu_to_le16(v),c)
#define writel_relaxed(v,c)	__raw_writel((__force u32) cpu_to_le32(v),c)
#define writeq_relaxed(v,c)	__raw_writeq((__force u64) cpu_to_le64(v),c)
#define writel_relaxed_no_log(v, c) __raw_writel_no_log((__force u32) cpu_to_le32(v),c)
#define writeq_relaxed_no_log(v, c) __raw_writeq_no_log((__force u64) cpu_to_le64(v),c)

#define readb(c)		({ u8  __v = readb_relaxed(c); __iormb(); __v; })
#define readw(c)		({ u16 __v = readw_relaxed(c); __iormb(); __v; })
#define readl(c)		({ u32 __v = readl_relaxed(c); __iormb(); __v; })
#define readq(c)		({ u64 __v = readq_relaxed(c); __iormb(); __v; })

#define writeb(v,c)		({ __iowmb(); writeb_relaxed(v,c); })
#define writew(v,c)		({ __iowmb(); writew_relaxed(v,c); })
#define writel(v,c)		({ __iowmb(); writel_relaxed(v,c); })
#define writeq(v, c)		({ __iowmb(); writeq_relaxed(v, c); })

#define readsb(p,d,l)		__raw_readsb(p,d,l)
#define readsw(p,d,l)		__raw_readsw(p,d,l)
@@ -394,22 +423,26 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
#define iounmap				__arm_iounmap

/*
 * io{read,write}{8,16,32} macros
 * io{read,write}{8,16,32,64} macros
 */
#ifndef ioread8
#define ioread8(p)	({ unsigned int __v = __raw_readb(p); __iormb(); __v; })
#define ioread16(p)	({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __iormb(); __v; })
#define ioread32(p)	({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __iormb(); __v; })
#define ioread64(p)	({ unsigned int __v = le64_to_cpu((__force __le64)__raw_readq(p)); __iormb(); __v; })

#define ioread16be(p)	({ unsigned int __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
#define ioread32be(p)	({ unsigned int __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
#define ioread64be(p)	({ unsigned int __v = be64_to_cpu((__force __be64)__raw_readq(p)); __iormb(); __v; })

#define iowrite8(v,p)	({ __iowmb(); __raw_writeb(v, p); })
#define iowrite16(v,p)	({ __iowmb(); __raw_writew((__force __u16)cpu_to_le16(v), p); })
#define iowrite32(v,p)	({ __iowmb(); __raw_writel((__force __u32)cpu_to_le32(v), p); })
#define iowrite64(v,p)	({ __iowmb(); __raw_writeq((__force __u64)cpu_to_le64(v), p); })

#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_be16(v), p); })
#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_be32(v), p); })
#define iowrite64be(v,p) ({ __iowmb(); __raw_writeq((__force __u64)cpu_to_be64(v), p); })

#define ioread8_rep(p,d,c)	__raw_readsb(p,d,c)
#define ioread16_rep(p,d,c)	__raw_readsw(p,d,c)