aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc/pmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ppc/pmac.c')
-rw-r--r--drivers/ide/ppc/pmac.c80
1 files changed, 3 insertions, 77 deletions
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index c68e2472345a..24f73291c4d5 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -530,81 +530,6 @@ pmac_outbsync(ide_drive_t *drive, u8 value, unsigned long port)
530} 530}
531 531
532/* 532/*
533 * Send the SET_FEATURE IDE command to the drive and update drive->id with
534 * the new state. We currently don't use the generic routine as it used to
535 * cause various trouble, especially with older mediabays.
536 * This code is sometimes triggering a spurrious interrupt though, I need
537 * to sort that out sooner or later and see if I can finally get the
538 * common version to work properly in all cases
539 */
540static int
541pmac_ide_do_setfeature(ide_drive_t *drive, u8 command)
542{
543 ide_hwif_t *hwif = HWIF(drive);
544 int result;
545 u8 stat;
546
547 disable_irq_nosync(hwif->irq);
548 udelay(1);
549 SELECT_DRIVE(drive);
550 SELECT_MASK(drive, 0);
551 udelay(1);
552 hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
553 hwif->OUTB(command, IDE_NSECTOR_REG);
554 hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
555 hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
556 result = __ide_wait_stat(drive, drive->ready_stat,
557 BUSY_STAT|DRQ_STAT|ERR_STAT,
558 WAIT_CMD, &stat);
559 if (result)
560 printk(KERN_ERR "%s: pmac_ide_do_setfeature disk not ready "
561 "after SET_FEATURE !\n", drive->name);
562
563 SELECT_MASK(drive, 0);
564 if (result == 0) {
565 drive->id->dma_ultra &= ~0xFF00;
566 drive->id->dma_mword &= ~0x0F00;
567 drive->id->dma_1word &= ~0x0F00;
568 switch(command) {
569 case XFER_UDMA_7:
570 drive->id->dma_ultra |= 0x8080; break;
571 case XFER_UDMA_6:
572 drive->id->dma_ultra |= 0x4040; break;
573 case XFER_UDMA_5:
574 drive->id->dma_ultra |= 0x2020; break;
575 case XFER_UDMA_4:
576 drive->id->dma_ultra |= 0x1010; break;
577 case XFER_UDMA_3:
578 drive->id->dma_ultra |= 0x0808; break;
579 case XFER_UDMA_2:
580 drive->id->dma_ultra |= 0x0404; break;
581 case XFER_UDMA_1:
582 drive->id->dma_ultra |= 0x0202; break;
583 case XFER_UDMA_0:
584 drive->id->dma_ultra |= 0x0101; break;
585 case XFER_MW_DMA_2:
586 drive->id->dma_mword |= 0x0404; break;
587 case XFER_MW_DMA_1:
588 drive->id->dma_mword |= 0x0202; break;
589 case XFER_MW_DMA_0:
590 drive->id->dma_mword |= 0x0101; break;
591 case XFER_SW_DMA_2:
592 drive->id->dma_1word |= 0x0404; break;
593 case XFER_SW_DMA_1:
594 drive->id->dma_1word |= 0x0202; break;
595 case XFER_SW_DMA_0:
596 drive->id->dma_1word |= 0x0101; break;
597 default: break;
598 }
599 if (!drive->init_speed)
600 drive->init_speed = command;
601 drive->current_speed = command;
602 }
603 enable_irq(hwif->irq);
604 return result;
605}
606
607/*
608 * Old tuning functions (called on hdparm -p), sets up drive PIO timings 533 * Old tuning functions (called on hdparm -p), sets up drive PIO timings
609 */ 534 */
610static void 535static void
@@ -685,7 +610,7 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
685 drive->name, pio, *timings); 610 drive->name, pio, *timings);
686#endif 611#endif
687 612
688 if (pmac_ide_do_setfeature(drive, XFER_PIO_0 + pio)) 613 if (ide_config_drive_speed(drive, XFER_PIO_0 + pio))
689 return; 614 return;
690 615
691 pmac_ide_do_update_timings(drive); 616 pmac_ide_do_update_timings(drive);
@@ -948,7 +873,7 @@ static int pmac_ide_tune_chipset(ide_drive_t *drive, const u8 speed)
948 if (ret) 873 if (ret)
949 return ret; 874 return ret;
950 875
951 ret = pmac_ide_do_setfeature(drive, speed); 876 ret = ide_config_drive_speed(drive, speed);
952 if (ret) 877 if (ret)
953 return ret; 878 return ret;
954 879
@@ -1218,6 +1143,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1218 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 1143 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
1219 hwif->drives[0].unmask = 1; 1144 hwif->drives[0].unmask = 1;
1220 hwif->drives[1].unmask = 1; 1145 hwif->drives[1].unmask = 1;
1146 hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA;
1221 hwif->pio_mask = ATA_PIO4; 1147 hwif->pio_mask = ATA_PIO4;
1222 hwif->set_pio_mode = pmac_ide_set_pio_mode; 1148 hwif->set_pio_mode = pmac_ide_set_pio_mode;
1223 if (pmif->kind == controller_un_ata6 1149 if (pmif->kind == controller_un_ata6