diff options
-rw-r--r-- | drivers/ide/ppc/pmac.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index a1d24cd1293e..313194a0f36e 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -535,7 +535,7 @@ pmac_outbsync(ide_drive_t *drive, u8 value, unsigned long port) | |||
535 | static void | 535 | static void |
536 | pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) | 536 | pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) |
537 | { | 537 | { |
538 | u32 *timings; | 538 | u32 *timings, t; |
539 | unsigned accessTicks, recTicks; | 539 | unsigned accessTicks, recTicks; |
540 | unsigned accessTime, recTime; | 540 | unsigned accessTime, recTime; |
541 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 541 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
@@ -546,6 +546,7 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
546 | 546 | ||
547 | /* which drive is it ? */ | 547 | /* which drive is it ? */ |
548 | timings = &pmif->timings[drive->select.b.unit & 0x01]; | 548 | timings = &pmif->timings[drive->select.b.unit & 0x01]; |
549 | t = *timings; | ||
549 | 550 | ||
550 | cycle_time = ide_pio_cycle_time(drive, pio); | 551 | cycle_time = ide_pio_cycle_time(drive, pio); |
551 | 552 | ||
@@ -553,14 +554,14 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
553 | case controller_sh_ata6: { | 554 | case controller_sh_ata6: { |
554 | /* 133Mhz cell */ | 555 | /* 133Mhz cell */ |
555 | u32 tr = kauai_lookup_timing(shasta_pio_timings, cycle_time); | 556 | u32 tr = kauai_lookup_timing(shasta_pio_timings, cycle_time); |
556 | *timings = ((*timings) & ~TR_133_PIOREG_PIO_MASK) | tr; | 557 | t = (t & ~TR_133_PIOREG_PIO_MASK) | tr; |
557 | break; | 558 | break; |
558 | } | 559 | } |
559 | case controller_un_ata6: | 560 | case controller_un_ata6: |
560 | case controller_k2_ata6: { | 561 | case controller_k2_ata6: { |
561 | /* 100Mhz cell */ | 562 | /* 100Mhz cell */ |
562 | u32 tr = kauai_lookup_timing(kauai_pio_timings, cycle_time); | 563 | u32 tr = kauai_lookup_timing(kauai_pio_timings, cycle_time); |
563 | *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr; | 564 | t = (t & ~TR_100_PIOREG_PIO_MASK) | tr; |
564 | break; | 565 | break; |
565 | } | 566 | } |
566 | case controller_kl_ata4: | 567 | case controller_kl_ata4: |
@@ -574,9 +575,9 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
574 | accessTicks = min(accessTicks, 0x1fU); | 575 | accessTicks = min(accessTicks, 0x1fU); |
575 | recTicks = SYSCLK_TICKS_66(recTime); | 576 | recTicks = SYSCLK_TICKS_66(recTime); |
576 | recTicks = min(recTicks, 0x1fU); | 577 | recTicks = min(recTicks, 0x1fU); |
577 | *timings = ((*timings) & ~TR_66_PIO_MASK) | | 578 | t = (t & ~TR_66_PIO_MASK) | |
578 | (accessTicks << TR_66_PIO_ACCESS_SHIFT) | | 579 | (accessTicks << TR_66_PIO_ACCESS_SHIFT) | |
579 | (recTicks << TR_66_PIO_RECOVERY_SHIFT); | 580 | (recTicks << TR_66_PIO_RECOVERY_SHIFT); |
580 | break; | 581 | break; |
581 | default: { | 582 | default: { |
582 | /* 33Mhz cell */ | 583 | /* 33Mhz cell */ |
@@ -596,11 +597,11 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
596 | recTicks--; /* guess, but it's only for PIO0, so... */ | 597 | recTicks--; /* guess, but it's only for PIO0, so... */ |
597 | ebit = 1; | 598 | ebit = 1; |
598 | } | 599 | } |
599 | *timings = ((*timings) & ~TR_33_PIO_MASK) | | 600 | t = (t & ~TR_33_PIO_MASK) | |
600 | (accessTicks << TR_33_PIO_ACCESS_SHIFT) | | 601 | (accessTicks << TR_33_PIO_ACCESS_SHIFT) | |
601 | (recTicks << TR_33_PIO_RECOVERY_SHIFT); | 602 | (recTicks << TR_33_PIO_RECOVERY_SHIFT); |
602 | if (ebit) | 603 | if (ebit) |
603 | *timings |= TR_33_PIO_E; | 604 | t |= TR_33_PIO_E; |
604 | break; | 605 | break; |
605 | } | 606 | } |
606 | } | 607 | } |
@@ -613,6 +614,7 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
613 | if (ide_config_drive_speed(drive, XFER_PIO_0 + pio)) | 614 | if (ide_config_drive_speed(drive, XFER_PIO_0 + pio)) |
614 | return; | 615 | return; |
615 | 616 | ||
617 | *timings = t; | ||
616 | pmac_ide_do_update_timings(drive); | 618 | pmac_ide_do_update_timings(drive); |
617 | } | 619 | } |
618 | 620 | ||
@@ -1143,6 +1145,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1143 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; | 1145 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; |
1144 | hwif->drives[0].unmask = 1; | 1146 | hwif->drives[0].unmask = 1; |
1145 | hwif->drives[1].unmask = 1; | 1147 | hwif->drives[1].unmask = 1; |
1148 | hwif->drives[0].autotune = IDE_TUNE_AUTO; | ||
1149 | hwif->drives[1].autotune = IDE_TUNE_AUTO; | ||
1146 | hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA; | 1150 | hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA; |
1147 | hwif->pio_mask = ATA_PIO4; | 1151 | hwif->pio_mask = ATA_PIO4; |
1148 | hwif->set_pio_mode = pmac_ide_set_pio_mode; | 1152 | hwif->set_pio_mode = pmac_ide_set_pio_mode; |