Skip to contentSkip to conversation

m68k: Make sure {read,write}s[bwl]() are always defined

PATCH In review Geert Uytterhoeven 5 participants 6 messages Apr 15, 2012 – Apr 18, 2012

Subsystems (3)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

PATCH 1/1 m68k: Make sure {read,write}s[bwl]() are always defined

If CONFIG_ATARI_ROM_ISA is defined (e.g. allmodconfig), musb fails to compile with:

In file included from drivers/usb/musb/musb_core.h:68,

                 from drivers/usb/musb/musb_core.c:104:

drivers/usb/musb/musb_io.h:45: error: conflicting types for ‘raw_insl’ arch/m68k/include/asm/raw_io.h:200: error: previous definition of ‘raw_insl’ was here drivers/usb/musb/musb_io.h:47: error: conflicting types for ‘raw_insw’ arch/m68k/include/asm/raw_io.h:121: error: previous definition of ‘raw_insw’ was here drivers/usb/musb/musb_io.h:52: error: conflicting types for ‘raw_outsl’ arch/m68k/include/asm/raw_io.h:240: error: previous definition of ‘raw_outsl’ was here drivers/usb/musb/musb_io.h:54: error: conflicting types for ‘raw_outsw’ arch/m68k/include/asm/raw_io.h:161: error: previous definition of ‘raw_outsw’ was here make[4]: *** [drivers/usb/musb/musb_core.o] Error 1

This happens because musb_io.h provides default implementations for {read,write}s[bwl]() on most platforms, some of which conflict with their Atari ROM ISA counterparts.

To avoid adding a check for CONFIG_ATARI_ROM_ISA to musb_io.h, make sure {read,write}s[bwl]() are always defined on m68k, and disable the default implementations in musb_io.h on m68k, like is already done for several other architectures.

Cc Felipe Balbi <[email protected]>
Cc Greg Ungerer <[email protected]>

--
Felipe: OK if I carry this through the m68k tree, as CONFIG_ATARI_ROM_ISA
(and this compile problem) is not yet in mainline, and fixing only musb_io.h now would introduce a regression in mainline? I could also proactively have m68k provide {read,write}s[bwl]() in mainline before pushing out Atari ROM ISA support.
Greg: Do you want a similar change for asm/io_no.h? Or move it to asm/io.h?
Or do you want musb_io.h to check for "!(defined(CONFIG_M68K) && defined(CONFIG_MMU))" instead? Or don't you care, as allmodconfig never selects nommu anyway?

---
 arch/m68k/include/asm/io_mm.h |   12 +++++++-----
 drivers/usb/musb/musb_io.h    |    2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)
arch/m68k/include/asm/io_mm.h +7 -5
index eff3f83..73dc331 100644
@@ -371,11 +371,6 @@ static inline void isa_delay(void)
 #define writeb(val,addr) out_8((addr),(val))
 #define readw(addr)      in_le16(addr)
 #define writew(val,addr) out_le16((addr),(val))
-
-#define readsw  raw_insw
-#define writesw raw_outsw
-#define readsl  raw_insl
-#define writesl raw_outsl
 #endif /* CONFIG_ATARI_ROM_ISA */
 
 #if !defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA)
@@ -415,6 +410,13 @@ static inline void isa_delay(void)
 #define readl(addr)      in_le32(addr)
 #define writel(val,addr) out_le32((addr),(val))
 
+#define readsb(port, buf, nr)     raw_insb((port), (u8 *)(buf), (nr))
+#define readsw(port, buf, nr)     raw_insw((port), (u16 *)(buf), (nr))
+#define readsl(port, buf, nr)     raw_insl((port), (u32 *)(buf), (nr))
+#define writesb(port, buf, nr)    raw_outsb((port), (u8 *)(buf), (nr))
+#define writesw(port, buf, nr)    raw_outsw((port), (u16 *)(buf), (nr))
+#define writesl(port, buf, nr)    raw_outsl((port), (u32 *)(buf), (nr))
+
 #define mmiowb()
 
 static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
drivers/usb/musb/musb_io.h +1 -1
index 1d5eda2..f7c1c8e 100644
@@ -40,7 +40,7 @@
 #if !defined(CONFIG_ARM) && !defined(CONFIG_SUPERH) \
 	&& !defined(CONFIG_AVR32) && !defined(CONFIG_PPC32) \
 	&& !defined(CONFIG_PPC64) && !defined(CONFIG_BLACKFIN) \
-	&& !defined(CONFIG_MIPS)
+	&& !defined(CONFIG_MIPS) && !defined(CONFIG_M68K)
 static inline void readsl(const void __iomem *addr, void *buf, int len)
 	{ insl((unsigned long)addr, buf, len); }
 static inline void readsw(const void __iomem *addr, void *buf, int len)
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Geert Uytterhoeven

If CONFIG_ATARI_ROM_ISA is defined (e.g. allmodconfig), musb fails to compile with:

In file included from drivers/usb/musb/musb_core.h:68,

                 from drivers/usb/musb/musb_core.c:104:

drivers/usb/musb/musb_io.h:45: error: conflicting types for ‘raw_insl’ arch/m68k/include/asm/raw_io.h:200: error: previous definition of ‘raw_insl’ was here drivers/usb/musb/musb_io.h:47: error: conflicting types for ‘raw_insw’ arch/m68k/include/asm/raw_io.h:121: error: previous definition of ‘raw_insw’ was here drivers/usb/musb/musb_io.h:52: error: conflicting types for ‘raw_outsl’ arch/m68k/include/asm/raw_io.h:240: error: previous definition of ‘raw_outsl’ was here drivers/usb/musb/musb_io.h:54: error: conflicting types for ‘raw_outsw’ arch/m68k/include/asm/raw_io.h:161: error: previous definition of ‘raw_outsw’ was here make[4]: *** [drivers/usb/musb/musb_core.o] Error 1

This happens because musb_io.h provides default implementations for {read,write}s[bwl]() on most platforms, some of which conflict with their Atari ROM ISA counterparts.

Quoted 8 lines

To avoid adding a check for CONFIG_ATARI_ROM_ISA to musb_io.h, make sure {read,write}s[bwl]() are always defined on m68k, and disable the default implementations in musb_io.h on m68k, like is already done for several other architectures.

Cc Felipe Balbi <[email protected]>
Cc Greg Ungerer <[email protected]>

Go ahea Geert, here's my ack.

Signature · 1 line
balbi
#2 lore raw
In reply to Geert Uytterhoeven

Hi Geert,

Quoted 27 lines · Geert Uytterhoeven

If CONFIG_ATARI_ROM_ISA is defined (e.g. allmodconfig), musb fails to compile with:

In file included from drivers/usb/musb/musb_core.h:68,

                  from drivers/usb/musb/musb_core.c:104:

drivers/usb/musb/musb_io.h:45: error: conflicting types for æraw_inslÆ arch/m68k/include/asm/raw_io.h:200: error: previous definition of æraw_inslÆ was here drivers/usb/musb/musb_io.h:47: error: conflicting types for æraw_inswÆ arch/m68k/include/asm/raw_io.h:121: error: previous definition of æraw_inswÆ was here drivers/usb/musb/musb_io.h:52: error: conflicting types for æraw_outslÆ arch/m68k/include/asm/raw_io.h:240: error: previous definition of æraw_outslÆ was here drivers/usb/musb/musb_io.h:54: error: conflicting types for æraw_outswÆ arch/m68k/include/asm/raw_io.h:161: error: previous definition of æraw_outswÆ was here make[4]: *** [drivers/usb/musb/musb_core.o] Error 1

This happens because musb_io.h provides default implementations for {read,write}s[bwl]() on most platforms, some of which conflict with their Atari ROM ISA counterparts.

To avoid adding a check for CONFIG_ATARI_ROM_ISA to musb_io.h, make sure {read,write}s[bwl]() are always defined on m68k, and disable the default implementations in musb_io.h on m68k, like is already done for several other architectures.

Quoted 7 lines

--
Felipe: OK if I carry this through the m68k tree, as CONFIG_ATARI_ROM_ISA
(and this compile problem) is not yet in mainline, and fixing only musb_io.h now would introduce a regression in mainline? I could also proactively have m68k provide {read,write}s[bwl]() in mainline before pushing out Atari ROM ISA support.
Greg: Do you want a similar change for asm/io_no.h? Or move it to asm/io.h?

Ultimately I would like to see it in asm/io.h. It is on my list of files to merge back together, ending up with a single asm/io.h.

But right now I don't mind at all if it is easier for you to push into asm/io_mm.h.

Quoted 2 lines

Or do you want musb_io.h to check for "!(defined(CONFIG_M68K)&& defined(CONFIG_MMU))" instead?

No, I would rather see just the defined(CONFIG_M68K), and no check for CONFIG_MMU. I am pretty sure there is some similarity between the way the Atari does ISA bus interfacing to what some of the ColdFire boards do.

Quoted 1 line

Or don't you care, as allmodconfig never selects nommu anyway?

Well, I do care a little :-)

Regards
Greg

Quoted 48 lines
---
  arch/m68k/include/asm/io_mm.h |   12 +++++++-----
  drivers/usb/musb/musb_io.h    |    2 +-
  2 files changed, 8 insertions(+), 6 deletions(-)
arch/m68k/include/asm/io_mm.h +7 -5
index eff3f83..73dc331 100644
@@ -371,11 +371,6 @@ static inline void isa_delay(void)
  #define writeb(val,addr) out_8((addr),(val))
  #define readw(addr)      in_le16(addr)
  #define writew(val,addr) out_le16((addr),(val))
-
-#define readsw  raw_insw
-#define writesw raw_outsw
-#define readsl  raw_insl
-#define writesl raw_outsl
  #endif /* CONFIG_ATARI_ROM_ISA */
 
  #if !defined(CONFIG_ISA)&&  !defined(CONFIG_ATARI_ROM_ISA)
@@ -415,6 +410,13 @@ static inline void isa_delay(void)
  #define readl(addr)      in_le32(addr)
  #define writel(val,addr) out_le32((addr),(val))
 
+#define readsb(port, buf, nr)     raw_insb((port), (u8 *)(buf), (nr))
+#define readsw(port, buf, nr)     raw_insw((port), (u16 *)(buf), (nr))
+#define readsl(port, buf, nr)     raw_insl((port), (u32 *)(buf), (nr))
+#define writesb(port, buf, nr)    raw_outsb((port), (u8 *)(buf), (nr))
+#define writesw(port, buf, nr)    raw_outsw((port), (u16 *)(buf), (nr))
+#define writesl(port, buf, nr)    raw_outsl((port), (u32 *)(buf), (nr))
+
  #define mmiowb()
 
  static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
drivers/usb/musb/musb_io.h +1 -1
index 1d5eda2..f7c1c8e 100644
@@ -40,7 +40,7 @@
  #if !defined(CONFIG_ARM)&&  !defined(CONFIG_SUPERH) \
  	&&  !defined(CONFIG_AVR32)&&  !defined(CONFIG_PPC32) \
  	&&  !defined(CONFIG_PPC64)&&  !defined(CONFIG_BLACKFIN) \
-	&&  !defined(CONFIG_MIPS)
+	&&  !defined(CONFIG_MIPS)&&  !defined(CONFIG_M68K)
  static inline void readsl(const void __iomem *addr, void *buf, int len)
  	{ insl((unsigned long)addr, buf, len); }
  static inline void readsw(const void __iomem *addr, void *buf, int len)
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close,                            FAX:         +61 7 3891 3630
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
#3 lore raw

Greg,

Quoted 7 lines
Quoted 2 lines

Or do you want musb_io.h to check for "!(defined(CONFIG_M68K)&& defined(CONFIG_MMU))" instead?

No, I would rather see just the defined(CONFIG_M68K), and no check for CONFIG_MMU. I am pretty sure there is some similarity between the way the Atari does ISA bus interfacing to what some of the ColdFire boards do.

I sure hope you are wrong :-) But I think I saw some non-MMU Atari use attempts mentioned on the list, and the ROM port ISA adapter could well be used on non-MMU Ataris (though I'm not sure what address the ROM port would be mapped at on those - I'm sure Andreas will know the details there).

Michael

#4 lore raw
Quoted 5 lines · Michael Schmitz

I sure hope you are wrong :-) But I think I saw some non-MMU Atari use attempts mentioned on the list, and the ROM port ISA adapter could well be used on non-MMU Ataris (though I'm not sure what address the ROM port would be mapped at on those - I'm sure Andreas will know the details there).

There is no difference in the I/O memory layout between the Atari models for hardware components that are in common.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#5 lore raw
In reply to Michael Schmitz
Quoted 8 lines · Michael Schmitz

Greg,

Quoted 7 lines
Quoted 2 lines

Or do you want musb_io.h to check for
"!(defined(CONFIG_M68K)&& defined(CONFIG_MMU))" instead?

No, I would rather see just the defined(CONFIG_M68K), and no check for CONFIG_MMU. I am pretty sure there is some similarity between the way the Atari does ISA bus interfacing to what some of the ColdFire boards do.

Quoted 5 lines

I sure hope you are wrong :-) But I think I saw some non-MMU Atari use attempts mentioned on the list, and the ROM port ISA adapter could well be used on non-MMU Ataris (though I'm not sure what address the ROM port would be mapped at on those - I'm sure Andreas will know the details there).

I wasn't referring to the ROM port exactly as it is on Atari playtforms. But some ColdFire based boards I have seen do ISA busses with some pretty funky wiring of addresses and data lines to be able to do 8bit accesses on even and odd boundaries, but also allow 16bit accesses.

Regards
Greg

------------------------------------------------------------------------

Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close,                            FAX:         +61 7 3891 3630
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com