diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-06-16 05:21:27 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-16 05:21:27 -0400 |
commit | 688d22e23ab1caacb2c36c615854294b58f2ea47 (patch) | |
tree | 95c8163c0b1f56902f5537bc256d7e5507f56cee /drivers/ide/ppc/pmac.c | |
parent | 7e0edc1bc343231029084761ebf59e522902eb49 (diff) | |
parent | 066519068ad2fbe98c7f45552b1f592903a9c8c8 (diff) |
Merge branch 'linus' into x86/xen
Diffstat (limited to 'drivers/ide/ppc/pmac.c')
-rw-r--r-- | drivers/ide/ppc/pmac.c | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 48aa019127bc..ba2d58727964 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -59,7 +59,6 @@ typedef struct pmac_ide_hwif { | |||
59 | int irq; | 59 | int irq; |
60 | int kind; | 60 | int kind; |
61 | int aapl_bus_id; | 61 | int aapl_bus_id; |
62 | unsigned cable_80 : 1; | ||
63 | unsigned mediabay : 1; | 62 | unsigned mediabay : 1; |
64 | unsigned broken_dma : 1; | 63 | unsigned broken_dma : 1; |
65 | unsigned broken_dma_warn : 1; | 64 | unsigned broken_dma_warn : 1; |
@@ -918,10 +917,40 @@ pmac_ide_do_resume(ide_hwif_t *hwif) | |||
918 | return 0; | 917 | return 0; |
919 | } | 918 | } |
920 | 919 | ||
920 | static u8 pmac_ide_cable_detect(ide_hwif_t *hwif) | ||
921 | { | ||
922 | pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)ide_get_hwifdata(hwif); | ||
923 | struct device_node *np = pmif->node; | ||
924 | const char *cable = of_get_property(np, "cable-type", NULL); | ||
925 | |||
926 | /* Get cable type from device-tree. */ | ||
927 | if (cable && !strncmp(cable, "80-", 3)) | ||
928 | return ATA_CBL_PATA80; | ||
929 | |||
930 | /* | ||
931 | * G5's seem to have incorrect cable type in device-tree. | ||
932 | * Let's assume they have a 80 conductor cable, this seem | ||
933 | * to be always the case unless the user mucked around. | ||
934 | */ | ||
935 | if (of_device_is_compatible(np, "K2-UATA") || | ||
936 | of_device_is_compatible(np, "shasta-ata")) | ||
937 | return ATA_CBL_PATA80; | ||
938 | |||
939 | return ATA_CBL_PATA40; | ||
940 | } | ||
941 | |||
921 | static const struct ide_port_ops pmac_ide_ata6_port_ops = { | 942 | static const struct ide_port_ops pmac_ide_ata6_port_ops = { |
922 | .set_pio_mode = pmac_ide_set_pio_mode, | 943 | .set_pio_mode = pmac_ide_set_pio_mode, |
923 | .set_dma_mode = pmac_ide_set_dma_mode, | 944 | .set_dma_mode = pmac_ide_set_dma_mode, |
924 | .selectproc = pmac_ide_kauai_selectproc, | 945 | .selectproc = pmac_ide_kauai_selectproc, |
946 | .cable_detect = pmac_ide_cable_detect, | ||
947 | }; | ||
948 | |||
949 | static const struct ide_port_ops pmac_ide_ata4_port_ops = { | ||
950 | .set_pio_mode = pmac_ide_set_pio_mode, | ||
951 | .set_dma_mode = pmac_ide_set_dma_mode, | ||
952 | .selectproc = pmac_ide_selectproc, | ||
953 | .cable_detect = pmac_ide_cable_detect, | ||
925 | }; | 954 | }; |
926 | 955 | ||
927 | static const struct ide_port_ops pmac_ide_port_ops = { | 956 | static const struct ide_port_ops pmac_ide_port_ops = { |
@@ -949,10 +978,7 @@ static const struct ide_port_info pmac_port_info = { | |||
949 | 978 | ||
950 | /* | 979 | /* |
951 | * Setup, register & probe an IDE channel driven by this driver, this is | 980 | * Setup, register & probe an IDE channel driven by this driver, this is |
952 | * called by one of the 2 probe functions (macio or PCI). Note that a channel | 981 | * called by one of the 2 probe functions (macio or PCI). |
953 | * that ends up beeing free of any device is not kept around by this driver | ||
954 | * (it is kept in 2.4). This introduce an interface numbering change on some | ||
955 | * rare machines unfortunately, but it's better this way. | ||
956 | */ | 982 | */ |
957 | static int __devinit | 983 | static int __devinit |
958 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | 984 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) |
@@ -962,7 +988,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
962 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 988 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
963 | struct ide_port_info d = pmac_port_info; | 989 | struct ide_port_info d = pmac_port_info; |
964 | 990 | ||
965 | pmif->cable_80 = 0; | ||
966 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 991 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
967 | if (of_device_is_compatible(np, "shasta-ata")) { | 992 | if (of_device_is_compatible(np, "shasta-ata")) { |
968 | pmif->kind = controller_sh_ata6; | 993 | pmif->kind = controller_sh_ata6; |
@@ -979,6 +1004,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
979 | } else if (of_device_is_compatible(np, "keylargo-ata")) { | 1004 | } else if (of_device_is_compatible(np, "keylargo-ata")) { |
980 | if (strcmp(np->name, "ata-4") == 0) { | 1005 | if (strcmp(np->name, "ata-4") == 0) { |
981 | pmif->kind = controller_kl_ata4; | 1006 | pmif->kind = controller_kl_ata4; |
1007 | d.port_ops = &pmac_ide_ata4_port_ops; | ||
982 | d.udma_mask = ATA_UDMA4; | 1008 | d.udma_mask = ATA_UDMA4; |
983 | } else | 1009 | } else |
984 | pmif->kind = controller_kl_ata3; | 1010 | pmif->kind = controller_kl_ata3; |
@@ -992,22 +1018,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
992 | bidp = of_get_property(np, "AAPL,bus-id", NULL); | 1018 | bidp = of_get_property(np, "AAPL,bus-id", NULL); |
993 | pmif->aapl_bus_id = bidp ? *bidp : 0; | 1019 | pmif->aapl_bus_id = bidp ? *bidp : 0; |
994 | 1020 | ||
995 | /* Get cable type from device-tree */ | ||
996 | if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6 | ||
997 | || pmif->kind == controller_k2_ata6 | ||
998 | || pmif->kind == controller_sh_ata6) { | ||
999 | const char* cable = of_get_property(np, "cable-type", NULL); | ||
1000 | if (cable && !strncmp(cable, "80-", 3)) | ||
1001 | pmif->cable_80 = 1; | ||
1002 | } | ||
1003 | /* G5's seem to have incorrect cable type in device-tree. Let's assume | ||
1004 | * they have a 80 conductor cable, this seem to be always the case unless | ||
1005 | * the user mucked around | ||
1006 | */ | ||
1007 | if (of_device_is_compatible(np, "K2-UATA") || | ||
1008 | of_device_is_compatible(np, "shasta-ata")) | ||
1009 | pmif->cable_80 = 1; | ||
1010 | |||
1011 | /* On Kauai-type controllers, we make sure the FCR is correct */ | 1021 | /* On Kauai-type controllers, we make sure the FCR is correct */ |
1012 | if (pmif->kauai_fcr) | 1022 | if (pmif->kauai_fcr) |
1013 | writel(KAUAI_FCR_UATA_MAGIC | | 1023 | writel(KAUAI_FCR_UATA_MAGIC | |
@@ -1053,7 +1063,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
1053 | 1063 | ||
1054 | hwif->hwif_data = pmif; | 1064 | hwif->hwif_data = pmif; |
1055 | ide_init_port_hw(hwif, hw); | 1065 | ide_init_port_hw(hwif, hw); |
1056 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; | ||
1057 | 1066 | ||
1058 | printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n", | 1067 | printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n", |
1059 | hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, | 1068 | hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, |
@@ -1070,11 +1079,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
1070 | } | 1079 | } |
1071 | } | 1080 | } |
1072 | 1081 | ||
1073 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC | ||
1074 | if (pmif->cable_80 == 0) | ||
1075 | d.udma_mask &= ATA_UDMA2; | ||
1076 | #endif | ||
1077 | |||
1078 | idx[0] = hwif->index; | 1082 | idx[0] = hwif->index; |
1079 | 1083 | ||
1080 | ide_device_add(idx, &d); | 1084 | ide_device_add(idx, &d); |