]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/pci/scc_pata.c
via82cxxx: add ->remove method and module_exit()
[linux-2.6-omap-h63xx.git] / drivers / ide / pci / scc_pata.c
index c110f359b03e3dcb22336f301604f5ab1bfa127c..94a7ab86423616e7889c4bc4a2fa63f1f1d5b7b5 100644 (file)
@@ -65,7 +65,7 @@
 
 static struct scc_ports {
        unsigned long ctl, dma;
-       ide_hwif_t *hwif;  /* for removing port from system */
+       struct ide_host *host;  /* for removing port from system */
 } scc_ports[MAX_HWIFS];
 
 /* PIO transfer mode  table */
@@ -188,14 +188,6 @@ static void scc_ide_outb(u8 addr, unsigned long port)
        out_be32((void*)port, addr);
 }
 
-static void scc_ide_outbsync(ide_hwif_t *hwif, u8 addr, unsigned long port)
-{
-       out_be32((void*)port, addr);
-       eieio();
-       in_be32((void*)(hwif->dma_base + 0x01c));
-       eieio();
-}
-
 static void
 scc_ide_outsw(unsigned long port, void *addr, u32 count)
 {
@@ -594,14 +586,9 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
                                    const struct ide_port_info *d)
 {
        struct scc_ports *ports = pci_get_drvdata(dev);
-       ide_hwif_t *hwif = NULL;
+       struct ide_host *host;
        hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
-       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
-       int i;
-
-       hwif = ide_find_port_slot(d);
-       if (hwif == NULL)
-               return -ENOMEM;
+       int i, rc;
 
        memset(&hw, 0, sizeof(hw));
        for (i = 0; i <= 8; i++)
@@ -610,9 +597,11 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
        hw.dev = &dev->dev;
        hw.chipset = ide_pci;
 
-       idx[0] = hwif->index;
+       rc = ide_host_add(d, hws, &host);
+       if (rc)
+               return rc;
 
-       ide_device_add(idx, d, hws);
+       ports->host = host;
 
        return 0;
 }
@@ -816,23 +805,6 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
 
        ide_set_hwifdata(hwif, ports);
 
-       hwif->exec_command        = scc_exec_command;
-       hwif->read_status         = scc_read_status;
-       hwif->read_altstatus      = scc_read_altstatus;
-       hwif->read_sff_dma_status = scc_read_sff_dma_status;
-
-       hwif->set_irq = scc_set_irq;
-
-       hwif->tf_load = scc_tf_load;
-       hwif->tf_read = scc_tf_read;
-
-       hwif->input_data  = scc_input_data;
-       hwif->output_data = scc_output_data;
-
-       hwif->INB = scc_ide_inb;
-       hwif->OUTB = scc_ide_outb;
-       hwif->OUTBSYNC = scc_ide_outbsync;
-
        hwif->dma_base = dma_base;
        hwif->config_data = ports->ctl;
 }
@@ -873,8 +845,6 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
 {
        struct scc_ports *ports = ide_get_hwifdata(hwif);
 
-       ports->hwif = hwif;
-
        /* PTERADD */
        out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma);
 
@@ -884,6 +854,21 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
                hwif->ultra_mask = ATA_UDMA5; /* 100MHz */
 }
 
+static const struct ide_tp_ops scc_tp_ops = {
+       .exec_command           = scc_exec_command,
+       .read_status            = scc_read_status,
+       .read_altstatus         = scc_read_altstatus,
+       .read_sff_dma_status    = scc_read_sff_dma_status,
+
+       .set_irq                = scc_set_irq,
+
+       .tf_load                = scc_tf_load,
+       .tf_read                = scc_tf_read,
+
+       .input_data             = scc_input_data,
+       .output_data            = scc_output_data,
+};
+
 static const struct ide_port_ops scc_port_ops = {
        .set_pio_mode           = scc_set_pio_mode,
        .set_dma_mode           = scc_set_dma_mode,
@@ -907,6 +892,7 @@ static const struct ide_dma_ops scc_dma_ops = {
       .name            = name_str,                     \
       .init_iops       = init_iops_scc,                \
       .init_hwif       = init_hwif_scc,                \
+      .tp_ops          = &scc_tp_ops,          \
       .port_ops                = &scc_port_ops,                \
       .dma_ops         = &scc_dma_ops,                 \
       .host_flags      = IDE_HFLAG_SINGLE,             \
@@ -941,7 +927,8 @@ static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_i
 static void __devexit scc_remove(struct pci_dev *dev)
 {
        struct scc_ports *ports = pci_get_drvdata(dev);
-       ide_hwif_t *hwif = ports->hwif;
+       struct ide_host *host = ports->host;
+       ide_hwif_t *hwif = host->ports[0];
 
        if (hwif->dmatable_cpu) {
                pci_free_consistent(dev, PRD_ENTRIES * PRD_BYTES,
@@ -949,7 +936,7 @@ static void __devexit scc_remove(struct pci_dev *dev)
                hwif->dmatable_cpu = NULL;
        }
 
-       ide_unregister(hwif);
+       ide_host_remove(host);
 
        iounmap((void*)ports->dma);
        iounmap((void*)ports->ctl);