mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/5] asm-generic: include bitio.h from io.h
Date: Thu, 12 Aug 2021 14:19:42 +0200	[thread overview]
Message-ID: <20210812121944.4419-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20210812121944.4419-1-a.fatoum@pengutronix.de>

This is currently used on ARM and sandbox, but it's relevant for
other platforms like x86 as well if driver code wants to make use
of the functions defined within.

MIPS and PowerPC already defines the symbols, but that's ok because
<bitio.h> doesn't override existing macros. This works for MIPS, but
not PowerPC, where those aren't macros. Fix that up.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/include/asm/io.h     |  1 -
 arch/powerpc/include/asm/io.h | 10 ++++++++++
 arch/sandbox/include/asm/io.h |  1 -
 include/asm-generic/io.h      |  2 ++
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index b442a37b9c1d..0507db1a9cf8 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -8,7 +8,6 @@
 #define memset_io memset_io
 
 #include <asm-generic/io.h>
-#include <asm-generic/bitio.h>
 
 /*
  * String version of IO memory access ops:
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 8488c36f6558..30d098702380 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -132,6 +132,7 @@ static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
 /*
  * 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
  */
+#define in_8 in_8
 static inline u8 in_8(const volatile u8 __iomem *addr)
 {
 	u8 ret;
@@ -141,11 +142,13 @@ static inline u8 in_8(const volatile u8 __iomem *addr)
 	return ret;
 }
 
+#define out_8 out_8
 static inline void out_8(volatile u8 __iomem *addr, u8 val)
 {
 	__asm__ __volatile__("sync;stb%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
 }
 
+#define in_le16 in_le16
 static inline u16 in_le16(const volatile u16 __iomem *addr)
 {
 	u16 ret;
@@ -155,6 +158,7 @@ static inline u16 in_le16(const volatile u16 __iomem *addr)
 	return ret;
 }
 
+#define in_be16 in_be16
 static inline u16 in_be16(const volatile u16 __iomem *addr)
 {
 	u16 ret;
@@ -164,17 +168,20 @@ static inline u16 in_be16(const volatile u16 __iomem *addr)
 	return ret;
 }
 
+#define out_le16 out_le16
 static inline void out_le16(volatile u16 __iomem *addr, u16 val)
 {
 	__asm__ __volatile__("sync; sthbrx %1,0,%2"
 			: "=m" (*addr) : "r" (val), "r" (addr));
 }
 
+#define out_be16 out_be16
 static inline void out_be16(volatile u16 __iomem *addr, u16 val)
 {
 	__asm__ __volatile__("sync;sth%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
 }
 
+#define in_le32 in_le32
 static inline u32 in_le32(const volatile u32 __iomem *addr)
 {
 	u32 ret;
@@ -184,6 +191,7 @@ static inline u32 in_le32(const volatile u32 __iomem *addr)
 	return ret;
 }
 
+#define in_be32 in_be32
 static inline u32 in_be32(const volatile u32 __iomem *addr)
 {
 	u32 ret;
@@ -193,12 +201,14 @@ static inline u32 in_be32(const volatile u32 __iomem *addr)
 	return ret;
 }
 
+#define out_le32 out_le32
 static inline void out_le32(volatile u32 __iomem *addr, u32 val)
 {
 	__asm__ __volatile__("sync; stwbrx %1,0,%2"
 			: "=m" (*addr) : "r" (val), "r" (addr));
 }
 
+#define out_be32 out_be32
 static inline void out_be32(volatile u32 __iomem *addr, u32 val)
 {
 	__asm__ __volatile__("sync;stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 9f9cd3a42ab1..3e5c0580bc5a 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -8,7 +8,6 @@
 extern unsigned char __pci_iobase[IO_SPACE_LIMIT];
 
 #include <asm-generic/io.h>
-#include <asm-generic/bitio.h>
 
 static inline void *phys_to_virt(unsigned long phys)
 {
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index a4b0dc4b4337..47f8c3ec1be6 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -479,4 +479,6 @@ static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
 }
 #endif
 
+#include <asm-generic/bitio.h>
+
 #endif /* __ASM_GENERIC_IO_H */
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-08-12 12:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 12:19 [PATCH 1/5] net: drop Calxeda Highbank xgmac driver support Ahmad Fatoum
2021-08-12 12:19 ` [PATCH 2/5] net: make ARC MAC driver 32-bit only Ahmad Fatoum
2021-08-12 12:19 ` Ahmad Fatoum [this message]
2021-08-12 12:19 ` [PATCH 4/5] x86: define phys_to_virt and virt_to_phys Ahmad Fatoum
2021-08-12 12:19 ` [PATCH 5/5] net: e1000: split EEPROM and barebox MTD wrapper into separate files Ahmad Fatoum
2021-08-12 13:03 ` [PATCH 1/5] net: drop Calxeda Highbank xgmac driver support Ahmad Fatoum
2021-08-18  4:46 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210812121944.4419-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox