aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/scc_pata.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/scc_pata.c')
-rw-r--r--drivers/ide/pci/scc_pata.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index e92a874b31d..9ce1d805992 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -291,7 +291,7 @@ static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed)
291static void scc_dma_host_set(ide_drive_t *drive, int on) 291static void scc_dma_host_set(ide_drive_t *drive, int on)
292{ 292{
293 ide_hwif_t *hwif = drive->hwif; 293 ide_hwif_t *hwif = drive->hwif;
294 u8 unit = (drive->select.b.unit & 0x01); 294 u8 unit = drive->dn & 1;
295 u8 dma_stat = scc_ide_inb(hwif->dma_base + 4); 295 u8 dma_stat = scc_ide_inb(hwif->dma_base + 4);
296 296
297 if (on) 297 if (on)
@@ -353,7 +353,6 @@ static void scc_dma_start(ide_drive_t *drive)
353 353
354 /* start DMA */ 354 /* start DMA */
355 scc_ide_outb(dma_cmd | 1, hwif->dma_base); 355 scc_ide_outb(dma_cmd | 1, hwif->dma_base);
356 hwif->dma = 1;
357 wmb(); 356 wmb();
358} 357}
359 358
@@ -374,7 +373,6 @@ static int __scc_dma_end(ide_drive_t *drive)
374 /* purge DMA mappings */ 373 /* purge DMA mappings */
375 ide_destroy_dmatable(drive); 374 ide_destroy_dmatable(drive);
376 /* verify good DMA status */ 375 /* verify good DMA status */
377 hwif->dma = 0;
378 wmb(); 376 wmb();
379 return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; 377 return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;
380} 378}
@@ -511,9 +509,6 @@ static int scc_dma_test_irq(ide_drive_t *drive)
511 if (int_stat & INTSTS_IOIRQS) 509 if (int_stat & INTSTS_IOIRQS)
512 return 1; 510 return 1;
513 511
514 if (!drive->waiting_for_dma)
515 printk(KERN_WARNING "%s: (%s) called while not waiting\n",
516 drive->name, __func__);
517 return 0; 512 return 0;
518} 513}
519 514
@@ -710,7 +705,7 @@ static void scc_tf_load(ide_drive_t *drive, ide_task_t *task)
710 scc_ide_outb(tf->lbah, io_ports->lbah_addr); 705 scc_ide_outb(tf->lbah, io_ports->lbah_addr);
711 706
712 if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) 707 if (task->tf_flags & IDE_TFLAG_OUT_DEVICE)
713 scc_ide_outb((tf->device & HIHI) | drive->select.all, 708 scc_ide_outb((tf->device & HIHI) | drive->select,
714 io_ports->device_addr); 709 io_ports->device_addr);
715} 710}
716 711
@@ -826,6 +821,12 @@ static void __devinit init_iops_scc(ide_hwif_t *hwif)
826 init_mmio_iops_scc(hwif); 821 init_mmio_iops_scc(hwif);
827} 822}
828 823
824static int __devinit scc_init_dma(ide_hwif_t *hwif,
825 const struct ide_port_info *d)
826{
827 return ide_allocate_dma_engine(hwif);
828}
829
829static u8 scc_cable_detect(ide_hwif_t *hwif) 830static u8 scc_cable_detect(ide_hwif_t *hwif)
830{ 831{
831 return ATA_CBL_PATA80; 832 return ATA_CBL_PATA80;
@@ -890,6 +891,7 @@ static const struct ide_dma_ops scc_dma_ops = {
890 { \ 891 { \
891 .name = name_str, \ 892 .name = name_str, \
892 .init_iops = init_iops_scc, \ 893 .init_iops = init_iops_scc, \
894 .init_dma = scc_init_dma, \
893 .init_hwif = init_hwif_scc, \ 895 .init_hwif = init_hwif_scc, \
894 .tp_ops = &scc_tp_ops, \ 896 .tp_ops = &scc_tp_ops, \
895 .port_ops = &scc_port_ops, \ 897 .port_ops = &scc_port_ops, \
@@ -927,13 +929,6 @@ static void __devexit scc_remove(struct pci_dev *dev)
927{ 929{
928 struct scc_ports *ports = pci_get_drvdata(dev); 930 struct scc_ports *ports = pci_get_drvdata(dev);
929 struct ide_host *host = ports->host; 931 struct ide_host *host = ports->host;
930 ide_hwif_t *hwif = host->ports[0];
931
932 if (hwif->dmatable_cpu) {
933 pci_free_consistent(dev, PRD_ENTRIES * PRD_BYTES,
934 hwif->dmatable_cpu, hwif->dmatable_dma);
935 hwif->dmatable_cpu = NULL;
936 }
937 932
938 ide_host_remove(host); 933 ide_host_remove(host);
939 934
@@ -949,7 +944,7 @@ static const struct pci_device_id scc_pci_tbl[] = {
949}; 944};
950MODULE_DEVICE_TABLE(pci, scc_pci_tbl); 945MODULE_DEVICE_TABLE(pci, scc_pci_tbl);
951 946
952static struct pci_driver driver = { 947static struct pci_driver scc_pci_driver = {
953 .name = "SCC IDE", 948 .name = "SCC IDE",
954 .id_table = scc_pci_tbl, 949 .id_table = scc_pci_tbl,
955 .probe = scc_init_one, 950 .probe = scc_init_one,
@@ -958,14 +953,14 @@ static struct pci_driver driver = {
958 953
959static int scc_ide_init(void) 954static int scc_ide_init(void)
960{ 955{
961 return ide_pci_register_driver(&driver); 956 return ide_pci_register_driver(&scc_pci_driver);
962} 957}
963 958
964module_init(scc_ide_init); 959module_init(scc_ide_init);
965/* -- No exit code? 960/* -- No exit code?
966static void scc_ide_exit(void) 961static void scc_ide_exit(void)
967{ 962{
968 ide_pci_unregister_driver(&driver); 963 ide_pci_unregister_driver(&scc_pci_driver);
969} 964}
970module_exit(scc_ide_exit); 965module_exit(scc_ide_exit);
971 */ 966 */