diff options
Diffstat (limited to 'debian/patches/bugfix/m68k/atari-rom-isa.diff')
-rw-r--r-- | debian/patches/bugfix/m68k/atari-rom-isa.diff | 340 |
1 files changed, 340 insertions, 0 deletions
diff --git a/debian/patches/bugfix/m68k/atari-rom-isa.diff b/debian/patches/bugfix/m68k/atari-rom-isa.diff new file mode 100644 index 000000000000..ce5fdffd6fef --- /dev/null +++ b/debian/patches/bugfix/m68k/atari-rom-isa.diff @@ -0,0 +1,340 @@ +Subject: [PATCH] m68k: Atari ROM port ISA adapter support + +From: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de> + +Atari ROM port ISA adapter support + +Signed-off-by: Michael Schmitz <schmitz@debian.org> +Signed-off-by: Roman Zippel <zippel@linux-m68k.org> +Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> +--- + arch/m68k/Kconfig | 10 ++++ + include/asm-m68k/io.h | 101 ++++++++++++++++++++++++++++++++++++++++++++-- + include/asm-m68k/raw_io.h | 98 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 205 insertions(+), 4 deletions(-) + +--- linux-m68k-2.6.21.orig/arch/m68k/Kconfig ++++ linux-m68k-2.6.21/arch/m68k/Kconfig +@@ -143,6 +143,16 @@ config PCI + information about which PCI hardware does work under Linux and which + doesn't. + ++config ATARI_ROM_ISA ++ bool "Atari ROM port ISA adapter support" ++ depends on ATARI ++ help ++ This option enables support for the ROM port ISA adapter used to ++ operate ISA cards on Atari. Only 8 bit cards are supported, and ++ no interrupt lines are connected. ++ The only driver currently using this adapter is the EtherNEC ++ driver for RTL8019AS based NE2000 compatible network cards. ++ + config MAC + bool "Macintosh support" + depends on !MMU_SUN3 +--- linux-m68k-2.6.21.orig/include/asm-m68k/io.h ++++ linux-m68k-2.6.21/include/asm-m68k/io.h +@@ -82,9 +82,21 @@ extern unsigned long gg2_isa_base; + #endif + #endif /* AMIGA_PCMCIA */ + ++#ifdef CONFIG_ATARI_ROM_ISA + ++#define enec_isa_read_base 0xfffa0000 ++#define enec_isa_write_base 0xfffb0000 + +-#ifdef CONFIG_ISA ++#define ENEC_ISA_IO_B(ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x1F)<<9)) ++#define ENEC_ISA_IO_W(ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x1F)<<9)) ++#define ENEC_ISA_MEM_B(madr) (enec_isa_read_base+((((unsigned long)(madr))&0x1F)<<9)) ++#define ENEC_ISA_MEM_W(madr) (enec_isa_read_base+((((unsigned long)(madr))&0x1F)<<9)) ++ ++#define MULTI_ISA 0 ++#endif /* ATARI */ ++ ++ ++#if defined(CONFIG_ISA) || defined(CONFIG_ATARI_ROM_ISA) + + #if MULTI_ISA == 0 + #undef MULTI_ISA +@@ -93,6 +105,7 @@ extern unsigned long gg2_isa_base; + #define Q40_ISA (1) + #define GG2_ISA (2) + #define AG_ISA (3) ++#define ENEC_ISA (4) + + #if defined(CONFIG_Q40) && !defined(MULTI_ISA) + #define ISA_TYPE Q40_ISA +@@ -106,6 +119,10 @@ extern unsigned long gg2_isa_base; + #define ISA_TYPE GG2_ISA + #define ISA_SEX 0 + #endif ++#if defined(CONFIG_ATARI_ROM_ISA) && !defined(MULTI_ISA) ++#define ISA_TYPE ENEC_ISA ++#define ISA_SEX 0 ++#endif + + #ifdef MULTI_ISA + extern int isa_type; +@@ -133,6 +150,9 @@ static inline u8 __iomem *isa_itb(unsign + #ifdef CONFIG_AMIGA_PCMCIA + case AG_ISA: return (u8 __iomem *)AG_ISA_IO_B(addr); + #endif ++#ifdef CONFIG_ATARI_ROM_ISA ++ case ENEC_ISA: return (u8 __iomem *)ENEC_ISA_IO_B(addr); ++#endif + default: return NULL; /* avoid warnings, just in case */ + } + } +@@ -149,6 +169,9 @@ static inline u16 __iomem *isa_itw(unsig + #ifdef CONFIG_AMIGA_PCMCIA + case AG_ISA: return (u16 __iomem *)AG_ISA_IO_W(addr); + #endif ++#ifdef CONFIG_ATARI_ROM_ISA ++ case ENEC_ISA: return (u16 __iomem *)ENEC_ISA_IO_W(addr); ++#endif + default: return NULL; /* avoid warnings, just in case */ + } + } +@@ -165,6 +188,9 @@ static inline u8 __iomem *isa_mtb(unsign + #ifdef CONFIG_AMIGA_PCMCIA + case AG_ISA: return (u8 __iomem *)addr; + #endif ++#ifdef CONFIG_ATARI_ROM_ISA ++ case ENEC_ISA: return (u8 __iomem *)ENEC_ISA_MEM_B(addr); ++#endif + default: return NULL; /* avoid warnings, just in case */ + } + } +@@ -181,6 +207,9 @@ static inline u16 __iomem *isa_mtw(unsig + #ifdef CONFIG_AMIGA_PCMCIA + case AG_ISA: return (u16 __iomem *)addr; + #endif ++#ifdef CONFIG_ATARI_ROM_ISA ++ case ENEC_ISA: return (u16 __iomem *)ENEC_ISA_MEM_W(addr); ++#endif + default: return NULL; /* avoid warnings, just in case */ + } + } +@@ -200,6 +229,19 @@ static inline u16 __iomem *isa_mtw(unsig + (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \ + : out_le16(isa_mtw((unsigned long)(p)),(val))) + ++#if defined(CONFIG_ATARI_ROM_ISA) ++#define isa_rom_inb(port) rom_in_8(isa_itb(port)) ++#define isa_rom_inw(port) (ISA_SEX ? rom_in_be16(isa_itw(port)) : rom_in_le16(isa_itw(port))) ++ ++#define isa_rom_outb(val,port) rom_out_8(isa_itb(port),(val)) ++#define isa_rom_outw(val,port) (ISA_SEX ? rom_out_be16(isa_itw(port),(val)) : rom_out_le16(isa_itw(port),(val))) ++ ++#define isa_rom_writeb(val,p) rom_out_8(isa_mtb((unsigned long)(p)),(val)) ++#define isa_rom_writew(val,p) \ ++ (ISA_SEX ? rom_out_be16(isa_mtw((unsigned long)(p)),(val)) \ ++ : rom_out_le16(isa_mtw((unsigned long)(p)),(val))) ++#endif ++ + static inline void isa_delay(void) + { + switch(ISA_TYPE) +@@ -213,6 +255,9 @@ static inline void isa_delay(void) + #ifdef CONFIG_AMIGA_PCMCIA + case AG_ISA: break; + #endif ++#ifdef CONFIG_ATARI_ROM_ISA ++ case ENEC_ISA: break; ++#endif + default: break; /* avoid warnings */ + } + } +@@ -234,10 +279,33 @@ static inline void isa_delay(void) + #define isa_outsw(port, buf, nr) \ + (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ + raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) ++ ++#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; }) ++#define isa_rom_inl_p(p) ({ u32 _v = isa_rom_inl(p) ;isa_delay(); _v; }) ++#define isa_rom_outb_p(v,p) ({ isa_rom_outb((v), (p)); isa_delay(); }) ++#define isa_rom_outw_p(v,p) ({ isa_rom_outw((v), (p)); isa_delay(); }) ++#define isa_rom_outl_p(v,p) ({ isa_rom_outl((v), (p)); isa_delay(); }) ++ ++#define isa_rom_insb(port, buf, nr) raw_rom_insb(isa_itb(port), (u8 *)(buf), (nr)) ++ ++#define isa_rom_insw(port, buf, nr) \ ++ (ISA_SEX ? raw_rom_insw(isa_itw(port), (u16 *)(buf), (nr)) : \ ++ raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr))) ++ ++#define isa_rom_outsb(port, buf, nr) raw_rom_outsb(isa_itb(port), (u8 *)(buf), (nr)) ++ ++#define isa_rom_outsw(port, buf, nr) \ ++ (ISA_SEX ? raw_rom_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ ++ raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) ++ ++#endif ++ + #endif /* CONFIG_ISA */ + + +-#if defined(CONFIG_ISA) && !defined(CONFIG_PCI) ++#if defined(CONFIG_ISA) && !defined(CONFIG_PCI) && !defined(CONFIG_ATARI_ROM_ISA) + #define inb isa_inb + #define inb_p isa_inb_p + #define outb isa_outb +@@ -306,7 +374,34 @@ static inline void isa_delay(void) + #endif + #endif /* CONFIG_PCI */ + +-#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && defined(CONFIG_HP300) ++#if defined(CONFIG_ATARI_ROM_ISA) ++/* ++ * kernel with both ROM port ISA and IDE compiled in, those have ++ * conflicting defs for in/out. Simply consider port < 1024 ++ * ROM port ISA and everything else regular ISA for IDE. read,write not defined ++ * in this case ++ */ ++#define inb(port) ((port) < 1024 ? isa_rom_inb(port) : in_8(port)) ++#define inb_p(port) ((port) < 1024 ? isa_rom_inb_p(port) : in_8(port)) ++#define inw(port) ((port) < 1024 ? isa_rom_inw(port) : in_le16(port)) ++#define inw_p(port) ((port) < 1024 ? isa_rom_inw_p(port) : in_le16(port)) ++#define inl(port) ((port) < 1024 ? isa_rom_inl(port) : in_le32(port)) ++#define inl_p(port) ((port) < 1024 ? isa_rom_inl_p(port) : in_le32(port)) ++ ++#define outb(val,port) ((port) < 1024 ? isa_rom_outb((val), (port)) : out_8((port), (val))) ++#define outb_p(val,port) ((port) < 1024 ? isa_rom_outb_p((val), (port)) : out_8((port), (val))) ++#define outw(val,port) ((port) < 1024 ? isa_rom_outw((val), (port)) : out_le16((port), (val))) ++#define outw_p(val,port) ((port) < 1024 ? isa_rom_outw_p((val), (port)) : out_le16((port), (val))) ++#define outl(val,port) ((port) < 1024 ? isa_rom_outl((val), (port)) : out_le32((port), (val))) ++#define outl_p(val,port) ((port) < 1024 ? isa_rom_outl_p((val), (port)) : out_le32((port), (val))) ++ ++#define insb isa_rom_insb ++#define insw isa_rom_insw ++#define outsb isa_rom_outsb ++#define outsw isa_rom_outsw ++#endif ++ ++#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && !defined(CONFIG_ATARI_ROM_ISA) && defined(CONFIG_HP300) + /* + * We need to define dummy functions otherwise drivers/serial/8250.c doesn't link + */ +--- linux-m68k-2.6.21.orig/include/asm-m68k/raw_io.h ++++ linux-m68k-2.6.21/include/asm-m68k/raw_io.h +@@ -10,7 +10,7 @@ + + #ifdef __KERNEL__ + +-#include <asm/types.h> ++#include <asm/byteorder.h> + + + /* Values for nocacheflag and cmode */ +@@ -54,6 +54,46 @@ extern void __iounmap(void *addr, unsign + #define raw_outw(val,port) out_be16((port),(val)) + #define raw_outl(val,port) out_be32((port),(val)) + ++/* ++ * Atari ROM port (cartridge port) ISA adapter, used for the EtherNEC NE2000 ++ * network card driver. ++ * The ISA adapter connects address lines A9-A13 to ISA address lines A0-A4, ++ * and hardwires the rest of the ISA addresses for a base address of 0x300. ++ * ++ * Data lines D8-D15 are connected to ISA data lines D0-D7 for reading. ++ * For writes, address lines A1-A8 are latched to ISA data lines D0-D7 ++ * (meaning the bit pattern on A1-A8 can be read back as byte). ++ * ++ * Reads and writes are byte only. ++ */ ++ ++#if defined(CONFIG_ATARI_ROM_ISA) ++#define rom_in_8(addr) \ ++ ({ u16 __v = (*(__force volatile u16 *) (addr)); __v >>= 8; __v; }) ++#define rom_in_be16(addr) \ ++ ({ u16 __v = (*(__force volatile u16 *) (addr)); __v >>= 8; __v; }) ++#define rom_in_be32(addr) \ ++ ({ u32 __v = (*(__force volatile u32 *) (addr)); __v >>= 8; __v; }) ++#define rom_in_le16(addr) \ ++ ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v >>= 8; __v; }) ++#define rom_in_le32(addr) \ ++ ({ u32 __v = le32_to_cpu(*(__force volatile u32 *) (addr)); __v >>= 8; __v; }) ++ ++#define rom_out_8(addr,b) ({u8 __w, __v = (b); __w = ((*(__force volatile u8 *) ((addr) + 0x10000 + (__v<<1)))); }) ++#define rom_out_be16(addr,w) ({u16 __w, __v = (w); __w = ((*(__force volatile u16 *) ((addr) + 0x10000 + (__v<<1)))); }) ++#define rom_out_be32(addr,l) ({u32 __w, __v = (l); __w = ((*(__force volatile u32 *) ((addr) + 0x10000 + (__v<<1)))); }) ++#define rom_out_le16(addr,w) ({u16 __w, __v = cpu_to_le16(w); __w = ((*(__force volatile u16 *) ((addr) + 0x10000 + (__v<<1)))); }) ++#define rom_out_le32(addr,l) ({u32 __w, __v = cpu_to_le32(l); __w = ((*(__force volatile u32 *) ((addr) + 0x10000 + (__v<<1)))); }) ++ ++#define raw_rom_inb rom_in_8 ++#define raw_rom_inw rom_in_be16 ++#define raw_rom_inl rom_in_be32 ++ ++#define raw_rom_outb(val,port) rom_out_8((port),(val)) ++#define raw_rom_outw(val,port) rom_out_be16((port),(val)) ++#define raw_rom_outl(val,port) rom_out_be32((port),(val)) ++#endif /* CONFIG_ATARI_ROM_ISA */ ++ + static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len) + { + unsigned int i; +@@ -336,6 +376,62 @@ static inline void raw_outsw_swapw(volat + : "d0", "a0", "a1", "d6"); + } + ++ ++#if defined(CONFIG_ATARI_ROM_ISA) ++static inline void raw_rom_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < len; i++) ++ *buf++ = rom_in_8(port); ++} ++ ++static inline void raw_rom_outsb(volatile u8 __iomem *port, const u8 *buf, ++ unsigned int len) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < len; i++) ++ rom_out_8(port, *buf++); ++} ++ ++static inline void raw_rom_insw(volatile u16 __iomem *port, u16 *buf, ++ unsigned int nr) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < nr; i++) ++ *buf++ = rom_in_be16(port); ++} ++ ++static inline void raw_rom_outsw(volatile u16 __iomem *port, const u16 *buf, ++ unsigned int nr) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < nr; i++) ++ rom_out_be16(port, *buf++); ++} ++ ++static inline void raw_rom_insw_swapw(volatile u16 __iomem *port, u16 *buf, ++ unsigned int nr) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < nr; i++) ++ *buf++ = rom_in_le16(port); ++} ++ ++static inline void raw_rom_outsw_swapw(volatile u16 __iomem *port, const u16 *buf, ++ unsigned int nr) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < nr; i++) ++ rom_out_le16(port, *buf++); ++} ++#endif /* CONFIG_ATARI_ROM_ISA */ ++ + #define __raw_writel raw_outl + + #endif /* __KERNEL__ */ |