ide: re-implement ide_pci_init_one() on top of ide_pci_init_two()
[safe/jmp/linux-2.6] / drivers / ide / falconide.c
index d4d7ff1..22fa273 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/atarihw.h>
 #include <asm/atariints.h>
 #include <asm/atari_stdma.h>
+#include <asm/ide.h>
 
 #define DRV_NAME "falconide"
 
@@ -62,26 +63,30 @@ static void falconide_get_lock(irq_handler_t handler, void *data)
        }
 }
 
-static void falconide_input_data(ide_drive_t *drive, struct request *rq,
+static void falconide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
                                 void *buf, unsigned int len)
 {
        unsigned long data_addr = drive->hwif->io_ports.data_addr;
 
-       if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
-               return insw(data_addr, buf, (len + 1) / 2);
+       if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) {
+               __ide_mm_insw(data_addr, buf, (len + 1) / 2);
+               return;
+       }
 
-       insw_swapw(data_addr, buf, (len + 1) / 2);
+       raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 }
 
-static void falconide_output_data(ide_drive_t *drive, struct request *rq,
+static void falconide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
                                  void *buf, unsigned int len)
 {
        unsigned long data_addr = drive->hwif->io_ports.data_addr;
 
-       if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
-               return outsw(data_addr, buf, (len + 1) / 2);
+       if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) {
+               __ide_mm_outsw(data_addr, buf, (len + 1) / 2);
+               return;
+       }
 
-       outsw_swapw(data_addr, buf, (len + 1) / 2);
+       raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2);
 }
 
 /* Atari has a byte-swapped IDE interface */
@@ -89,9 +94,9 @@ static const struct ide_tp_ops falconide_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
+       .write_devctl           = ide_write_devctl,
 
-       .set_irq                = ide_set_irq,
-
+       .dev_select             = ide_dev_select,
        .tf_load                = ide_tf_load,
        .tf_read                = ide_tf_read,
 
@@ -103,10 +108,13 @@ static const struct ide_port_info falconide_port_info = {
        .get_lock               = falconide_get_lock,
        .release_lock           = falconide_release_lock,
        .tp_ops                 = &falconide_tp_ops,
-       .host_flags             = IDE_HFLAG_NO_DMA | IDE_HFLAG_SERIALIZE,
+       .host_flags             = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
+                                 IDE_HFLAG_NO_DMA,
+       .irq_flags              = IRQF_SHARED,
+       .chipset                = ide_generic,
 };
 
-static void __init falconide_setup_ports(hw_regs_t *hw)
+static void __init falconide_setup_ports(struct ide_hw *hw)
 {
        int i;
 
@@ -121,8 +129,6 @@ static void __init falconide_setup_ports(hw_regs_t *hw)
 
        hw->irq = IRQ_MFP_IDE;
        hw->ack_intr = NULL;
-
-       hw->chipset = ide_generic;
 }
 
     /*
@@ -132,7 +138,7 @@ static void __init falconide_setup_ports(hw_regs_t *hw)
 static int __init falconide_init(void)
 {
        struct ide_host *host;
-       hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
+       struct ide_hw hw, *hws[] = { &hw };
        int rc;
 
        if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
@@ -147,7 +153,7 @@ static int __init falconide_init(void)
 
        falconide_setup_ports(&hw);
 
-       host = ide_host_alloc(&falconide_port_info, hws);
+       host = ide_host_alloc(&falconide_port_info, hws, 1);
        if (host == NULL) {
                rc = -ENOMEM;
                goto err;