aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/scc_pata.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/scc_pata.c')
-rw-r--r--drivers/ide/scc_pata.c56
1 files changed, 15 insertions, 41 deletions
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 0cc137cfe76..6d8dbd9c10b 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -148,17 +148,8 @@ static u8 scc_dma_sff_read_status(ide_hwif_t *hwif)
148 return (u8)in_be32((void *)(hwif->dma_base + 4)); 148 return (u8)in_be32((void *)(hwif->dma_base + 4));
149} 149}
150 150
151static void scc_set_irq(ide_hwif_t *hwif, int on) 151static void scc_write_devctl(ide_hwif_t *hwif, u8 ctl)
152{ 152{
153 u8 ctl = ATA_DEVCTL_OBS;
154
155 if (on == 4) { /* hack for SRST */
156 ctl |= 4;
157 on &= ~4;
158 }
159
160 ctl |= on ? 0 : 2;
161
162 out_be32((void *)hwif->io_ports.ctl_addr, ctl); 153 out_be32((void *)hwif->io_ports.ctl_addr, ctl);
163 eieio(); 154 eieio();
164 in_be32((void *)(hwif->dma_base + 0x01c)); 155 in_be32((void *)(hwif->dma_base + 0x01c));
@@ -321,10 +312,8 @@ static int scc_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
321 u8 dma_stat; 312 u8 dma_stat;
322 313
323 /* fall back to pio! */ 314 /* fall back to pio! */
324 if (ide_build_dmatable(drive, cmd) == 0) { 315 if (ide_build_dmatable(drive, cmd) == 0)
325 ide_map_sg(drive, cmd);
326 return 1; 316 return 1;
327 }
328 317
329 /* PRD table */ 318 /* PRD table */
330 out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma); 319 out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma);
@@ -337,7 +326,7 @@ static int scc_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
337 326
338 /* clear INTR & ERROR flags */ 327 /* clear INTR & ERROR flags */
339 out_be32((void __iomem *)(hwif->dma_base + 4), dma_stat | 6); 328 out_be32((void __iomem *)(hwif->dma_base + 4), dma_stat | 6);
340 drive->waiting_for_dma = 1; 329
341 return 0; 330 return 0;
342} 331}
343 332
@@ -356,7 +345,6 @@ static int __scc_dma_end(ide_drive_t *drive)
356 ide_hwif_t *hwif = drive->hwif; 345 ide_hwif_t *hwif = drive->hwif;
357 u8 dma_stat, dma_cmd; 346 u8 dma_stat, dma_cmd;
358 347
359 drive->waiting_for_dma = 0;
360 /* get DMA command mode */ 348 /* get DMA command mode */
361 dma_cmd = scc_ide_inb(hwif->dma_base); 349 dma_cmd = scc_ide_inb(hwif->dma_base);
362 /* stop DMA */ 350 /* stop DMA */
@@ -365,8 +353,6 @@ static int __scc_dma_end(ide_drive_t *drive)
365 dma_stat = scc_dma_sff_read_status(hwif); 353 dma_stat = scc_dma_sff_read_status(hwif);
366 /* clear the INTR & ERROR bits */ 354 /* clear the INTR & ERROR bits */
367 scc_ide_outb(dma_stat | 6, hwif->dma_base + 4); 355 scc_ide_outb(dma_stat | 6, hwif->dma_base + 4);
368 /* purge DMA mappings */
369 ide_destroy_dmatable(drive);
370 /* verify good DMA status */ 356 /* verify good DMA status */
371 wmb(); 357 wmb();
372 return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; 358 return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;
@@ -670,10 +656,6 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
670 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 656 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
671 HIHI = 0xFF; 657 HIHI = 0xFF;
672 658
673 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA)
674 out_be32((void *)io_ports->data_addr,
675 (tf->hob_data << 8) | tf->data);
676
677 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 659 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
678 scc_ide_outb(tf->hob_feature, io_ports->feature_addr); 660 scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
679 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 661 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -706,18 +688,11 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
706 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 688 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
707 struct ide_taskfile *tf = &cmd->tf; 689 struct ide_taskfile *tf = &cmd->tf;
708 690
709 if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
710 u16 data = (u16)in_be32((void *)io_ports->data_addr);
711
712 tf->data = data & 0xff;
713 tf->hob_data = (data >> 8) & 0xff;
714 }
715
716 /* be sure we're looking at the low order bits */ 691 /* be sure we're looking at the low order bits */
717 scc_ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); 692 scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
718 693
719 if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) 694 if (cmd->tf_flags & IDE_TFLAG_IN_ERROR)
720 tf->feature = scc_ide_inb(io_ports->feature_addr); 695 tf->error = scc_ide_inb(io_ports->feature_addr);
721 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) 696 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT)
722 tf->nsect = scc_ide_inb(io_ports->nsect_addr); 697 tf->nsect = scc_ide_inb(io_ports->nsect_addr);
723 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) 698 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL)
@@ -730,18 +705,18 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
730 tf->device = scc_ide_inb(io_ports->device_addr); 705 tf->device = scc_ide_inb(io_ports->device_addr);
731 706
732 if (cmd->tf_flags & IDE_TFLAG_LBA48) { 707 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
733 scc_ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); 708 scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
734 709
735 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 710 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR)
736 tf->hob_feature = scc_ide_inb(io_ports->feature_addr); 711 tf->hob_error = scc_ide_inb(io_ports->feature_addr);
737 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 712 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
738 tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr); 713 tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr);
739 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 714 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
740 tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr); 715 tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr);
741 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 716 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
742 tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr); 717 tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr);
743 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 718 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
744 tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr); 719 tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr);
745 } 720 }
746} 721}
747 722
@@ -848,9 +823,9 @@ static const struct ide_tp_ops scc_tp_ops = {
848 .exec_command = scc_exec_command, 823 .exec_command = scc_exec_command,
849 .read_status = scc_read_status, 824 .read_status = scc_read_status,
850 .read_altstatus = scc_read_altstatus, 825 .read_altstatus = scc_read_altstatus,
826 .write_devctl = scc_write_devctl,
851 827
852 .set_irq = scc_set_irq, 828 .dev_select = ide_dev_select,
853
854 .tf_load = scc_tf_load, 829 .tf_load = scc_tf_load,
855 .tf_read = scc_tf_read, 830 .tf_read = scc_tf_read,
856 831
@@ -872,7 +847,6 @@ static const struct ide_dma_ops scc_dma_ops = {
872 .dma_end = scc_dma_end, 847 .dma_end = scc_dma_end,
873 .dma_test_irq = scc_dma_test_irq, 848 .dma_test_irq = scc_dma_test_irq,
874 .dma_lost_irq = ide_dma_lost_irq, 849 .dma_lost_irq = ide_dma_lost_irq,
875 .dma_timeout = ide_dma_timeout,
876 .dma_timer_expiry = ide_dma_sff_timer_expiry, 850 .dma_timer_expiry = ide_dma_sff_timer_expiry,
877 .dma_sff_read_status = scc_dma_sff_read_status, 851 .dma_sff_read_status = scc_dma_sff_read_status,
878}; 852};