[RFC PATCH] m68k: GENERIC_IOMAP support (take #2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On vr, 2006-11-03 at 00:06 +0100, Kars de Jong wrote:
On do, 2006-11-02 at 22:34 +0100, Geert Uytterhoeven wrote:
OK, here's the patch, without the m68k generic iomap changes.

Ah, the missing io{read,write}*() stuff :-)

And here is the proposed patch to add iomap support. I think we need to
rethink our I/O support when we want to support all our I/O buses
properly, but that has been discussed before. I will commit my Amiga
PCMCIA support soon, I promise!

Here's the updated version of this patch. It should now work with Amiga
and Q40 defconfig.

I don't think the CONFIG_ATARI_ROM_ISA definitions are complete yet, the
32-bit variants are missing.


Kind regards,

Kars.

Index: linux-2.6-m68k/arch/m68k/Kconfig
===================================================================
RCS file: /home/linux-m68k/cvsroot/linux/arch/m68k/Kconfig,v
retrieving revision 1.39
diff -u -r1.39 Kconfig
--- linux-2.6-m68k/arch/m68k/Kconfig	8 Feb 2007 02:47:54 -0000	1.39
+++ linux-2.6-m68k/arch/m68k/Kconfig	25 Feb 2007 14:43:06 -0000
@@ -37,6 +37,10 @@
 	bool
 	default y
 
+config GENERIC_IOMAP
+	bool
+	default y
+
 config ARCH_MAY_HAVE_PC_FDC
 	bool
 	depends on Q40 || (BROKEN && SUN3X)
Index: linux-2.6-m68k/include/asm-m68k/io.h
===================================================================
RCS file: /home/linux-m68k/cvsroot/linux/include/asm-m68k/io.h,v
retrieving revision 1.18
diff -u -r1.18 io.h
--- linux-2.6-m68k/include/asm-m68k/io.h	17 Dec 2006 16:35:31 -0000	1.18
+++ linux-2.6-m68k/include/asm-m68k/io.h	25 Feb 2007 14:43:14 -0000
@@ -27,6 +27,7 @@
 #include <asm/raw_io.h>
 #include <asm/virtconvert.h>
 
+#include <asm-generic/iomap.h>
 
 #ifdef CONFIG_ATARI
 #include <asm/atarihw.h>
@@ -175,6 +176,16 @@
     default: return NULL; /* avoid warnings, just in case */
     }
 }
+static inline u32 __iomem *isa_itl(unsigned long addr)
+{
+  switch(ISA_TYPE)
+    {
+#ifdef CONFIG_AMIGA_PCMCIA
+    case AG_ISA: return (u32 *)AG_ISA_IO_W(addr);
+#endif
+    default: return 0; /* avoid warnings, just in case */
+    }
+}
 static inline u8 __iomem *isa_mtb(unsigned long addr)
 {
   switch(ISA_TYPE)
@@ -217,8 +228,10 @@
 
 #define isa_inb(port)      in_8(isa_itb(port))
 #define isa_inw(port)      (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port)))
+#define isa_inl(port)      (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port)))
 #define isa_outb(val,port) out_8(isa_itb(port),(val))
 #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val)))
+#define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val)))
 
 #define isa_readb(p)       in_8(isa_mtb((unsigned long)(p)))
 #define isa_readw(p)       \
@@ -280,6 +293,14 @@
        (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) :  \
                   raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
 
+#define isa_insl(port, buf, nr)     \
+       (ISA_SEX ? raw_insl(isa_itl(port), (u32 *)(buf), (nr)) :    \
+                  raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
+
+#define isa_outsl(port, buf, nr)    \
+       (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) :  \
+                  raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
+
 #if defined(CONFIG_ATARI_ROM_ISA)
 #define isa_rom_inb_p(p)	({ u8 _v = isa_rom_inb(p); isa_delay(); _v; })
 #define isa_rom_inw_p(p)	({ u16 _v = isa_rom_inw(p); isa_delay(); _v; })
@@ -314,14 +335,16 @@
 #define inw_p   isa_inw_p
 #define outw    isa_outw
 #define outw_p  isa_outw_p
-#define inl     isa_inw
-#define inl_p   isa_inw_p
-#define outl    isa_outw
-#define outl_p  isa_outw_p
+#define inl     isa_inl
+#define inl_p   isa_inl_p
+#define outl    isa_outl
+#define outl_p  isa_outl_p
 #define insb    isa_insb
 #define insw    isa_insw
+#define insl    isa_insl
 #define outsb   isa_outsb
 #define outsw   isa_outsw
+#define outsl   isa_outsl
 #define readb   isa_readb
 #define readw   isa_readw
 #define writeb  isa_writeb
@@ -330,8 +353,6 @@
 
 #if defined(CONFIG_PCI)
 
-#define inl(port)        in_le32(port)
-#define outl(val,port)   out_le32((port),(val))
 #define readl(addr)      in_le32(addr)
 #define writel(val,addr) out_le32((addr),(val))
 
@@ -346,10 +367,13 @@
 #define readl_relaxed(addr) readl(addr)
 
 #ifndef CONFIG_ISA
+
 #define inb(port)      in_8(port)
 #define outb(val,port) out_8((port),(val))
 #define inw(port)      in_le16(port)
 #define outw(val,port) out_le16((port),(val))
+#define inl(port)      in_le32(port)
+#define outl(val,port) out_le32((port),(val))
 
 #else
 /*
@@ -401,20 +425,35 @@
 #define outsw   isa_rom_outsw
 #endif
 
-#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && !defined(CONFIG_ATARI_ROM_ISA) && defined(CONFIG_HP300)
+#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && !defined(CONFIG_ATARI_ROM_ISA)
 /*
- * We need to define dummy functions otherwise drivers/serial/8250.c doesn't link
+ * We need to define dummy functions for GENERIC_IOMAP support.
  */
-#define inb(port)        0xff
-#define inb_p(port)      0xff
-#define outb(val,port)   do { } while (0)
-#define outb_p(val,port) do { } while (0)
+#define inb(port)          0xff
+#define inb_p(port)        0xff
+#define outb(val,port)     do { } while (0)
+#define outb_p(val,port)   do { } while (0)
+#define inw(port)          0xffff
+#define outw(val,port)     do { } while (0)
+#define inl(port)          0xffffffffUL
+#define outl(val,port)     do { } while (0)
+
+#define insb(port,buf,nr)  do { } while (0)
+#define outsb(port,buf,nr) do { } while (0)
+#define insw(port,buf,nr)  do { } while (0)
+#define outsw(port,buf,nr) do { } while (0)
+#define insl(port,buf,nr)  do { } while (0)
+#define outsl(port,buf,nr) do { } while (0)
 
 /*
  * These should be valid on any ioremap()ed region
  */
 #define readb(addr)      in_8(addr)
 #define writeb(val,addr) out_8((addr),(val))
+#define readw(addr)      in_le16(addr)
+#define writew(val,addr) out_le16((addr),(val))
+#endif /* !CONFIG_ISA && !CONFIG_PCI && !CONFIG_ATARI_ROM_ISA */
+#if !defined(CONFIG_PCI)
 #define readl(addr)      in_le32(addr)
 #define writel(val,addr) out_le32((addr),(val))
 #endif
Index: linux-2.6-m68k/include/asm-m68k/raw_io.h
===================================================================
RCS file: /home/linux-m68k/cvsroot/linux/include/asm-m68k/raw_io.h,v
retrieving revision 1.9
diff -u -r1.9 raw_io.h
--- linux-2.6-m68k/include/asm-m68k/raw_io.h	17 Dec 2006 16:35:31 -0000	1.9
+++ linux-2.6-m68k/include/asm-m68k/raw_io.h	25 Feb 2007 14:43:14 -0000
@@ -49,10 +49,16 @@
 #define raw_inb in_8
 #define raw_inw in_be16
 #define raw_inl in_be32
+#define __raw_readb in_8
+#define __raw_readw in_be16
+#define __raw_readl in_be32
 
 #define raw_outb(val,port) out_8((port),(val))
 #define raw_outw(val,port) out_be16((port),(val))
 #define raw_outl(val,port) out_be32((port),(val))
+#define __raw_writeb(val,addr) out_8((addr),(val))
+#define __raw_writew(val,addr) out_be16((addr),(val))
+#define __raw_writel(val,addr) out_be32((addr),(val))
 
 /*
  * Atari ROM port (cartridge port) ISA adapter, used for the EtherNEC NE2000
@@ -432,8 +438,6 @@
 }
 #endif /* CONFIG_ATARI_ROM_ISA */
 
-#define __raw_writel raw_outl
-
 #endif /* __KERNEL__ */
 
 #endif /* _RAW_IO_H */


-
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux