]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/ide/arm/rapide.c
ide: add struct ide_host (take 3)
[mirror_ubuntu-artful-kernel.git] / drivers / ide / arm / rapide.c
index b30adcf321c3dcfdcafe27c79678c0845e9f5cf8..11f3307385dea9640f45bd0cc0d1579982394c5c 100644 (file)
 
 #include <asm/ecard.h>
 
+static struct const ide_port_info rapide_port_info = {
+       .host_flags             = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
+};
+
 static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base,
                               void __iomem *ctrl, unsigned int sz, int irq)
 {
        unsigned long port = (unsigned long)base;
        int i;
 
-       for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-               hw->io_ports[i] = port;
+       for (i = 0; i <= 7; i++) {
+               hw->io_ports_array[i] = port;
                port += sz;
        }
-       hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
+       hw->io_ports.ctl_addr = (unsigned long)ctrl;
        hw->irq = irq;
 }
 
 static int __devinit
 rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
 {
-       ide_hwif_t *hwif;
        void __iomem *base;
+       struct ide_host *host;
        int ret;
-       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
-       hw_regs_t hw;
+       hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
 
        ret = ecard_request_resources(ec);
        if (ret)
@@ -44,25 +47,21 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
                goto release;
        }
 
-       hwif = ide_find_port((unsigned long)base);
-       if (hwif) {
-               memset(&hw, 0, sizeof(hw));
-               rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
-               hw.chipset = ide_generic;
-               hw.dev = &ec->dev;
-
-               ide_init_port_hw(hwif, &hw);
-
-               hwif->mmio = 1;
-               default_hwif_mmiops(hwif);
+       memset(&hw, 0, sizeof(hw));
+       rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
+       hw.chipset = ide_generic;
+       hw.dev = &ec->dev;
 
-               idx[0] = hwif->index;
+       host = ide_host_alloc(&rapide_port_info, hws);
+       if (host == NULL) {
+               ret = -ENOENT;
+               goto release;
+       }
 
-               ide_device_add(idx, NULL);
+       ide_host_register(host, &rapide_port_info, hws);
 
-               ecard_set_drvdata(ec, hwif);
-               goto out;
-       }
+       ecard_set_drvdata(ec, host);
+       goto out;
 
  release:
        ecard_release_resources(ec);
@@ -72,11 +71,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
 
 static void __devexit rapide_remove(struct expansion_card *ec)
 {
-       ide_hwif_t *hwif = ecard_get_drvdata(ec);
+       struct ide_host *host = ecard_get_drvdata(ec);
 
        ecard_set_drvdata(ec, NULL);
 
-       ide_unregister(hwif->index);
+       ide_host_remove(host);
 
        ecard_release_resources(ec);
 }