aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/m68k/Kconfig.bus10
-rw-r--r--arch/m68k/include/asm/io_mm.h136
-rw-r--r--arch/m68k/include/asm/raw_io.h109
-rw-r--r--arch/m68k/kernel/setup_mm.c6
4 files changed, 254 insertions, 7 deletions
diff --git a/arch/m68k/Kconfig.bus b/arch/m68k/Kconfig.bus
index 93ef0346b209..675b087198f6 100644
--- a/arch/m68k/Kconfig.bus
+++ b/arch/m68k/Kconfig.bus
@@ -45,6 +45,16 @@ config ISA
45 (MCA) or VESA. ISA is an older system, now being displaced by PCI; 45 (MCA) or VESA. ISA is an older system, now being displaced by PCI;
46 newer boards don't support it. If you have ISA, say Y, otherwise N. 46 newer boards don't support it. If you have ISA, say Y, otherwise N.
47 47
48config ATARI_ROM_ISA
49 bool "Atari ROM port ISA adapter support"
50 depends on ATARI
51 help
52 This option enables support for the ROM port ISA adapter used to
53 operate ISA cards on Atari. Only 8 bit cards are supported, and
54 no interrupt lines are connected.
55 The only driver currently using this adapter is the EtherNEC
56 driver for RTL8019AS based NE2000 compatible network cards.
57
48config GENERIC_ISA_DMA 58config GENERIC_ISA_DMA
49 def_bool ISA 59 def_bool ISA
50 60
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index a6686d26fe17..ffdf54f44bc6 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -63,6 +63,23 @@
63#endif 63#endif
64#endif /* AMIGA_PCMCIA */ 64#endif /* AMIGA_PCMCIA */
65 65
66#ifdef CONFIG_ATARI_ROM_ISA
67
68#define enec_isa_read_base 0xfffa0000
69#define enec_isa_write_base 0xfffb0000
70
71#define ENEC_ISA_IO_B(ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x7F)<<9))
72#define ENEC_ISA_IO_W(ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x7F)<<9))
73#define ENEC_ISA_MEM_B(madr) (enec_isa_read_base+((((unsigned long)(madr))&0x7F)<<9))
74#define ENEC_ISA_MEM_W(madr) (enec_isa_read_base+((((unsigned long)(madr))&0x7F)<<9))
75
76#ifndef MULTI_ISA
77#define MULTI_ISA 0
78#else
79#undef MULTI_ISA
80#define MULTI_ISA 1
81#endif
82#endif /* ATARI_ROM_ISA */
66 83
67 84
68#if defined(CONFIG_PCI) && defined(CONFIG_COLDFIRE) 85#if defined(CONFIG_PCI) && defined(CONFIG_COLDFIRE)
@@ -111,14 +128,15 @@ void mcf_pci_outsl(u32 addr, const u32 *buf, u32 len);
111#define readw(addr) in_le16(addr) 128#define readw(addr) in_le16(addr)
112#define writew(v, addr) out_le16((addr), (v)) 129#define writew(v, addr) out_le16((addr), (v))
113 130
114#elif defined(CONFIG_ISA) 131#elif defined(CONFIG_ISA) || defined(CONFIG_ATARI_ROM_ISA)
115 132
116#if MULTI_ISA == 0 133#if MULTI_ISA == 0
117#undef MULTI_ISA 134#undef MULTI_ISA
118#endif 135#endif
119 136
120#define ISA_TYPE_Q40 (1) 137#define ISA_TYPE_Q40 (1)
121#define ISA_TYPE_AG (2) 138#define ISA_TYPE_AG (2)
139#define ISA_TYPE_ENEC (3)
122 140
123#if defined(CONFIG_Q40) && !defined(MULTI_ISA) 141#if defined(CONFIG_Q40) && !defined(MULTI_ISA)
124#define ISA_TYPE ISA_TYPE_Q40 142#define ISA_TYPE ISA_TYPE_Q40
@@ -128,6 +146,10 @@ void mcf_pci_outsl(u32 addr, const u32 *buf, u32 len);
128#define ISA_TYPE ISA_TYPE_AG 146#define ISA_TYPE ISA_TYPE_AG
129#define ISA_SEX 1 147#define ISA_SEX 1
130#endif 148#endif
149#if defined(CONFIG_ATARI_ROM_ISA) && !defined(MULTI_ISA)
150#define ISA_TYPE ISA_TYPE_ENEC
151#define ISA_SEX 0
152#endif
131 153
132#ifdef MULTI_ISA 154#ifdef MULTI_ISA
133extern int isa_type; 155extern int isa_type;
@@ -152,6 +174,9 @@ static inline u8 __iomem *isa_itb(unsigned long addr)
152#ifdef CONFIG_AMIGA_PCMCIA 174#ifdef CONFIG_AMIGA_PCMCIA
153 case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr); 175 case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr);
154#endif 176#endif
177#ifdef CONFIG_ATARI_ROM_ISA
178 case ISA_TYPE_ENEC: return (u8 __iomem *)ENEC_ISA_IO_B(addr);
179#endif
155 default: return NULL; /* avoid warnings, just in case */ 180 default: return NULL; /* avoid warnings, just in case */
156 } 181 }
157} 182}
@@ -165,6 +190,9 @@ static inline u16 __iomem *isa_itw(unsigned long addr)
165#ifdef CONFIG_AMIGA_PCMCIA 190#ifdef CONFIG_AMIGA_PCMCIA
166 case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr); 191 case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr);
167#endif 192#endif
193#ifdef CONFIG_ATARI_ROM_ISA
194 case ISA_TYPE_ENEC: return (u16 __iomem *)ENEC_ISA_IO_W(addr);
195#endif
168 default: return NULL; /* avoid warnings, just in case */ 196 default: return NULL; /* avoid warnings, just in case */
169 } 197 }
170} 198}
@@ -188,6 +216,9 @@ static inline u8 __iomem *isa_mtb(unsigned long addr)
188#ifdef CONFIG_AMIGA_PCMCIA 216#ifdef CONFIG_AMIGA_PCMCIA
189 case ISA_TYPE_AG: return (u8 __iomem *)addr; 217 case ISA_TYPE_AG: return (u8 __iomem *)addr;
190#endif 218#endif
219#ifdef CONFIG_ATARI_ROM_ISA
220 case ISA_TYPE_ENEC: return (u8 __iomem *)ENEC_ISA_MEM_B(addr);
221#endif
191 default: return NULL; /* avoid warnings, just in case */ 222 default: return NULL; /* avoid warnings, just in case */
192 } 223 }
193} 224}
@@ -201,6 +232,9 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
201#ifdef CONFIG_AMIGA_PCMCIA 232#ifdef CONFIG_AMIGA_PCMCIA
202 case ISA_TYPE_AG: return (u16 __iomem *)addr; 233 case ISA_TYPE_AG: return (u16 __iomem *)addr;
203#endif 234#endif
235#ifdef CONFIG_ATARI_ROM_ISA
236 case ISA_TYPE_ENEC: return (u16 __iomem *)ENEC_ISA_MEM_W(addr);
237#endif
204 default: return NULL; /* avoid warnings, just in case */ 238 default: return NULL; /* avoid warnings, just in case */
205 } 239 }
206} 240}
@@ -222,6 +256,36 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
222 (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \ 256 (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \
223 : out_le16(isa_mtw((unsigned long)(p)),(val))) 257 : out_le16(isa_mtw((unsigned long)(p)),(val)))
224 258
259#ifdef CONFIG_ATARI_ROM_ISA
260#define isa_rom_inb(port) rom_in_8(isa_itb(port))
261#define isa_rom_inw(port) \
262 (ISA_SEX ? rom_in_be16(isa_itw(port)) \
263 : rom_in_le16(isa_itw(port)))
264
265#define isa_rom_outb(val, port) rom_out_8(isa_itb(port), (val))
266#define isa_rom_outw(val, port) \
267 (ISA_SEX ? rom_out_be16(isa_itw(port), (val)) \
268 : rom_out_le16(isa_itw(port), (val)))
269
270#define isa_rom_readb(p) rom_in_8(isa_mtb((unsigned long)(p)))
271#define isa_rom_readw(p) \
272 (ISA_SEX ? rom_in_be16(isa_mtw((unsigned long)(p))) \
273 : rom_in_le16(isa_mtw((unsigned long)(p))))
274#define isa_rom_readw_swap(p) \
275 (ISA_SEX ? rom_in_le16(isa_mtw((unsigned long)(p))) \
276 : rom_in_be16(isa_mtw((unsigned long)(p))))
277#define isa_rom_readw_raw(p) rom_in_be16(isa_mtw((unsigned long)(p)))
278
279#define isa_rom_writeb(val, p) rom_out_8(isa_mtb((unsigned long)(p)), (val))
280#define isa_rom_writew(val, p) \
281 (ISA_SEX ? rom_out_be16(isa_mtw((unsigned long)(p)), (val)) \
282 : rom_out_le16(isa_mtw((unsigned long)(p)), (val)))
283#define isa_rom_writew_swap(val, p) \
284 (ISA_SEX ? rom_out_le16(isa_mtw((unsigned long)(p)), (val)) \
285 : rom_out_be16(isa_mtw((unsigned long)(p)), (val)))
286#define isa_rom_writew_raw(val, p) rom_out_be16(isa_mtw((unsigned long)(p)), (val))
287#endif /* CONFIG_ATARI_ROM_ISA */
288
225static inline void isa_delay(void) 289static inline void isa_delay(void)
226{ 290{
227 switch(ISA_TYPE) 291 switch(ISA_TYPE)
@@ -232,6 +296,9 @@ static inline void isa_delay(void)
232#ifdef CONFIG_AMIGA_PCMCIA 296#ifdef CONFIG_AMIGA_PCMCIA
233 case ISA_TYPE_AG: break; 297 case ISA_TYPE_AG: break;
234#endif 298#endif
299#ifdef CONFIG_ATARI_ROM_ISA
300 case ISA_TYPE_ENEC: break;
301#endif
235 default: break; /* avoid warnings */ 302 default: break; /* avoid warnings */
236 } 303 }
237} 304}
@@ -263,6 +330,29 @@ static inline void isa_delay(void)
263 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) 330 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
264 331
265 332
333#ifdef CONFIG_ATARI_ROM_ISA
334#define isa_rom_inb_p(p) ({ u8 _v = isa_rom_inb(p); isa_delay(); _v; })
335#define isa_rom_inw_p(p) ({ u16 _v = isa_rom_inw(p); isa_delay(); _v; })
336#define isa_rom_outb_p(v, p) ({ isa_rom_outb((v), (p)); isa_delay(); })
337#define isa_rom_outw_p(v, p) ({ isa_rom_outw((v), (p)); isa_delay(); })
338
339#define isa_rom_insb(port, buf, nr) raw_rom_insb(isa_itb(port), (u8 *)(buf), (nr))
340
341#define isa_rom_insw(port, buf, nr) \
342 (ISA_SEX ? raw_rom_insw(isa_itw(port), (u16 *)(buf), (nr)) : \
343 raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
344
345#define isa_rom_outsb(port, buf, nr) raw_rom_outsb(isa_itb(port), (u8 *)(buf), (nr))
346
347#define isa_rom_outsw(port, buf, nr) \
348 (ISA_SEX ? raw_rom_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \
349 raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
350#endif /* CONFIG_ATARI_ROM_ISA */
351
352#endif /* CONFIG_ISA || CONFIG_ATARI_ROM_ISA */
353
354
355#if defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA)
266#define inb isa_inb 356#define inb isa_inb
267#define inb_p isa_inb_p 357#define inb_p isa_inb_p
268#define outb isa_outb 358#define outb isa_outb
@@ -285,9 +375,43 @@ static inline void isa_delay(void)
285#define readw isa_readw 375#define readw isa_readw
286#define writeb isa_writeb 376#define writeb isa_writeb
287#define writew isa_writew 377#define writew isa_writew
378#endif /* CONFIG_ISA && !CONFIG_ATARI_ROM_ISA */
288 379
289#else /* CONFIG_ISA */ 380#ifdef CONFIG_ATARI_ROM_ISA
290 381/*
382 * kernel with both ROM port ISA and IDE compiled in, those have
383 * conflicting defs for in/out. Simply consider port < 1024
384 * ROM port ISA and everything else regular ISA for IDE. read,write defined
385 * below.
386 */
387#define inb(port) ((port) < 1024 ? isa_rom_inb(port) : in_8(port))
388#define inb_p(port) ((port) < 1024 ? isa_rom_inb_p(port) : in_8(port))
389#define inw(port) ((port) < 1024 ? isa_rom_inw(port) : in_le16(port))
390#define inw_p(port) ((port) < 1024 ? isa_rom_inw_p(port) : in_le16(port))
391#define inl isa_inl
392#define inl_p isa_inl_p
393
394#define outb(val, port) ((port) < 1024 ? isa_rom_outb((val), (port)) : out_8((port), (val)))
395#define outb_p(val, port) ((port) < 1024 ? isa_rom_outb_p((val), (port)) : out_8((port), (val)))
396#define outw(val, port) ((port) < 1024 ? isa_rom_outw((val), (port)) : out_le16((port), (val)))
397#define outw_p(val, port) ((port) < 1024 ? isa_rom_outw_p((val), (port)) : out_le16((port), (val)))
398#define outl isa_outl
399#define outl_p isa_outl_p
400
401#define insb(port, buf, nr) ((port) < 1024 ? isa_rom_insb((port), (buf), (nr)) : isa_insb((port), (buf), (nr)))
402#define insw(port, buf, nr) ((port) < 1024 ? isa_rom_insw((port), (buf), (nr)) : isa_insw((port), (buf), (nr)))
403#define insl isa_insl
404#define outsb(port, buf, nr) ((port) < 1024 ? isa_rom_outsb((port), (buf), (nr)) : isa_outsb((port), (buf), (nr)))
405#define outsw(port, buf, nr) ((port) < 1024 ? isa_rom_outsw((port), (buf), (nr)) : isa_outsw((port), (buf), (nr)))
406#define outsl isa_outsl
407
408#define readb(addr) in_8(addr)
409#define writeb(val, addr) out_8((addr), (val))
410#define readw(addr) in_le16(addr)
411#define writew(val, addr) out_le16((addr), (val))
412#endif /* CONFIG_ATARI_ROM_ISA */
413
414#if !defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA)
291/* 415/*
292 * We need to define dummy functions for GENERIC_IOMAP support. 416 * We need to define dummy functions for GENERIC_IOMAP support.
293 */ 417 */
@@ -319,7 +443,7 @@ static inline void isa_delay(void)
319#define readw(addr) in_le16(addr) 443#define readw(addr) in_le16(addr)
320#define writew(val,addr) out_le16((addr),(val)) 444#define writew(val,addr) out_le16((addr),(val))
321 445
322#endif /* CONFIG_ISA */ 446#endif /* !CONFIG_ISA && !CONFIG_ATARI_ROM_ISA */
323 447
324#define readl(addr) in_le32(addr) 448#define readl(addr) in_le32(addr)
325#define writel(val,addr) out_le32((addr),(val)) 449#define writel(val,addr) out_le32((addr),(val))
diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h
index d9eb9834ccc8..932faa35655b 100644
--- a/arch/m68k/include/asm/raw_io.h
+++ b/arch/m68k/include/asm/raw_io.h
@@ -10,7 +10,7 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#include <asm/types.h> 13#include <asm/byteorder.h>
14 14
15 15
16/* Values for nocacheflag and cmode */ 16/* Values for nocacheflag and cmode */
@@ -60,6 +60,57 @@ extern void __iounmap(void *addr, unsigned long size);
60#define __raw_writew(val,addr) out_be16((addr),(val)) 60#define __raw_writew(val,addr) out_be16((addr),(val))
61#define __raw_writel(val,addr) out_be32((addr),(val)) 61#define __raw_writel(val,addr) out_be32((addr),(val))
62 62
63/*
64 * Atari ROM port (cartridge port) ISA adapter, used for the EtherNEC NE2000
65 * network card driver.
66 * The ISA adapter connects address lines A9-A13 to ISA address lines A0-A4,
67 * and hardwires the rest of the ISA addresses for a base address of 0x300.
68 *
69 * Data lines D8-D15 are connected to ISA data lines D0-D7 for reading.
70 * For writes, address lines A1-A8 are latched to ISA data lines D0-D7
71 * (meaning the bit pattern on A1-A8 can be read back as byte).
72 *
73 * Read and write operations are distinguished by the base address used:
74 * reads are from the ROM A side range, writes are through the B side range
75 * addresses (A side base + 0x10000).
76 *
77 * Reads and writes are byte only.
78 *
79 * 16 bit reads and writes are necessary for the NetUSBee adapter's USB
80 * chipset - 16 bit words are read straight off the ROM port while 16 bit
81 * reads are split into two byte writes. The low byte is latched to the
82 * NetUSBee buffer by a read from the _read_ window (with the data pattern
83 * asserted as A1-A8 address pattern). The high byte is then written to the
84 * write range as usual, completing the write cycle.
85 */
86
87#if defined(CONFIG_ATARI_ROM_ISA)
88#define rom_in_8(addr) \
89 ({ u16 __v = (*(__force volatile u16 *) (addr)); __v >>= 8; __v; })
90#define rom_in_be16(addr) \
91 ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; })
92#define rom_in_le16(addr) \
93 ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; })
94
95#define rom_out_8(addr, b) \
96 ({u8 __w, __v = (b); u32 _addr = ((u32) (addr)); \
97 __w = ((*(__force volatile u8 *) ((_addr | 0x10000) + (__v<<1)))); })
98#define rom_out_be16(addr, w) \
99 ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
100 __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v & 0xFF)<<1)))); \
101 __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v >> 8)<<1)))); })
102#define rom_out_le16(addr, w) \
103 ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
104 __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v >> 8)<<1)))); \
105 __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v & 0xFF)<<1)))); })
106
107#define raw_rom_inb rom_in_8
108#define raw_rom_inw rom_in_be16
109
110#define raw_rom_outb(val, port) rom_out_8((port), (val))
111#define raw_rom_outw(val, port) rom_out_be16((port), (val))
112#endif /* CONFIG_ATARI_ROM_ISA */
113
63static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len) 114static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
64{ 115{
65 unsigned int i; 116 unsigned int i;
@@ -342,6 +393,62 @@ static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
342 : "d0", "a0", "a1", "d6"); 393 : "d0", "a0", "a1", "d6");
343} 394}
344 395
396
397#if defined(CONFIG_ATARI_ROM_ISA)
398static inline void raw_rom_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
399{
400 unsigned int i;
401
402 for (i = 0; i < len; i++)
403 *buf++ = rom_in_8(port);
404}
405
406static inline void raw_rom_outsb(volatile u8 __iomem *port, const u8 *buf,
407 unsigned int len)
408{
409 unsigned int i;
410
411 for (i = 0; i < len; i++)
412 rom_out_8(port, *buf++);
413}
414
415static inline void raw_rom_insw(volatile u16 __iomem *port, u16 *buf,
416 unsigned int nr)
417{
418 unsigned int i;
419
420 for (i = 0; i < nr; i++)
421 *buf++ = rom_in_be16(port);
422}
423
424static inline void raw_rom_outsw(volatile u16 __iomem *port, const u16 *buf,
425 unsigned int nr)
426{
427 unsigned int i;
428
429 for (i = 0; i < nr; i++)
430 rom_out_be16(port, *buf++);
431}
432
433static inline void raw_rom_insw_swapw(volatile u16 __iomem *port, u16 *buf,
434 unsigned int nr)
435{
436 unsigned int i;
437
438 for (i = 0; i < nr; i++)
439 *buf++ = rom_in_le16(port);
440}
441
442static inline void raw_rom_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
443 unsigned int nr)
444{
445 unsigned int i;
446
447 for (i = 0; i < nr; i++)
448 rom_out_le16(port, *buf++);
449}
450#endif /* CONFIG_ATARI_ROM_ISA */
451
345#endif /* __KERNEL__ */ 452#endif /* __KERNEL__ */
346 453
347#endif /* _RAW_IO_H */ 454#endif /* _RAW_IO_H */
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 80cfbe56ea32..e67e53159573 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -381,6 +381,12 @@ void __init setup_arch(char **cmdline_p)
381 isa_sex = 1; 381 isa_sex = 1;
382 } 382 }
383#endif 383#endif
384#ifdef CONFIG_ATARI_ROM_ISA
385 if (MACH_IS_ATARI) {
386 isa_type = ISA_TYPE_ENEC;
387 isa_sex = 0;
388 }
389#endif
384#endif 390#endif
385} 391}
386 392