diff options
author | Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de> | 2013-04-05 20:26:35 -0400 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2013-04-16 15:08:11 -0400 |
commit | 84b16b7b0d5c818fadc731a69965dc76dce0c91e (patch) | |
tree | bcddc4391a8df7ced9fa111de1c412208879ee19 /arch/m68k/include/asm/io_mm.h | |
parent | feb20ec2bb859d1d5fbace9a9566ad4221a433fc (diff) |
m68k/atari: ROM port ISA adapter support
Atari ROM port ISA adapter support for EtherNEC and NetUSBee adapters
16 bit access for ROM port adapters follows debugging and
clarification by David Galvez <dgalvez75@gmail.com>. The NetUSBee
ISP1160 USB chip uses these macros.
Signed-off-by: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k/include/asm/io_mm.h')
-rw-r--r-- | arch/m68k/include/asm/io_mm.h | 136 |
1 files changed, 130 insertions, 6 deletions
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 |
133 | extern int isa_type; | 155 | extern 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 | |||
225 | static inline void isa_delay(void) | 289 | static 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)) |