summaryrefslogtreecommitdiffstats
path: root/drivers/ide/buddha.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-06-15 18:52:57 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-06-15 18:52:57 +0200
commiteba8999cefb6b61704d8fa825b7694825a087765 (patch)
treee5f7d1ed464efe21160b425e8a57b017b9e99441 /drivers/ide/buddha.c
parent74414a91204ee57528041f771da1fd1ee3ba64c4 (diff)
downloadop-kernel-dev-eba8999cefb6b61704d8fa825b7694825a087765.zip
op-kernel-dev-eba8999cefb6b61704d8fa825b7694825a087765.tar.gz
ide: move IRQ clearing from ack_intr() method to clear_irq() method (take 2)
There are now two methods that clear the port interrupt: ack_intr() method, implemented only on M680x0 machines, that is called at the start of ide_intr(), and clear_irq() method, that is called somewhat later in this function. In order to stop this duplication, delegate the task of clearing the interrupt to clear_irq() method, only leaving to ack_intr() the task of testing for the port interrupt. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
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 e3c6a59..9cd7b11 100644
--- a/drivers/ide/buddha.c
+++ b/drivers/ide/buddha.c
@@ -109,16 +109,12 @@ static int buddha_ack_intr(ide_hwif_t *hwif)
return 1;
}
-static int xsurf_ack_intr(ide_hwif_t *hwif)
+static void xsurf_clear_irq(ide_drive_t *drive)
{
- unsigned char ch;
-
- ch = z_readb(hwif->io_ports.irq_addr);
- /* X-Surf needs a 0 written to IRQ register to ensure ISA bit A11 stays at 0 */
- z_writeb(0, hwif->io_ports.irq_addr);
- if (!(ch & 0x80))
- return 0;
- return 1;
+ /*
+ * X-Surf needs 0 written to IRQ register to ensure ISA bit A11 stays at 0
+ */
+ z_writeb(0, drive->hwif->io_ports.irq_addr);
}
static 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,
hw->ack_intr = ack_intr;
}
+static const struct ide_port_ops xsurf_port_ops = {
+ .clear_irq = xsurf_clear_irq,
+};
+
static const struct ide_port_info buddha_port_info = {
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
.irq_flags = IRQF_SHARED,
@@ -161,6 +161,7 @@ static int __init buddha_init(void)
while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
unsigned long board;
struct ide_hw hw[MAX_NUM_HWIFS], *hws[MAX_NUM_HWIFS];
+ struct ide_port_info d = buddha_port_info;
if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) {
buddha_num_hwifs = BUDDHA_NUM_HWIFS;
@@ -171,6 +172,7 @@ static int __init buddha_init(void)
} else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF) {
buddha_num_hwifs = XSURF_NUM_HWIFS;
type=BOARD_XSURF;
+ d.port_ops = &xsurf_port_ops;
} else
continue;
@@ -203,28 +205,25 @@ fail_base2:
for (i = 0; i < buddha_num_hwifs; i++) {
unsigned long base, ctl, irq_port;
- ide_ack_intr_t *ack_intr;
if (type != BOARD_XSURF) {
base = buddha_board + buddha_bases[i];
ctl = base + BUDDHA_CONTROL;
irq_port = buddha_board + buddha_irqports[i];
- ack_intr = buddha_ack_intr;
} else {
base = buddha_board + xsurf_bases[i];
/* X-Surf has no CS1* (Control/AltStat) */
ctl = 0;
irq_port = buddha_board + xsurf_irqports[i];
- ack_intr = xsurf_ack_intr;
}
buddha_setup_ports(&hw[i], base, ctl, irq_port,
- ack_intr);
+ buddha_ack_intr);
hws[i] = &hw[i];
}
- ide_host_add(&buddha_port_info, hws, i, NULL);
+ ide_host_add(&d, hws, i, NULL);
}
return 0;
OpenPOWER on IntegriCloud