aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pmac.c')
-rw-r--r--drivers/ide/pmac.c58
1 files changed, 39 insertions, 19 deletions
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index 7aa45ea37eeb..24ce1f805cd7 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -404,8 +404,6 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time)
404#define IDE_WAKEUP_DELAY (1*HZ) 404#define IDE_WAKEUP_DELAY (1*HZ)
405 405
406static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *); 406static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *);
407static void pmac_ide_selectproc(ide_drive_t *drive);
408static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
409 407
410#define PMAC_IDE_REG(x) \ 408#define PMAC_IDE_REG(x) \
411 ((void __iomem *)((drive)->hwif->io_ports.data_addr + (x))) 409 ((void __iomem *)((drive)->hwif->io_ports.data_addr + (x)))
@@ -415,8 +413,7 @@ static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
415 * timing register when selecting that unit. This version is for 413 * timing register when selecting that unit. This version is for
416 * ASICs with a single timing register 414 * ASICs with a single timing register
417 */ 415 */
418static void 416static void pmac_ide_apply_timings(ide_drive_t *drive)
419pmac_ide_selectproc(ide_drive_t *drive)
420{ 417{
421 ide_hwif_t *hwif = drive->hwif; 418 ide_hwif_t *hwif = drive->hwif;
422 pmac_ide_hwif_t *pmif = 419 pmac_ide_hwif_t *pmif =
@@ -434,8 +431,7 @@ pmac_ide_selectproc(ide_drive_t *drive)
434 * timing register when selecting that unit. This version is for 431 * timing register when selecting that unit. This version is for
435 * ASICs with a dual timing register (Kauai) 432 * ASICs with a dual timing register (Kauai)
436 */ 433 */
437static void 434static void pmac_ide_kauai_apply_timings(ide_drive_t *drive)
438pmac_ide_kauai_selectproc(ide_drive_t *drive)
439{ 435{
440 ide_hwif_t *hwif = drive->hwif; 436 ide_hwif_t *hwif = drive->hwif;
441 pmac_ide_hwif_t *pmif = 437 pmac_ide_hwif_t *pmif =
@@ -464,9 +460,25 @@ pmac_ide_do_update_timings(ide_drive_t *drive)
464 if (pmif->kind == controller_sh_ata6 || 460 if (pmif->kind == controller_sh_ata6 ||
465 pmif->kind == controller_un_ata6 || 461 pmif->kind == controller_un_ata6 ||
466 pmif->kind == controller_k2_ata6) 462 pmif->kind == controller_k2_ata6)
467 pmac_ide_kauai_selectproc(drive); 463 pmac_ide_kauai_apply_timings(drive);
468 else 464 else
469 pmac_ide_selectproc(drive); 465 pmac_ide_apply_timings(drive);
466}
467
468static void pmac_dev_select(ide_drive_t *drive)
469{
470 pmac_ide_apply_timings(drive);
471
472 writeb(drive->select | ATA_DEVICE_OBS,
473 (void __iomem *)drive->hwif->io_ports.device_addr);
474}
475
476static void pmac_kauai_dev_select(ide_drive_t *drive)
477{
478 pmac_ide_kauai_apply_timings(drive);
479
480 writeb(drive->select | ATA_DEVICE_OBS,
481 (void __iomem *)drive->hwif->io_ports.device_addr);
470} 482}
471 483
472static void pmac_exec_command(ide_hwif_t *hwif, u8 cmd) 484static void pmac_exec_command(ide_hwif_t *hwif, u8 cmd)
@@ -947,6 +959,7 @@ static const struct ide_tp_ops pmac_tp_ops = {
947 .read_altstatus = ide_read_altstatus, 959 .read_altstatus = ide_read_altstatus,
948 .write_devctl = pmac_write_devctl, 960 .write_devctl = pmac_write_devctl,
949 961
962 .dev_select = pmac_dev_select,
950 .tf_load = ide_tf_load, 963 .tf_load = ide_tf_load,
951 .tf_read = ide_tf_read, 964 .tf_read = ide_tf_read,
952 965
@@ -954,19 +967,24 @@ static const struct ide_tp_ops pmac_tp_ops = {
954 .output_data = ide_output_data, 967 .output_data = ide_output_data,
955}; 968};
956 969
957static const struct ide_port_ops pmac_ide_ata6_port_ops = { 970static const struct ide_tp_ops pmac_ata6_tp_ops = {
958 .init_dev = pmac_ide_init_dev, 971 .exec_command = pmac_exec_command,
959 .set_pio_mode = pmac_ide_set_pio_mode, 972 .read_status = ide_read_status,
960 .set_dma_mode = pmac_ide_set_dma_mode, 973 .read_altstatus = ide_read_altstatus,
961 .selectproc = pmac_ide_kauai_selectproc, 974 .write_devctl = pmac_write_devctl,
962 .cable_detect = pmac_ide_cable_detect, 975
976 .dev_select = pmac_kauai_dev_select,
977 .tf_load = ide_tf_load,
978 .tf_read = ide_tf_read,
979
980 .input_data = ide_input_data,
981 .output_data = ide_output_data,
963}; 982};
964 983
965static const struct ide_port_ops pmac_ide_ata4_port_ops = { 984static const struct ide_port_ops pmac_ide_ata4_port_ops = {
966 .init_dev = pmac_ide_init_dev, 985 .init_dev = pmac_ide_init_dev,
967 .set_pio_mode = pmac_ide_set_pio_mode, 986 .set_pio_mode = pmac_ide_set_pio_mode,
968 .set_dma_mode = pmac_ide_set_dma_mode, 987 .set_dma_mode = pmac_ide_set_dma_mode,
969 .selectproc = pmac_ide_selectproc,
970 .cable_detect = pmac_ide_cable_detect, 988 .cable_detect = pmac_ide_cable_detect,
971}; 989};
972 990
@@ -974,7 +992,6 @@ static const struct ide_port_ops pmac_ide_port_ops = {
974 .init_dev = pmac_ide_init_dev, 992 .init_dev = pmac_ide_init_dev,
975 .set_pio_mode = pmac_ide_set_pio_mode, 993 .set_pio_mode = pmac_ide_set_pio_mode,
976 .set_dma_mode = pmac_ide_set_dma_mode, 994 .set_dma_mode = pmac_ide_set_dma_mode,
977 .selectproc = pmac_ide_selectproc,
978}; 995};
979 996
980static const struct ide_dma_ops pmac_dma_ops; 997static const struct ide_dma_ops pmac_dma_ops;
@@ -1011,15 +1028,18 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw)
1011 pmif->broken_dma = pmif->broken_dma_warn = 0; 1028 pmif->broken_dma = pmif->broken_dma_warn = 0;
1012 if (of_device_is_compatible(np, "shasta-ata")) { 1029 if (of_device_is_compatible(np, "shasta-ata")) {
1013 pmif->kind = controller_sh_ata6; 1030 pmif->kind = controller_sh_ata6;
1014 d.port_ops = &pmac_ide_ata6_port_ops; 1031 d.tp_ops = &pmac_ata6_tp_ops;
1032 d.port_ops = &pmac_ide_ata4_port_ops;
1015 d.udma_mask = ATA_UDMA6; 1033 d.udma_mask = ATA_UDMA6;
1016 } else if (of_device_is_compatible(np, "kauai-ata")) { 1034 } else if (of_device_is_compatible(np, "kauai-ata")) {
1017 pmif->kind = controller_un_ata6; 1035 pmif->kind = controller_un_ata6;
1018 d.port_ops = &pmac_ide_ata6_port_ops; 1036 d.tp_ops = &pmac_ata6_tp_ops;
1037 d.port_ops = &pmac_ide_ata4_port_ops;
1019 d.udma_mask = ATA_UDMA5; 1038 d.udma_mask = ATA_UDMA5;
1020 } else if (of_device_is_compatible(np, "K2-UATA")) { 1039 } else if (of_device_is_compatible(np, "K2-UATA")) {
1021 pmif->kind = controller_k2_ata6; 1040 pmif->kind = controller_k2_ata6;
1022 d.port_ops = &pmac_ide_ata6_port_ops; 1041 d.tp_ops = &pmac_ata6_tp_ops;
1042 d.port_ops = &pmac_ide_ata4_port_ops;
1023 d.udma_mask = ATA_UDMA5; 1043 d.udma_mask = ATA_UDMA5;
1024 } else if (of_device_is_compatible(np, "keylargo-ata")) { 1044 } else if (of_device_is_compatible(np, "keylargo-ata")) {
1025 if (strcmp(np->name, "ata-4") == 0) { 1045 if (strcmp(np->name, "ata-4") == 0) {