]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/sgiioc4.c
ALSA: wm8750: add missing VREF output
[linux-2.6] / drivers / ide / pci / sgiioc4.c
index c79ff5b41088e40d09a124de94785cf1959408c1..42eef19a18f14f7c46611ffb2a7073e8d8cce6d4 100644 (file)
@@ -127,7 +127,7 @@ sgiioc4_checkirq(ide_hwif_t * hwif)
        return 0;
 }
 
-static u8 sgiioc4_INB(unsigned long);
+static u8 sgiioc4_read_status(ide_hwif_t *);
 
 static int
 sgiioc4_clearirq(ide_drive_t * drive)
@@ -141,18 +141,19 @@ sgiioc4_clearirq(ide_drive_t * drive)
        intr_reg = readl((void __iomem *)other_ir);
        if (intr_reg & 0x03) { /* Valid IOC4-IDE interrupt */
                /*
-                * Using sgiioc4_INB to read the Status register has a side
-                * effect of clearing the interrupt.  The first read should
+                * Using sgiioc4_read_status to read the Status register has a
+                * side effect of clearing the interrupt.  The first read should
                 * clear it if it is set.  The second read should return
                 * a "clear" status if it got cleared.  If not, then spin
                 * for a bit trying to clear it.
                 */
-               u8 stat = sgiioc4_INB(io_ports->status_addr);
+               u8 stat = sgiioc4_read_status(hwif);
                int count = 0;
-               stat = sgiioc4_INB(io_ports->status_addr);
+
+               stat = sgiioc4_read_status(hwif);
                while ((stat & 0x80) && (count++ < 100)) {
                        udelay(1);
-                       stat = sgiioc4_INB(io_ports->status_addr);
+                       stat = sgiioc4_read_status(hwif);
                }
 
                if (intr_reg & 0x02) {
@@ -304,9 +305,9 @@ sgiioc4_dma_lost_irq(ide_drive_t * drive)
        ide_dma_lost_irq(drive);
 }
 
-static u8
-sgiioc4_INB(unsigned long port)
+static u8 sgiioc4_read_status(ide_hwif_t *hwif)
 {
+       unsigned long port = hwif->io_ports.status_addr;
        u8 reg = (u8) readb((void __iomem *) port);
 
        if ((port & 0xFFF) == 0x11C) {  /* Status register of IOC4 */
@@ -549,6 +550,21 @@ static int sgiioc4_dma_setup(ide_drive_t *drive)
        return 0;
 }
 
+static const struct ide_tp_ops sgiioc4_tp_ops = {
+       .exec_command           = ide_exec_command,
+       .read_status            = sgiioc4_read_status,
+       .read_altstatus         = ide_read_altstatus,
+       .read_sff_dma_status    = ide_read_sff_dma_status,
+
+       .set_irq                = ide_set_irq,
+
+       .tf_load                = ide_tf_load,
+       .tf_read                = ide_tf_read,
+
+       .input_data             = ide_input_data,
+       .output_data            = ide_output_data,
+};
+
 static const struct ide_port_ops sgiioc4_port_ops = {
        .set_dma_mode           = sgiioc4_set_dma_mode,
        /* reset DMA engine, clear IRQs */
@@ -571,6 +587,7 @@ static const struct ide_port_info sgiioc4_port_info __devinitdata = {
        .name                   = DRV_NAME,
        .chipset                = ide_pci,
        .init_dma               = ide_dma_sgiioc4,
+       .tp_ops                 = &sgiioc4_tp_ops,
        .port_ops               = &sgiioc4_port_ops,
        .dma_ops                = &sgiioc4_dma_ops,
        .host_flags             = IDE_HFLAG_MMIO,
@@ -583,10 +600,10 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
        unsigned long cmd_base, irqport;
        unsigned long bar0, cmd_phys_base, ctl;
        void __iomem *virt_base;
-       ide_hwif_t *hwif;
-       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
-       hw_regs_t hw;
+       struct ide_host *host;
+       hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
        struct ide_port_info d = sgiioc4_port_info;
+       int rc;
 
        /*  Get the CmdBlk and CtrlBlk Base Registers */
        bar0 = pci_resource_start(dev, 0);
@@ -618,30 +635,26 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
        hw.chipset = ide_pci;
        hw.dev = &dev->dev;
 
-       hwif = ide_find_port_slot(&d);
-       if (hwif == NULL)
-               goto err;
-
-       ide_init_port_hw(hwif, &hw);
-
-       /* The IOC4 uses MMIO rather than Port IO. */
-       default_hwif_mmiops(hwif);
-
        /* Initializing chipset IRQ Registers */
        writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
 
-       hwif->INB = &sgiioc4_INB;
-
-       idx[0] = hwif->index;
+       host = ide_host_alloc(&d, hws);
+       if (host == NULL) {
+               rc = -ENOMEM;
+               goto err;
+       }
 
-       if (ide_device_add(idx, &d))
-               return -EIO;
+       rc = ide_host_register(host, &d, hws);
+       if (rc)
+               goto err_free;
 
        return 0;
+err_free:
+       ide_host_free(host);
 err:
        release_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE);
        iounmap(virt_base);
-       return -ENOMEM;
+       return rc;
 }
 
 static unsigned int __devinit