aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/ns87415.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/ns87415.c')
-rw-r--r--drivers/ide/pci/ns87415.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 02fd3a877afa..5cd2b32ff0ef 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -104,7 +104,22 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task)
104 } 104 }
105} 105}
106 106
107static void __devinit superio_ide_init_iops (struct hwif_s *hwif) 107static const struct ide_tp_ops superio_tp_ops = {
108 .exec_command = ide_exec_command,
109 .read_status = superio_read_status,
110 .read_altstatus = ide_read_altstatus,
111 .read_sff_dma_status = superio_read_sff_dma_status,
112
113 .set_irq = ide_set_irq,
114
115 .tf_load = ide_tf_load,
116 .tf_read = superio_tf_read,
117
118 .input_data = ide_input_data,
119 .output_data = ide_output_data,
120};
121
122static void __devinit superio_init_iops(struct hwif_s *hwif)
108{ 123{
109 struct pci_dev *pdev = to_pci_dev(hwif->dev); 124 struct pci_dev *pdev = to_pci_dev(hwif->dev);
110 u32 dma_stat; 125 u32 dma_stat;
@@ -115,21 +130,6 @@ static void __devinit superio_ide_init_iops (struct hwif_s *hwif)
115 /* Clear error/interrupt, enable dma */ 130 /* Clear error/interrupt, enable dma */
116 tmp = superio_ide_inb(dma_stat); 131 tmp = superio_ide_inb(dma_stat);
117 outb(tmp | 0x66, dma_stat); 132 outb(tmp | 0x66, dma_stat);
118
119 hwif->read_status = superio_read_status;
120 hwif->read_sff_dma_status = superio_read_sff_dma_status;
121
122 hwif->tf_read = superio_tf_read;
123
124}
125
126static void __devinit init_iops_ns87415(ide_hwif_t *hwif)
127{
128 struct pci_dev *dev = to_pci_dev(hwif->dev);
129
130 if (PCI_SLOT(dev->devfn) == 0xE)
131 /* Built-in - assume it's under superio. */
132 superio_ide_init_iops(hwif);
133} 133}
134#endif 134#endif
135 135
@@ -195,7 +195,7 @@ static int ns87415_dma_end(ide_drive_t *drive)
195 u8 dma_stat = 0, dma_cmd = 0; 195 u8 dma_stat = 0, dma_cmd = 0;
196 196
197 drive->waiting_for_dma = 0; 197 drive->waiting_for_dma = 0;
198 dma_stat = hwif->read_sff_dma_status(hwif); 198 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif);
199 /* get DMA command mode */ 199 /* get DMA command mode */
200 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); 200 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
201 /* stop DMA */ 201 /* stop DMA */
@@ -271,7 +271,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
271 outb(8, hwif->io_ports.ctl_addr); 271 outb(8, hwif->io_ports.ctl_addr);
272 do { 272 do {
273 udelay(50); 273 udelay(50);
274 stat = hwif->read_status(hwif); 274 stat = hwif->tp_ops->read_status(hwif);
275 if (stat == 0xff) 275 if (stat == 0xff)
276 break; 276 break;
277 } while ((stat & BUSY_STAT) && --timeout); 277 } while ((stat & BUSY_STAT) && --timeout);
@@ -306,9 +306,6 @@ static const struct ide_dma_ops ns87415_dma_ops = {
306 306
307static const struct ide_port_info ns87415_chipset __devinitdata = { 307static const struct ide_port_info ns87415_chipset __devinitdata = {
308 .name = "NS87415", 308 .name = "NS87415",
309#ifdef CONFIG_SUPERIO
310 .init_iops = init_iops_ns87415,
311#endif
312 .init_hwif = init_hwif_ns87415, 309 .init_hwif = init_hwif_ns87415,
313 .port_ops = &ns87415_port_ops, 310 .port_ops = &ns87415_port_ops,
314 .dma_ops = &ns87415_dma_ops, 311 .dma_ops = &ns87415_dma_ops,
@@ -318,7 +315,16 @@ static const struct ide_port_info ns87415_chipset __devinitdata = {
318 315
319static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) 316static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
320{ 317{
321 return ide_setup_pci_device(dev, &ns87415_chipset); 318 struct ide_port_info d = ns87415_chipset;
319
320#ifdef CONFIG_SUPERIO
321 if (PCI_SLOT(dev->devfn) == 0xE) {
322 /* Built-in - assume it's under superio. */
323 d.init_iops = superio_init_iops;
324 d.tp_ops = &superio_tp_ops;
325 }
326#endif
327 return ide_setup_pci_device(dev, &d);
322} 328}
323 329
324static const struct pci_device_id ns87415_pci_tbl[] = { 330static const struct pci_device_id ns87415_pci_tbl[] = {