Subject: [PATCH] m68k: Add generic iomap support m68k: Add generic iomap support Signed-off-by: Geert Uytterhoeven --- arch/m68k/Kconfig | 4 ++ include/asm-m68k/io.h | 63 +++++++++++++++++++++++++++++++++++++--------- include/asm-m68k/raw_io.h | 8 ++++- 3 files changed, 61 insertions(+), 14 deletions(-) --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -37,6 +37,10 @@ config TIME_LOW_RES bool default y +config GENERIC_IOMAP + bool + default y + config ARCH_MAY_HAVE_PC_FDC bool depends on Q40 || (BROKEN && SUN3X) --- a/include/asm-m68k/io.h +++ b/include/asm-m68k/io.h @@ -27,6 +27,7 @@ #include #include +#include #ifdef CONFIG_ATARI #include @@ -175,6 +176,16 @@ static inline u16 __iomem *isa_itw(unsig 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 @@ static inline u16 __iomem *isa_mtw(unsig #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 @@ static inline void isa_delay(void) (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 @@ static inline void isa_delay(void) #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 @@ static inline void isa_delay(void) #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 @@ static inline void isa_delay(void) #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 @@ static inline void isa_delay(void) #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 --- a/include/asm-m68k/raw_io.h +++ b/include/asm-m68k/raw_io.h @@ -49,10 +49,16 @@ extern void __iounmap(void *addr, unsign #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 @@ static inline void raw_rom_outsw_swapw(v } #endif /* CONFIG_ATARI_ROM_ISA */ -#define __raw_writel raw_outl - #endif /* __KERNEL__ */ #endif /* _RAW_IO_H */