aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/buddha.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/buddha.c')
-rw-r--r--drivers/ide/buddha.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/ide/buddha.c b/drivers/ide/buddha.c
index e3c6a5913305..9cd7b115763d 100644
--- a/drivers/ide/buddha.c
+++ b/drivers/ide/buddha.c
@@ -109,16 +109,12 @@ static int buddha_ack_intr(ide_hwif_t *hwif)
109 return 1; 109 return 1;
110} 110}
111 111
112static int xsurf_ack_intr(ide_hwif_t *hwif) 112static void xsurf_clear_irq(ide_drive_t *drive)
113{ 113{
114 unsigned char ch; 114 /*
115 115 * X-Surf needs 0 written to IRQ register to ensure ISA bit A11 stays at 0
116 ch = z_readb(hwif->io_ports.irq_addr); 116 */
117 /* X-Surf needs a 0 written to IRQ register to ensure ISA bit A11 stays at 0 */ 117 z_writeb(0, drive->hwif->io_ports.irq_addr);
118 z_writeb(0, hwif->io_ports.irq_addr);
119 if (!(ch & 0x80))
120 return 0;
121 return 1;
122} 118}
123 119
124static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base, 120static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base,
@@ -141,6 +137,10 @@ static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base,
141 hw->ack_intr = ack_intr; 137 hw->ack_intr = ack_intr;
142} 138}
143 139
140static const struct ide_port_ops xsurf_port_ops = {
141 .clear_irq = xsurf_clear_irq,
142};
143
144static const struct ide_port_info buddha_port_info = { 144static const struct ide_port_info buddha_port_info = {
145 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, 145 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
146 .irq_flags = IRQF_SHARED, 146 .irq_flags = IRQF_SHARED,
@@ -161,6 +161,7 @@ static int __init buddha_init(void)
161 while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { 161 while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
162 unsigned long board; 162 unsigned long board;
163 struct ide_hw hw[MAX_NUM_HWIFS], *hws[MAX_NUM_HWIFS]; 163 struct ide_hw hw[MAX_NUM_HWIFS], *hws[MAX_NUM_HWIFS];
164 struct ide_port_info d = buddha_port_info;
164 165
165 if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { 166 if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) {
166 buddha_num_hwifs = BUDDHA_NUM_HWIFS; 167 buddha_num_hwifs = BUDDHA_NUM_HWIFS;
@@ -171,6 +172,7 @@ static int __init buddha_init(void)
171 } else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF) { 172 } else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF) {
172 buddha_num_hwifs = XSURF_NUM_HWIFS; 173 buddha_num_hwifs = XSURF_NUM_HWIFS;
173 type=BOARD_XSURF; 174 type=BOARD_XSURF;
175 d.port_ops = &xsurf_port_ops;
174 } else 176 } else
175 continue; 177 continue;
176 178
@@ -203,28 +205,25 @@ fail_base2:
203 205
204 for (i = 0; i < buddha_num_hwifs; i++) { 206 for (i = 0; i < buddha_num_hwifs; i++) {
205 unsigned long base, ctl, irq_port; 207 unsigned long base, ctl, irq_port;
206 ide_ack_intr_t *ack_intr;
207 208
208 if (type != BOARD_XSURF) { 209 if (type != BOARD_XSURF) {
209 base = buddha_board + buddha_bases[i]; 210 base = buddha_board + buddha_bases[i];
210 ctl = base + BUDDHA_CONTROL; 211 ctl = base + BUDDHA_CONTROL;
211 irq_port = buddha_board + buddha_irqports[i]; 212 irq_port = buddha_board + buddha_irqports[i];
212 ack_intr = buddha_ack_intr;
213 } else { 213 } else {
214 base = buddha_board + xsurf_bases[i]; 214 base = buddha_board + xsurf_bases[i];
215 /* X-Surf has no CS1* (Control/AltStat) */ 215 /* X-Surf has no CS1* (Control/AltStat) */
216 ctl = 0; 216 ctl = 0;
217 irq_port = buddha_board + xsurf_irqports[i]; 217 irq_port = buddha_board + xsurf_irqports[i];
218 ack_intr = xsurf_ack_intr;
219 } 218 }
220 219
221 buddha_setup_ports(&hw[i], base, ctl, irq_port, 220 buddha_setup_ports(&hw[i], base, ctl, irq_port,
222 ack_intr); 221 buddha_ack_intr);
223 222
224 hws[i] = &hw[i]; 223 hws[i] = &hw[i];
225 } 224 }
226 225
227 ide_host_add(&buddha_port_info, hws, i, NULL); 226 ide_host_add(&d, hws, i, NULL);
228 } 227 }
229 228
230 return 0; 229 return 0;