diff options
Diffstat (limited to 'arch/m68k/include/asm/raw_io.h')
-rw-r--r-- | arch/m68k/include/asm/raw_io.h | 109 |
1 files changed, 108 insertions, 1 deletions
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 | |||
63 | static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len) | 114 | static 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) | ||
398 | static 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 | |||
406 | static 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 | |||
415 | static 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 | |||
424 | static 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 | |||
433 | static 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 | |||
442 | static 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 */ |