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.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index e5e64436ffd9..5030bda1adeb 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -808,7 +808,7 @@ static void hpt370_irq_timeout(ide_drive_t *drive)
808 hpt370_clear_engine(drive); 808 hpt370_clear_engine(drive);
809} 809}
810 810
811static void hpt370_ide_dma_start(ide_drive_t *drive) 811static void hpt370_dma_start(ide_drive_t *drive)
812{ 812{
813#ifdef HPT_RESET_STATE_ENGINE 813#ifdef HPT_RESET_STATE_ENGINE
814 hpt370_clear_engine(drive); 814 hpt370_clear_engine(drive);
@@ -816,7 +816,7 @@ static void hpt370_ide_dma_start(ide_drive_t *drive)
816 ide_dma_start(drive); 816 ide_dma_start(drive);
817} 817}
818 818
819static int hpt370_ide_dma_end(ide_drive_t *drive) 819static int hpt370_dma_end(ide_drive_t *drive)
820{ 820{
821 ide_hwif_t *hwif = HWIF(drive); 821 ide_hwif_t *hwif = HWIF(drive);
822 u8 dma_stat = inb(hwif->dma_status); 822 u8 dma_stat = inb(hwif->dma_status);
@@ -838,7 +838,7 @@ static void hpt370_dma_timeout(ide_drive_t *drive)
838} 838}
839 839
840/* returns 1 if DMA IRQ issued, 0 otherwise */ 840/* returns 1 if DMA IRQ issued, 0 otherwise */
841static int hpt374_ide_dma_test_irq(ide_drive_t *drive) 841static int hpt374_dma_test_irq(ide_drive_t *drive)
842{ 842{
843 ide_hwif_t *hwif = HWIF(drive); 843 ide_hwif_t *hwif = HWIF(drive);
844 struct pci_dev *dev = to_pci_dev(hwif->dev); 844 struct pci_dev *dev = to_pci_dev(hwif->dev);
@@ -862,7 +862,7 @@ static int hpt374_ide_dma_test_irq(ide_drive_t *drive)
862 return 0; 862 return 0;
863} 863}
864 864
865static int hpt374_ide_dma_end(ide_drive_t *drive) 865static int hpt374_dma_end(ide_drive_t *drive)
866{ 866{
867 ide_hwif_t *hwif = HWIF(drive); 867 ide_hwif_t *hwif = HWIF(drive);
868 struct pci_dev *dev = to_pci_dev(hwif->dev); 868 struct pci_dev *dev = to_pci_dev(hwif->dev);
@@ -1312,19 +1312,6 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1312 1312
1313 if (new_mcr != old_mcr) 1313 if (new_mcr != old_mcr)
1314 pci_write_config_byte(dev, hwif->select_data + 1, new_mcr); 1314 pci_write_config_byte(dev, hwif->select_data + 1, new_mcr);
1315
1316 if (hwif->dma_base == 0)
1317 return;
1318
1319 if (chip_type >= HPT374) {
1320 hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq;
1321 hwif->ide_dma_end = &hpt374_ide_dma_end;
1322 } else if (chip_type >= HPT370) {
1323 hwif->dma_start = &hpt370_ide_dma_start;
1324 hwif->ide_dma_end = &hpt370_ide_dma_end;
1325 hwif->dma_timeout = &hpt370_dma_timeout;
1326 } else
1327 hwif->dma_lost_irq = &hpt366_dma_lost_irq;
1328} 1315}
1329 1316
1330static int __devinit init_dma_hpt366(ide_hwif_t *hwif, 1317static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
@@ -1360,7 +1347,7 @@ static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
1360 if (ide_allocate_dma_engine(hwif)) 1347 if (ide_allocate_dma_engine(hwif))
1361 return -1; 1348 return -1;
1362 1349
1363 ide_setup_dma(hwif, base); 1350 ide_setup_dma(hwif, base, d);
1364 1351
1365 return 0; 1352 return 0;
1366} 1353}
@@ -1428,6 +1415,21 @@ static const struct ide_port_ops hpt3xx_port_ops = {
1428 .cable_detect = hpt3xx_cable_detect, 1415 .cable_detect = hpt3xx_cable_detect,
1429}; 1416};
1430 1417
1418static struct ide_dma_ops hpt37x_dma_ops = {
1419 .dma_end = hpt374_dma_end,
1420 .dma_test_irq = hpt374_dma_test_irq,
1421};
1422
1423static struct ide_dma_ops hpt370_dma_ops = {
1424 .dma_start = hpt370_dma_start,
1425 .dma_end = hpt370_dma_end,
1426 .dma_timeout = hpt370_dma_timeout,
1427};
1428
1429static struct ide_dma_ops hpt36x_dma_ops = {
1430 .dma_lost_irq = hpt366_dma_lost_irq,
1431};
1432
1431static const struct ide_port_info hpt366_chipsets[] __devinitdata = { 1433static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1432 { /* 0 */ 1434 { /* 0 */
1433 .name = "HPT36x", 1435 .name = "HPT36x",
@@ -1442,6 +1444,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1442 */ 1444 */
1443 .enablebits = {{0x50,0x10,0x10}, {0x54,0x04,0x04}}, 1445 .enablebits = {{0x50,0x10,0x10}, {0x54,0x04,0x04}},
1444 .port_ops = &hpt3xx_port_ops, 1446 .port_ops = &hpt3xx_port_ops,
1447 .dma_ops = &hpt36x_dma_ops,
1445 .host_flags = IDE_HFLAGS_HPT3XX | IDE_HFLAG_SINGLE, 1448 .host_flags = IDE_HFLAGS_HPT3XX | IDE_HFLAG_SINGLE,
1446 .pio_mask = ATA_PIO4, 1449 .pio_mask = ATA_PIO4,
1447 .mwdma_mask = ATA_MWDMA2, 1450 .mwdma_mask = ATA_MWDMA2,
@@ -1452,6 +1455,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1452 .init_dma = init_dma_hpt366, 1455 .init_dma = init_dma_hpt366,
1453 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1456 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1454 .port_ops = &hpt3xx_port_ops, 1457 .port_ops = &hpt3xx_port_ops,
1458 .dma_ops = &hpt37x_dma_ops,
1455 .host_flags = IDE_HFLAGS_HPT3XX, 1459 .host_flags = IDE_HFLAGS_HPT3XX,
1456 .pio_mask = ATA_PIO4, 1460 .pio_mask = ATA_PIO4,
1457 .mwdma_mask = ATA_MWDMA2, 1461 .mwdma_mask = ATA_MWDMA2,
@@ -1462,6 +1466,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1462 .init_dma = init_dma_hpt366, 1466 .init_dma = init_dma_hpt366,
1463 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1467 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1464 .port_ops = &hpt3xx_port_ops, 1468 .port_ops = &hpt3xx_port_ops,
1469 .dma_ops = &hpt37x_dma_ops,
1465 .host_flags = IDE_HFLAGS_HPT3XX, 1470 .host_flags = IDE_HFLAGS_HPT3XX,
1466 .pio_mask = ATA_PIO4, 1471 .pio_mask = ATA_PIO4,
1467 .mwdma_mask = ATA_MWDMA2, 1472 .mwdma_mask = ATA_MWDMA2,
@@ -1472,6 +1477,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1472 .init_dma = init_dma_hpt366, 1477 .init_dma = init_dma_hpt366,
1473 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1478 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1474 .port_ops = &hpt3xx_port_ops, 1479 .port_ops = &hpt3xx_port_ops,
1480 .dma_ops = &hpt37x_dma_ops,
1475 .host_flags = IDE_HFLAGS_HPT3XX, 1481 .host_flags = IDE_HFLAGS_HPT3XX,
1476 .pio_mask = ATA_PIO4, 1482 .pio_mask = ATA_PIO4,
1477 .mwdma_mask = ATA_MWDMA2, 1483 .mwdma_mask = ATA_MWDMA2,
@@ -1483,6 +1489,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1483 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1489 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1484 .udma_mask = ATA_UDMA5, 1490 .udma_mask = ATA_UDMA5,
1485 .port_ops = &hpt3xx_port_ops, 1491 .port_ops = &hpt3xx_port_ops,
1492 .dma_ops = &hpt37x_dma_ops,
1486 .host_flags = IDE_HFLAGS_HPT3XX, 1493 .host_flags = IDE_HFLAGS_HPT3XX,
1487 .pio_mask = ATA_PIO4, 1494 .pio_mask = ATA_PIO4,
1488 .mwdma_mask = ATA_MWDMA2, 1495 .mwdma_mask = ATA_MWDMA2,
@@ -1493,6 +1500,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1493 .init_dma = init_dma_hpt366, 1500 .init_dma = init_dma_hpt366,
1494 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1501 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1495 .port_ops = &hpt3xx_port_ops, 1502 .port_ops = &hpt3xx_port_ops,
1503 .dma_ops = &hpt37x_dma_ops,
1496 .host_flags = IDE_HFLAGS_HPT3XX, 1504 .host_flags = IDE_HFLAGS_HPT3XX,
1497 .pio_mask = ATA_PIO4, 1505 .pio_mask = ATA_PIO4,
1498 .mwdma_mask = ATA_MWDMA2, 1506 .mwdma_mask = ATA_MWDMA2,
@@ -1555,6 +1563,10 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1555 d.name = info->chip_name; 1563 d.name = info->chip_name;
1556 d.udma_mask = info->udma_mask; 1564 d.udma_mask = info->udma_mask;
1557 1565
1566 /* fixup ->dma_ops for HPT370/HPT370A */
1567 if (info == &hpt370 || info == &hpt370a)
1568 d.dma_ops = &hpt370_dma_ops;
1569
1558 pci_set_drvdata(dev, (void *)info); 1570 pci_set_drvdata(dev, (void *)info);
1559 1571
1560 if (info == &hpt36x || info == &hpt374) 1572 if (info == &hpt36x || info == &hpt374)