1 /*
2 * linux/include/asm-m68k/ide.h
3 *
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
6
7 /* Copyright(c) 1996 Kars de Jong */
8 /* Based on the ide driver from 1.2.13pl8 */
9
10 /*
11 * Credits (alphabetical):
12 *
13 * - Bjoern Brauel
14 * - Kars de Jong
15 * - Torsten Ebeling
16 * - Dwight Engen
17 * - Thorsten Floeck
18 * - Roman Hodek
19 * - Guenther Kelleter
20 * - Chris Lawrence
21 * - Michael Rausch
22 * - Christian Sauer
23 * - Michael Schmitz
24 * - Jes Soerensen
25 * - Michael Thurm
26 * - Geert Uytterhoeven
27 */
28
29 #ifndef _M68K_IDE_H
30 #define _M68K_IDE_H
31
32 #ifdef __KERNEL__
33
34 #include <linux/config.h>
35
36 #include <asm/setup.h>
37 #include <asm/io.h>
38 #include <asm/irq.h>
39
40 #ifdef CONFIG_ATARI
41 #include <linux/interrupt.h>
42 #include <asm/atari_stdma.h>
43 #endif
44
45 #ifdef CONFIG_MAC
46 #include <asm/macints.h>
47 #endif
48
49 #ifndef MAX_HWIFS
50 #define MAX_HWIFS 4 /* same as the other archs */
51 #endif
52
53
ide_default_irq(ide_ioreg_t base)54 static __inline__ int ide_default_irq(ide_ioreg_t base)
55 {
56 return 0;
57 }
58
ide_default_io_base(int index)59 static __inline__ ide_ioreg_t ide_default_io_base(int index)
60 {
61 return 0;
62 }
63
64
65 /*
66 * Set up a hw structure for a specified data port, control port and IRQ.
67 * This should follow whatever the default interface uses.
68 */
ide_init_hwif_ports(hw_regs_t * hw,ide_ioreg_t data_port,ide_ioreg_t ctrl_port,int * irq)69 static __inline__ void ide_init_hwif_ports(hw_regs_t *hw,
70 ide_ioreg_t data_port,
71 ide_ioreg_t ctrl_port, int *irq)
72 {
73 if (data_port || ctrl_port)
74 printk("ide_init_hwif_ports: must not be called\n");
75 }
76
77 /*
78 * This registers the standard ports for this architecture with the IDE
79 * driver.
80 */
ide_init_default_hwifs(void)81 static __inline__ void ide_init_default_hwifs(void)
82 {
83 }
84
85 /*
86 * Get rid of defs from io.h - ide has its private and conflicting versions
87 * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we
88 * always use the `raw' MMIO versions
89 */
90 #undef inb
91 #undef inw
92 #undef insw
93 #undef inl
94 #undef insl
95 #undef outb
96 #undef outw
97 #undef outsw
98 #undef outl
99 #undef outsl
100 #undef readb
101 #undef readw
102 #undef readl
103 #undef writeb
104 #undef writew
105 #undef writel
106
107 #define inb in_8
108 #define inw in_be16
109 #define insw(port, addr, n) raw_insw((u16 *)port, addr, n)
110 #define inl in_be32
111 #define insl(port, addr, n) raw_insl((u32 *)port, addr, n)
112 #define outb(val, port) out_8(port, val)
113 #define outw(val, port) out_be16(port, val)
114 #define outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
115 #define outl(val, port) out_be32(port, val)
116 #define outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
117 #define readb in_8
118 #define readw in_be16
119 #define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n)
120 #define readl in_be32
121 #define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n)
122 #define writeb(val, port) out_8(port, val)
123 #define writew(val, port) out_be16(port, val)
124 #define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
125 #define writel(val, port) out_be32(port, val)
126 #define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
127 #if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
128 #define insw_swapw(port, addr, n) raw_insw_swapw((u16 *)port, addr, n)
129 #define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n)
130 #endif
131
132
133 /* Q40 and Atari have byteswapped IDE busses and since many interesting
134 * values in the identification string are text, chars and words they
135 * happened to be almost correct without swapping.. However *_capacity
136 * is needed for drives over 8 GB. RZ */
137 #if defined(CONFIG_Q40) || defined(CONFIG_ATARI)
138 #define M68K_IDE_SWAPW (MACH_IS_Q40 || MACH_IS_ATARI)
139 #endif
140
141 #ifdef CONFIG_BLK_DEV_FALCON_IDE
142 #define IDE_ARCH_LOCK
143
144 extern int falconide_intr_lock;
145
ide_release_lock(void)146 static __inline__ void ide_release_lock(void)
147 {
148 if (MACH_IS_ATARI) {
149 if (falconide_intr_lock == 0) {
150 printk("ide_release_lock: bug\n");
151 return;
152 }
153 falconide_intr_lock = 0;
154 stdma_release();
155 }
156 }
157
ide_get_lock(void (* handler)(int,void *,struct pt_regs *),void * data)158 static __inline__ void ide_get_lock(void (*handler)(int, void *, struct pt_regs *), void *data)
159 {
160 if (MACH_IS_ATARI) {
161 if (falconide_intr_lock == 0) {
162 if (in_interrupt() > 0)
163 panic( "Falcon IDE hasn't ST-DMA lock in interrupt" );
164 stdma_lock(handler, data);
165 falconide_intr_lock = 1;
166 }
167 }
168 }
169 #endif /* CONFIG_BLK_DEV_FALCON_IDE */
170
171 #define IDE_ARCH_ACK_INTR
172 #define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1)
173
174 #endif /* __KERNEL__ */
175 #endif /* _M68K_IDE_H */
176