diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2009-03-31 14:15:32 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-31 14:15:32 -0400 |
commit | abb596b25edac1ec1acc4ef53df190771661c3d2 (patch) | |
tree | d20ea24960358ce03e0f27eefd2e6911afd1309c /drivers/ide/pmac.c | |
parent | 0f861e8c47ede537a8ad280c61d5d00d541f04db (diff) |
ide: turn selectproc() method into dev_select() method (take 5)
Turn selectproc() method into dev_select() method by teaching it to write to the
device register and moving it from 'struct ide_port_ops' to 'struct ide_tp_ops'.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: benh@kernel.crashing.org
Cc: petkovbb@gmail.com
[bart: add ->dev_select to at91_ide.c and tx4939.c (__BIG_ENDIAN case)]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pmac.c')
-rw-r--r-- | drivers/ide/pmac.c | 58 |
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 | ||
406 | static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *); | 406 | static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *); |
407 | static void pmac_ide_selectproc(ide_drive_t *drive); | ||
408 | static 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 | */ |
418 | static void | 416 | static void pmac_ide_apply_timings(ide_drive_t *drive) |
419 | pmac_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 | */ |
437 | static void | 434 | static void pmac_ide_kauai_apply_timings(ide_drive_t *drive) |
438 | pmac_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 | |||
468 | static 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 | |||
476 | static 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 | ||
472 | static void pmac_exec_command(ide_hwif_t *hwif, u8 cmd) | 484 | static 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 | ||
957 | static const struct ide_port_ops pmac_ide_ata6_port_ops = { | 970 | static 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 | ||
965 | static const struct ide_port_ops pmac_ide_ata4_port_ops = { | 984 | static 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 | ||
980 | static const struct ide_dma_ops pmac_dma_ops; | 997 | static 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) { |