diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:14 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:14 -0400 |
commit | ac95beedf8bc97b24f9540d4da9952f07221c023 (patch) | |
tree | c29837142c8083b6fcaf1767abcb0a4533676cd1 /drivers/ide/ppc/pmac.c | |
parent | 4a27214d7be31e122db4102166f49ec15958e8e9 (diff) |
ide: add struct ide_port_ops (take 2)
* Move hooks for port/host specific methods from ide_hwif_t to
'struct ide_port_ops'.
* Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info'
and ide_hwif_t.
* Update host drivers and core code accordingly.
While at it:
* Rename ata66_*() cable detect functions to *_cable_detect() to match
the standard naming. (Suggested by Sergei Shtylyov)
v2:
* Fix build for bast-ide. (Noticed by Andrew Morton)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ppc/pmac.c')
-rw-r--r-- | drivers/ide/ppc/pmac.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 177961edc430..3277bf2d66a5 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -918,8 +918,21 @@ pmac_ide_do_resume(ide_hwif_t *hwif) | |||
918 | return 0; | 918 | return 0; |
919 | } | 919 | } |
920 | 920 | ||
921 | static const struct ide_port_ops pmac_ide_ata6_port_ops = { | ||
922 | .set_pio_mode = pmac_ide_set_pio_mode, | ||
923 | .set_dma_mode = pmac_ide_set_dma_mode, | ||
924 | .selectproc = pmac_ide_kauai_selectproc, | ||
925 | }; | ||
926 | |||
927 | static const struct ide_port_ops pmac_ide_port_ops = { | ||
928 | .set_pio_mode = pmac_ide_set_pio_mode, | ||
929 | .set_dma_mode = pmac_ide_set_dma_mode, | ||
930 | .selectproc = pmac_ide_selectproc, | ||
931 | }; | ||
932 | |||
921 | static const struct ide_port_info pmac_port_info = { | 933 | static const struct ide_port_info pmac_port_info = { |
922 | .chipset = ide_pmac, | 934 | .chipset = ide_pmac, |
935 | .port_ops = &pmac_ide_port_ops, | ||
923 | .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | | 936 | .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | |
924 | IDE_HFLAG_POST_SET_MODE | | 937 | IDE_HFLAG_POST_SET_MODE | |
925 | IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ | 938 | IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ |
@@ -947,12 +960,15 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
947 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 960 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
948 | if (of_device_is_compatible(np, "shasta-ata")) { | 961 | if (of_device_is_compatible(np, "shasta-ata")) { |
949 | pmif->kind = controller_sh_ata6; | 962 | pmif->kind = controller_sh_ata6; |
963 | d.port_ops = &pmac_ide_ata6_port_ops; | ||
950 | d.udma_mask = ATA_UDMA6; | 964 | d.udma_mask = ATA_UDMA6; |
951 | } else if (of_device_is_compatible(np, "kauai-ata")) { | 965 | } else if (of_device_is_compatible(np, "kauai-ata")) { |
952 | pmif->kind = controller_un_ata6; | 966 | pmif->kind = controller_un_ata6; |
967 | d.port_ops = &pmac_ide_ata6_port_ops; | ||
953 | d.udma_mask = ATA_UDMA5; | 968 | d.udma_mask = ATA_UDMA5; |
954 | } else if (of_device_is_compatible(np, "K2-UATA")) { | 969 | } else if (of_device_is_compatible(np, "K2-UATA")) { |
955 | pmif->kind = controller_k2_ata6; | 970 | pmif->kind = controller_k2_ata6; |
971 | d.port_ops = &pmac_ide_ata6_port_ops; | ||
956 | d.udma_mask = ATA_UDMA5; | 972 | d.udma_mask = ATA_UDMA5; |
957 | } else if (of_device_is_compatible(np, "keylargo-ata")) { | 973 | } else if (of_device_is_compatible(np, "keylargo-ata")) { |
958 | if (strcmp(np->name, "ata-4") == 0) { | 974 | if (strcmp(np->name, "ata-4") == 0) { |
@@ -1035,14 +1051,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
1035 | ide_init_port_hw(hwif, hw); | 1051 | ide_init_port_hw(hwif, hw); |
1036 | hwif->noprobe = pmif->mediabay; | 1052 | hwif->noprobe = pmif->mediabay; |
1037 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; | 1053 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; |
1038 | hwif->set_pio_mode = pmac_ide_set_pio_mode; | ||
1039 | if (pmif->kind == controller_un_ata6 | ||
1040 | || pmif->kind == controller_k2_ata6 | ||
1041 | || pmif->kind == controller_sh_ata6) | ||
1042 | hwif->selectproc = pmac_ide_kauai_selectproc; | ||
1043 | else | ||
1044 | hwif->selectproc = pmac_ide_selectproc; | ||
1045 | hwif->set_dma_mode = pmac_ide_set_dma_mode; | ||
1046 | 1054 | ||
1047 | printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n", | 1055 | printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n", |
1048 | hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, | 1056 | hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, |