diff options
Diffstat (limited to 'drivers/ide/buddha.c')
| -rw-r--r-- | drivers/ide/buddha.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/ide/buddha.c b/drivers/ide/buddha.c index e3c6a5913305..ab4f169d0837 100644 --- a/drivers/ide/buddha.c +++ b/drivers/ide/buddha.c | |||
| @@ -99,7 +99,7 @@ static const char *buddha_board_name[] = { "Buddha", "Catweasel", "X-Surf" }; | |||
| 99 | * Check and acknowledge the interrupt status | 99 | * Check and acknowledge the interrupt status |
| 100 | */ | 100 | */ |
| 101 | 101 | ||
| 102 | static int buddha_ack_intr(ide_hwif_t *hwif) | 102 | static int buddha_test_irq(ide_hwif_t *hwif) |
| 103 | { | 103 | { |
| 104 | unsigned char ch; | 104 | unsigned char ch; |
| 105 | 105 | ||
| @@ -109,21 +109,16 @@ static int buddha_ack_intr(ide_hwif_t *hwif) | |||
| 109 | return 1; | 109 | return 1; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | static int xsurf_ack_intr(ide_hwif_t *hwif) | 112 | static 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 | ||
| 124 | static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base, | 120 | static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base, |
| 125 | unsigned long ctl, unsigned long irq_port, | 121 | unsigned long ctl, unsigned long irq_port) |
| 126 | ide_ack_intr_t *ack_intr) | ||
| 127 | { | 122 | { |
| 128 | int i; | 123 | int i; |
| 129 | 124 | ||
| @@ -138,10 +133,19 @@ static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base, | |||
| 138 | hw->io_ports.irq_addr = irq_port; | 133 | hw->io_ports.irq_addr = irq_port; |
| 139 | 134 | ||
| 140 | hw->irq = IRQ_AMIGA_PORTS; | 135 | hw->irq = IRQ_AMIGA_PORTS; |
| 141 | hw->ack_intr = ack_intr; | ||
| 142 | } | 136 | } |
| 143 | 137 | ||
| 138 | static const struct ide_port_ops buddha_port_ops = { | ||
| 139 | .test_irq = buddha_test_irq, | ||
| 140 | }; | ||
| 141 | |||
| 142 | static const struct ide_port_ops xsurf_port_ops = { | ||
| 143 | .clear_irq = xsurf_clear_irq, | ||
| 144 | .test_irq = buddha_test_irq, | ||
| 145 | }; | ||
| 146 | |||
| 144 | static const struct ide_port_info buddha_port_info = { | 147 | static const struct ide_port_info buddha_port_info = { |
| 148 | .port_ops = &buddha_port_ops, | ||
| 145 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, | 149 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, |
| 146 | .irq_flags = IRQF_SHARED, | 150 | .irq_flags = IRQF_SHARED, |
| 147 | .chipset = ide_generic, | 151 | .chipset = ide_generic, |
| @@ -161,6 +165,7 @@ static int __init buddha_init(void) | |||
| 161 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { | 165 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { |
| 162 | unsigned long board; | 166 | unsigned long board; |
| 163 | struct ide_hw hw[MAX_NUM_HWIFS], *hws[MAX_NUM_HWIFS]; | 167 | struct ide_hw hw[MAX_NUM_HWIFS], *hws[MAX_NUM_HWIFS]; |
| 168 | struct ide_port_info d = buddha_port_info; | ||
| 164 | 169 | ||
| 165 | if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { | 170 | if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { |
| 166 | buddha_num_hwifs = BUDDHA_NUM_HWIFS; | 171 | buddha_num_hwifs = BUDDHA_NUM_HWIFS; |
| @@ -171,6 +176,7 @@ static int __init buddha_init(void) | |||
| 171 | } else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF) { | 176 | } else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF) { |
| 172 | buddha_num_hwifs = XSURF_NUM_HWIFS; | 177 | buddha_num_hwifs = XSURF_NUM_HWIFS; |
| 173 | type=BOARD_XSURF; | 178 | type=BOARD_XSURF; |
| 179 | d.port_ops = &xsurf_port_ops; | ||
| 174 | } else | 180 | } else |
| 175 | continue; | 181 | continue; |
| 176 | 182 | ||
| @@ -203,28 +209,24 @@ fail_base2: | |||
| 203 | 209 | ||
| 204 | for (i = 0; i < buddha_num_hwifs; i++) { | 210 | for (i = 0; i < buddha_num_hwifs; i++) { |
| 205 | unsigned long base, ctl, irq_port; | 211 | unsigned long base, ctl, irq_port; |
| 206 | ide_ack_intr_t *ack_intr; | ||
| 207 | 212 | ||
| 208 | if (type != BOARD_XSURF) { | 213 | if (type != BOARD_XSURF) { |
| 209 | base = buddha_board + buddha_bases[i]; | 214 | base = buddha_board + buddha_bases[i]; |
| 210 | ctl = base + BUDDHA_CONTROL; | 215 | ctl = base + BUDDHA_CONTROL; |
| 211 | irq_port = buddha_board + buddha_irqports[i]; | 216 | irq_port = buddha_board + buddha_irqports[i]; |
| 212 | ack_intr = buddha_ack_intr; | ||
| 213 | } else { | 217 | } else { |
| 214 | base = buddha_board + xsurf_bases[i]; | 218 | base = buddha_board + xsurf_bases[i]; |
| 215 | /* X-Surf has no CS1* (Control/AltStat) */ | 219 | /* X-Surf has no CS1* (Control/AltStat) */ |
| 216 | ctl = 0; | 220 | ctl = 0; |
| 217 | irq_port = buddha_board + xsurf_irqports[i]; | 221 | irq_port = buddha_board + xsurf_irqports[i]; |
| 218 | ack_intr = xsurf_ack_intr; | ||
| 219 | } | 222 | } |
| 220 | 223 | ||
| 221 | buddha_setup_ports(&hw[i], base, ctl, irq_port, | 224 | buddha_setup_ports(&hw[i], base, ctl, irq_port); |
| 222 | ack_intr); | ||
| 223 | 225 | ||
| 224 | hws[i] = &hw[i]; | 226 | hws[i] = &hw[i]; |
| 225 | } | 227 | } |
| 226 | 228 | ||
| 227 | ide_host_add(&buddha_port_info, hws, i, NULL); | 229 | ide_host_add(&d, hws, i, NULL); |
| 228 | } | 230 | } |
| 229 | 231 | ||
| 230 | return 0; | 232 | return 0; |
