aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ppc')
-rw-r--r--drivers/ide/ppc/mpc8xx.c5
-rw-r--r--drivers/ide/ppc/pmac.c16
2 files changed, 12 insertions, 9 deletions
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index 82de2d781f2e..8859fe2f5ac2 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -316,6 +316,7 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
316 } 316 }
317 317
318 /* register routine to tune PIO mode */ 318 /* register routine to tune PIO mode */
319 ide_hwifs[data_port].pio_mask = ATA_PIO4;
319 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; 320 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc;
320 321
321 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; 322 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack;
@@ -402,6 +403,7 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
402 } 403 }
403 404
404 /* register routine to tune PIO mode */ 405 /* register routine to tune PIO mode */
406 ide_hwifs[data_port].pio_mask = ATA_PIO4;
405 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; 407 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc;
406 408
407 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; 409 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack;
@@ -431,13 +433,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
431static void 433static void
432m8xx_ide_tuneproc(ide_drive_t *drive, u8 pio) 434m8xx_ide_tuneproc(ide_drive_t *drive, u8 pio)
433{ 435{
434 ide_pio_data_t d;
435#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) 436#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
436 volatile pcmconf8xx_t *pcmp; 437 volatile pcmconf8xx_t *pcmp;
437 ulong timing, mask, reg; 438 ulong timing, mask, reg;
438#endif 439#endif
439 440
440 pio = ide_get_best_pio_mode(drive, pio, 4, &d); 441 pio = ide_get_best_pio_mode(drive, pio, 4);
441 442
442#if 1 443#if 1
443 printk("%s[%d] %s: best PIO mode: %d\n", 444 printk("%s[%d] %s: best PIO mode: %d\n",
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index e46f47206542..33630ad3e794 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -615,24 +615,25 @@ out:
615static void 615static void
616pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) 616pmac_ide_tuneproc(ide_drive_t *drive, u8 pio)
617{ 617{
618 ide_pio_data_t d;
619 u32 *timings; 618 u32 *timings;
620 unsigned accessTicks, recTicks; 619 unsigned accessTicks, recTicks;
621 unsigned accessTime, recTime; 620 unsigned accessTime, recTime;
622 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 621 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
623 622 unsigned int cycle_time;
623
624 if (pmif == NULL) 624 if (pmif == NULL)
625 return; 625 return;
626 626
627 /* which drive is it ? */ 627 /* which drive is it ? */
628 timings = &pmif->timings[drive->select.b.unit & 0x01]; 628 timings = &pmif->timings[drive->select.b.unit & 0x01];
629 629
630 pio = ide_get_best_pio_mode(drive, pio, 4, &d); 630 pio = ide_get_best_pio_mode(drive, pio, 4);
631 cycle_time = ide_pio_cycle_time(drive, pio);
631 632
632 switch (pmif->kind) { 633 switch (pmif->kind) {
633 case controller_sh_ata6: { 634 case controller_sh_ata6: {
634 /* 133Mhz cell */ 635 /* 133Mhz cell */
635 u32 tr = kauai_lookup_timing(shasta_pio_timings, d.cycle_time); 636 u32 tr = kauai_lookup_timing(shasta_pio_timings, cycle_time);
636 if (tr == 0) 637 if (tr == 0)
637 return; 638 return;
638 *timings = ((*timings) & ~TR_133_PIOREG_PIO_MASK) | tr; 639 *timings = ((*timings) & ~TR_133_PIOREG_PIO_MASK) | tr;
@@ -641,7 +642,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio)
641 case controller_un_ata6: 642 case controller_un_ata6:
642 case controller_k2_ata6: { 643 case controller_k2_ata6: {
643 /* 100Mhz cell */ 644 /* 100Mhz cell */
644 u32 tr = kauai_lookup_timing(kauai_pio_timings, d.cycle_time); 645 u32 tr = kauai_lookup_timing(kauai_pio_timings, cycle_time);
645 if (tr == 0) 646 if (tr == 0)
646 return; 647 return;
647 *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr; 648 *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr;
@@ -649,7 +650,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio)
649 } 650 }
650 case controller_kl_ata4: 651 case controller_kl_ata4:
651 /* 66Mhz cell */ 652 /* 66Mhz cell */
652 recTime = d.cycle_time - ide_pio_timings[pio].active_time 653 recTime = cycle_time - ide_pio_timings[pio].active_time
653 - ide_pio_timings[pio].setup_time; 654 - ide_pio_timings[pio].setup_time;
654 recTime = max(recTime, 150U); 655 recTime = max(recTime, 150U);
655 accessTime = ide_pio_timings[pio].active_time; 656 accessTime = ide_pio_timings[pio].active_time;
@@ -665,7 +666,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio)
665 default: { 666 default: {
666 /* 33Mhz cell */ 667 /* 33Mhz cell */
667 int ebit = 0; 668 int ebit = 0;
668 recTime = d.cycle_time - ide_pio_timings[pio].active_time 669 recTime = cycle_time - ide_pio_timings[pio].active_time
669 - ide_pio_timings[pio].setup_time; 670 - ide_pio_timings[pio].setup_time;
670 recTime = max(recTime, 150U); 671 recTime = max(recTime, 150U);
671 accessTime = ide_pio_timings[pio].active_time; 672 accessTime = ide_pio_timings[pio].active_time;
@@ -1247,6 +1248,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1247 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 1248 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
1248 hwif->drives[0].unmask = 1; 1249 hwif->drives[0].unmask = 1;
1249 hwif->drives[1].unmask = 1; 1250 hwif->drives[1].unmask = 1;
1251 hwif->pio_mask = ATA_PIO4;
1250 hwif->tuneproc = pmac_ide_tuneproc; 1252 hwif->tuneproc = pmac_ide_tuneproc;
1251 if (pmif->kind == controller_un_ata6 1253 if (pmif->kind == controller_un_ata6
1252 || pmif->kind == controller_k2_ata6 1254 || pmif->kind == controller_k2_ata6