aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/hpt366.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/hpt366.c')
-rw-r--r--drivers/ide/pci/hpt366.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index df45098157f6..e5e64436ffd9 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1327,14 +1327,17 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1327 hwif->dma_lost_irq = &hpt366_dma_lost_irq; 1327 hwif->dma_lost_irq = &hpt366_dma_lost_irq;
1328} 1328}
1329 1329
1330static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) 1330static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
1331 const struct ide_port_info *d)
1331{ 1332{
1332 struct pci_dev *dev = to_pci_dev(hwif->dev); 1333 struct pci_dev *dev = to_pci_dev(hwif->dev);
1333 u8 masterdma = 0, slavedma = 0; 1334 unsigned long flags, base = ide_pci_dma_base(hwif, d);
1334 u8 dma_new = 0, dma_old = 0; 1335 u8 dma_old, dma_new, masterdma = 0, slavedma = 0;
1335 unsigned long flags;
1336 1336
1337 dma_old = inb(dmabase + 2); 1337 if (base == 0 || ide_pci_set_master(dev, d->name) < 0)
1338 return -1;
1339
1340 dma_old = inb(base + 2);
1338 1341
1339 local_irq_save(flags); 1342 local_irq_save(flags);
1340 1343
@@ -1345,9 +1348,21 @@ static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase)
1345 if (masterdma & 0x30) dma_new |= 0x20; 1348 if (masterdma & 0x30) dma_new |= 0x20;
1346 if ( slavedma & 0x30) dma_new |= 0x40; 1349 if ( slavedma & 0x30) dma_new |= 0x40;
1347 if (dma_new != dma_old) 1350 if (dma_new != dma_old)
1348 outb(dma_new, dmabase + 2); 1351 outb(dma_new, base + 2);
1349 1352
1350 local_irq_restore(flags); 1353 local_irq_restore(flags);
1354
1355 printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx\n",
1356 hwif->name, base, base + 7);
1357
1358 hwif->extra_base = base + (hwif->channel ? 8 : 16);
1359
1360 if (ide_allocate_dma_engine(hwif))
1361 return -1;
1362
1363 ide_setup_dma(hwif, base);
1364
1365 return 0;
1351} 1366}
1352 1367
1353static void __devinit hpt374_init(struct pci_dev *dev, struct pci_dev *dev2) 1368static void __devinit hpt374_init(struct pci_dev *dev, struct pci_dev *dev2)