linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm/io.h: add macros to read/write big/little endian register
@ 2012-02-23  9:17 Viresh Kumar
  2012-02-23  9:53 ` Russell King - ARM Linux
  0 siblings, 1 reply; 17+ messages in thread
From: Viresh Kumar @ 2012-02-23  9:17 UTC (permalink / raw)
  To: linux-arm-kernel

From: Pratyush Anand <pratyush.anand@st.com>

There are some peripheral (e.g dwc otg) whose registers can be configured to
work in either little or big endian mode. Therefore macros like out_be32,
in_be32, out_le32 and in_le32 have been added to support such peripherals.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
 arch/arm/include/asm/io.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 9275828..a1ccac0 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -192,6 +192,16 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
 #define insw_p(port,to,len)	insw(port,to,len)
 #define insl_p(port,to,len)	insl(port,to,len)
 
+/* Big Endian */
+#define out_be32(v, p)	({ __iowmb(); __raw_writel((__force __u32) \
+					cpu_to_be32(v), __io(p)); })
+#define in_be32(p)	({ __u32 __v = be32_to_cpu((__force __be32) \
+			__raw_readl(__io(p))); __iormb(); __v; })
+
+/* Little endian */
+#define out_le32(v, p)		outl(v, p)
+#define in_le32(p)		inl(p)
+
 /*
  * String version of IO memory access ops:
  */
-- 
1.7.8.110.g4cb5d

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2012-02-24 21:03 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-23  9:17 [PATCH] arm/io.h: add macros to read/write big/little endian register Viresh Kumar
2012-02-23  9:53 ` Russell King - ARM Linux
2012-02-23 10:53   ` Viresh Kumar
2012-02-23 11:19     ` Russell King - ARM Linux
2012-02-23 11:30       ` Russell King - ARM Linux
2012-02-23 11:34       ` Pratyush Anand
2012-02-23 11:38         ` Russell King - ARM Linux
2012-02-23 12:33           ` Arnd Bergmann
2012-02-23 12:50             ` Russell King - ARM Linux
2012-02-23 13:35               ` Arnd Bergmann
2012-02-23 14:14                 ` Russell King - ARM Linux
2012-02-23 20:27                 ` Benjamin Herrenschmidt
2012-02-23 20:25             ` Benjamin Herrenschmidt
2012-02-24 16:22               ` Arnd Bergmann
2012-02-24 21:03                 ` Benjamin Herrenschmidt
2012-02-23 12:01         ` Stefan Roese
2012-02-24  4:22           ` Pratyush Anand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).