diff options
Diffstat (limited to 'drivers/ide/ppc/pmac.c')
-rw-r--r-- | drivers/ide/ppc/pmac.c | 183 |
1 files changed, 108 insertions, 75 deletions
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 88619b50d9ef..3cac6b2790dd 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -79,8 +79,6 @@ typedef struct pmac_ide_hwif { | |||
79 | 79 | ||
80 | } pmac_ide_hwif_t; | 80 | } pmac_ide_hwif_t; |
81 | 81 | ||
82 | static pmac_ide_hwif_t pmac_ide[MAX_HWIFS]; | ||
83 | |||
84 | enum { | 82 | enum { |
85 | controller_ohare, /* OHare based */ | 83 | controller_ohare, /* OHare based */ |
86 | controller_heathrow, /* Heathrow/Paddington */ | 84 | controller_heathrow, /* Heathrow/Paddington */ |
@@ -411,7 +409,7 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time) | |||
411 | */ | 409 | */ |
412 | #define IDE_WAKEUP_DELAY (1*HZ) | 410 | #define IDE_WAKEUP_DELAY (1*HZ) |
413 | 411 | ||
414 | static int pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif); | 412 | static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *); |
415 | static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); | 413 | static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); |
416 | static void pmac_ide_selectproc(ide_drive_t *drive); | 414 | static void pmac_ide_selectproc(ide_drive_t *drive); |
417 | static void pmac_ide_kauai_selectproc(ide_drive_t *drive); | 415 | static void pmac_ide_kauai_selectproc(ide_drive_t *drive); |
@@ -419,7 +417,7 @@ static void pmac_ide_kauai_selectproc(ide_drive_t *drive); | |||
419 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ | 417 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ |
420 | 418 | ||
421 | #define PMAC_IDE_REG(x) \ | 419 | #define PMAC_IDE_REG(x) \ |
422 | ((void __iomem *)((drive)->hwif->io_ports[IDE_DATA_OFFSET] + (x))) | 420 | ((void __iomem *)((drive)->hwif->io_ports.data_addr + (x))) |
423 | 421 | ||
424 | /* | 422 | /* |
425 | * Apply the timings of the proper unit (master/slave) to the shared | 423 | * Apply the timings of the proper unit (master/slave) to the shared |
@@ -920,12 +918,29 @@ pmac_ide_do_resume(ide_hwif_t *hwif) | |||
920 | return 0; | 918 | return 0; |
921 | } | 919 | } |
922 | 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 | |||
933 | static const struct ide_dma_ops pmac_dma_ops; | ||
934 | |||
923 | static const struct ide_port_info pmac_port_info = { | 935 | static const struct ide_port_info pmac_port_info = { |
936 | .init_dma = pmac_ide_init_dma, | ||
924 | .chipset = ide_pmac, | 937 | .chipset = ide_pmac, |
938 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC | ||
939 | .dma_ops = &pmac_dma_ops, | ||
940 | #endif | ||
941 | .port_ops = &pmac_ide_port_ops, | ||
925 | .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | | 942 | .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | |
926 | IDE_HFLAG_PIO_NO_DOWNGRADE | | ||
927 | IDE_HFLAG_POST_SET_MODE | | 943 | IDE_HFLAG_POST_SET_MODE | |
928 | IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ | ||
929 | IDE_HFLAG_UNMASK_IRQS, | 944 | IDE_HFLAG_UNMASK_IRQS, |
930 | .pio_mask = ATA_PIO4, | 945 | .pio_mask = ATA_PIO4, |
931 | .mwdma_mask = ATA_MWDMA2, | 946 | .mwdma_mask = ATA_MWDMA2, |
@@ -950,12 +965,15 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
950 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 965 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
951 | if (of_device_is_compatible(np, "shasta-ata")) { | 966 | if (of_device_is_compatible(np, "shasta-ata")) { |
952 | pmif->kind = controller_sh_ata6; | 967 | pmif->kind = controller_sh_ata6; |
968 | d.port_ops = &pmac_ide_ata6_port_ops; | ||
953 | d.udma_mask = ATA_UDMA6; | 969 | d.udma_mask = ATA_UDMA6; |
954 | } else if (of_device_is_compatible(np, "kauai-ata")) { | 970 | } else if (of_device_is_compatible(np, "kauai-ata")) { |
955 | pmif->kind = controller_un_ata6; | 971 | pmif->kind = controller_un_ata6; |
972 | d.port_ops = &pmac_ide_ata6_port_ops; | ||
956 | d.udma_mask = ATA_UDMA5; | 973 | d.udma_mask = ATA_UDMA5; |
957 | } else if (of_device_is_compatible(np, "K2-UATA")) { | 974 | } else if (of_device_is_compatible(np, "K2-UATA")) { |
958 | pmif->kind = controller_k2_ata6; | 975 | pmif->kind = controller_k2_ata6; |
976 | d.port_ops = &pmac_ide_ata6_port_ops; | ||
959 | d.udma_mask = ATA_UDMA5; | 977 | d.udma_mask = ATA_UDMA5; |
960 | } else if (of_device_is_compatible(np, "keylargo-ata")) { | 978 | } else if (of_device_is_compatible(np, "keylargo-ata")) { |
961 | if (strcmp(np->name, "ata-4") == 0) { | 979 | if (strcmp(np->name, "ata-4") == 0) { |
@@ -1032,37 +1050,29 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
1032 | default_hwif_mmiops(hwif); | 1050 | default_hwif_mmiops(hwif); |
1033 | hwif->OUTBSYNC = pmac_outbsync; | 1051 | hwif->OUTBSYNC = pmac_outbsync; |
1034 | 1052 | ||
1035 | /* Tell common code _not_ to mess with resources */ | ||
1036 | hwif->mmio = 1; | ||
1037 | hwif->hwif_data = pmif; | 1053 | hwif->hwif_data = pmif; |
1038 | ide_init_port_hw(hwif, hw); | 1054 | ide_init_port_hw(hwif, hw); |
1039 | hwif->noprobe = pmif->mediabay; | ||
1040 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; | 1055 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; |
1041 | hwif->set_pio_mode = pmac_ide_set_pio_mode; | ||
1042 | if (pmif->kind == controller_un_ata6 | ||
1043 | || pmif->kind == controller_k2_ata6 | ||
1044 | || pmif->kind == controller_sh_ata6) | ||
1045 | hwif->selectproc = pmac_ide_kauai_selectproc; | ||
1046 | else | ||
1047 | hwif->selectproc = pmac_ide_selectproc; | ||
1048 | hwif->set_dma_mode = pmac_ide_set_dma_mode; | ||
1049 | 1056 | ||
1050 | printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n", | 1057 | printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n", |
1051 | hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, | 1058 | hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, |
1052 | pmif->mediabay ? " (mediabay)" : "", hwif->irq); | 1059 | pmif->mediabay ? " (mediabay)" : "", hwif->irq); |
1053 | 1060 | ||
1061 | if (pmif->mediabay) { | ||
1054 | #ifdef CONFIG_PMAC_MEDIABAY | 1062 | #ifdef CONFIG_PMAC_MEDIABAY |
1055 | if (pmif->mediabay && check_media_bay_by_base(pmif->regbase, MB_CD) == 0) | 1063 | if (check_media_bay_by_base(pmif->regbase, MB_CD)) { |
1056 | hwif->noprobe = 0; | 1064 | #else |
1057 | #endif /* CONFIG_PMAC_MEDIABAY */ | 1065 | if (1) { |
1066 | #endif | ||
1067 | hwif->drives[0].noprobe = 1; | ||
1068 | hwif->drives[1].noprobe = 1; | ||
1069 | } | ||
1070 | } | ||
1058 | 1071 | ||
1059 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC | 1072 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC |
1060 | if (pmif->cable_80 == 0) | 1073 | if (pmif->cable_80 == 0) |
1061 | d.udma_mask &= ATA_UDMA2; | 1074 | d.udma_mask &= ATA_UDMA2; |
1062 | /* has a DBDMA controller channel */ | ||
1063 | if (pmif->dma_regs == 0 || pmac_ide_setup_dma(pmif, hwif) < 0) | ||
1064 | #endif | 1075 | #endif |
1065 | d.udma_mask = d.mwdma_mask = 0; | ||
1066 | 1076 | ||
1067 | idx[0] = hwif->index; | 1077 | idx[0] = hwif->index; |
1068 | 1078 | ||
@@ -1076,8 +1086,9 @@ static void __devinit pmac_ide_init_ports(hw_regs_t *hw, unsigned long base) | |||
1076 | int i; | 1086 | int i; |
1077 | 1087 | ||
1078 | for (i = 0; i < 8; ++i) | 1088 | for (i = 0; i < 8; ++i) |
1079 | hw->io_ports[i] = base + i * 0x10; | 1089 | hw->io_ports_array[i] = base + i * 0x10; |
1080 | hw->io_ports[8] = base + 0x160; | 1090 | |
1091 | hw->io_ports.ctl_addr = base + 0x160; | ||
1081 | } | 1092 | } |
1082 | 1093 | ||
1083 | /* | 1094 | /* |
@@ -1088,35 +1099,36 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
1088 | { | 1099 | { |
1089 | void __iomem *base; | 1100 | void __iomem *base; |
1090 | unsigned long regbase; | 1101 | unsigned long regbase; |
1091 | int irq; | ||
1092 | ide_hwif_t *hwif; | 1102 | ide_hwif_t *hwif; |
1093 | pmac_ide_hwif_t *pmif; | 1103 | pmac_ide_hwif_t *pmif; |
1094 | int i, rc; | 1104 | int irq, rc; |
1095 | hw_regs_t hw; | 1105 | hw_regs_t hw; |
1096 | 1106 | ||
1097 | i = 0; | 1107 | pmif = kzalloc(sizeof(*pmif), GFP_KERNEL); |
1098 | while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0 | 1108 | if (pmif == NULL) |
1099 | || pmac_ide[i].node != NULL)) | 1109 | return -ENOMEM; |
1100 | ++i; | 1110 | |
1101 | if (i >= MAX_HWIFS) { | 1111 | hwif = ide_find_port(); |
1112 | if (hwif == NULL) { | ||
1102 | printk(KERN_ERR "ide-pmac: MacIO interface attach with no slot\n"); | 1113 | printk(KERN_ERR "ide-pmac: MacIO interface attach with no slot\n"); |
1103 | printk(KERN_ERR " %s\n", mdev->ofdev.node->full_name); | 1114 | printk(KERN_ERR " %s\n", mdev->ofdev.node->full_name); |
1104 | return -ENODEV; | 1115 | rc = -ENODEV; |
1116 | goto out_free_pmif; | ||
1105 | } | 1117 | } |
1106 | 1118 | ||
1107 | pmif = &pmac_ide[i]; | ||
1108 | hwif = &ide_hwifs[i]; | ||
1109 | |||
1110 | if (macio_resource_count(mdev) == 0) { | 1119 | if (macio_resource_count(mdev) == 0) { |
1111 | printk(KERN_WARNING "ide%d: no address for %s\n", | 1120 | printk(KERN_WARNING "ide-pmac: no address for %s\n", |
1112 | i, mdev->ofdev.node->full_name); | 1121 | mdev->ofdev.node->full_name); |
1113 | return -ENXIO; | 1122 | rc = -ENXIO; |
1123 | goto out_free_pmif; | ||
1114 | } | 1124 | } |
1115 | 1125 | ||
1116 | /* Request memory resource for IO ports */ | 1126 | /* Request memory resource for IO ports */ |
1117 | if (macio_request_resource(mdev, 0, "ide-pmac (ports)")) { | 1127 | if (macio_request_resource(mdev, 0, "ide-pmac (ports)")) { |
1118 | printk(KERN_ERR "ide%d: can't request mmio resource !\n", i); | 1128 | printk(KERN_ERR "ide-pmac: can't request MMIO resource for " |
1119 | return -EBUSY; | 1129 | "%s!\n", mdev->ofdev.node->full_name); |
1130 | rc = -EBUSY; | ||
1131 | goto out_free_pmif; | ||
1120 | } | 1132 | } |
1121 | 1133 | ||
1122 | /* XXX This is bogus. Should be fixed in the registry by checking | 1134 | /* XXX This is bogus. Should be fixed in the registry by checking |
@@ -1125,8 +1137,8 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
1125 | * where that happens though... | 1137 | * where that happens though... |
1126 | */ | 1138 | */ |
1127 | if (macio_irq_count(mdev) == 0) { | 1139 | if (macio_irq_count(mdev) == 0) { |
1128 | printk(KERN_WARNING "ide%d: no intrs for device %s, using 13\n", | 1140 | printk(KERN_WARNING "ide-pmac: no intrs for device %s, using " |
1129 | i, mdev->ofdev.node->full_name); | 1141 | "13\n", mdev->ofdev.node->full_name); |
1130 | irq = irq_create_mapping(NULL, 13); | 1142 | irq = irq_create_mapping(NULL, 13); |
1131 | } else | 1143 | } else |
1132 | irq = macio_irq(mdev, 0); | 1144 | irq = macio_irq(mdev, 0); |
@@ -1144,7 +1156,9 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
1144 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC | 1156 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC |
1145 | if (macio_resource_count(mdev) >= 2) { | 1157 | if (macio_resource_count(mdev) >= 2) { |
1146 | if (macio_request_resource(mdev, 1, "ide-pmac (dma)")) | 1158 | if (macio_request_resource(mdev, 1, "ide-pmac (dma)")) |
1147 | printk(KERN_WARNING "ide%d: can't request DMA resource !\n", i); | 1159 | printk(KERN_WARNING "ide-pmac: can't request DMA " |
1160 | "resource for %s!\n", | ||
1161 | mdev->ofdev.node->full_name); | ||
1148 | else | 1162 | else |
1149 | pmif->dma_regs = ioremap(macio_resource_start(mdev, 1), 0x1000); | 1163 | pmif->dma_regs = ioremap(macio_resource_start(mdev, 1), 0x1000); |
1150 | } else | 1164 | } else |
@@ -1166,11 +1180,15 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
1166 | iounmap(pmif->dma_regs); | 1180 | iounmap(pmif->dma_regs); |
1167 | macio_release_resource(mdev, 1); | 1181 | macio_release_resource(mdev, 1); |
1168 | } | 1182 | } |
1169 | memset(pmif, 0, sizeof(*pmif)); | ||
1170 | macio_release_resource(mdev, 0); | 1183 | macio_release_resource(mdev, 0); |
1184 | kfree(pmif); | ||
1171 | } | 1185 | } |
1172 | 1186 | ||
1173 | return rc; | 1187 | return rc; |
1188 | |||
1189 | out_free_pmif: | ||
1190 | kfree(pmif); | ||
1191 | return rc; | ||
1174 | } | 1192 | } |
1175 | 1193 | ||
1176 | static int | 1194 | static int |
@@ -1215,7 +1233,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1215 | pmac_ide_hwif_t *pmif; | 1233 | pmac_ide_hwif_t *pmif; |
1216 | void __iomem *base; | 1234 | void __iomem *base; |
1217 | unsigned long rbase, rlen; | 1235 | unsigned long rbase, rlen; |
1218 | int i, rc; | 1236 | int rc; |
1219 | hw_regs_t hw; | 1237 | hw_regs_t hw; |
1220 | 1238 | ||
1221 | np = pci_device_to_OF_node(pdev); | 1239 | np = pci_device_to_OF_node(pdev); |
@@ -1223,30 +1241,32 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1223 | printk(KERN_ERR "ide-pmac: cannot find MacIO node for Kauai ATA interface\n"); | 1241 | printk(KERN_ERR "ide-pmac: cannot find MacIO node for Kauai ATA interface\n"); |
1224 | return -ENODEV; | 1242 | return -ENODEV; |
1225 | } | 1243 | } |
1226 | i = 0; | 1244 | |
1227 | while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0 | 1245 | pmif = kzalloc(sizeof(*pmif), GFP_KERNEL); |
1228 | || pmac_ide[i].node != NULL)) | 1246 | if (pmif == NULL) |
1229 | ++i; | 1247 | return -ENOMEM; |
1230 | if (i >= MAX_HWIFS) { | 1248 | |
1249 | hwif = ide_find_port(); | ||
1250 | if (hwif == NULL) { | ||
1231 | printk(KERN_ERR "ide-pmac: PCI interface attach with no slot\n"); | 1251 | printk(KERN_ERR "ide-pmac: PCI interface attach with no slot\n"); |
1232 | printk(KERN_ERR " %s\n", np->full_name); | 1252 | printk(KERN_ERR " %s\n", np->full_name); |
1233 | return -ENODEV; | 1253 | rc = -ENODEV; |
1254 | goto out_free_pmif; | ||
1234 | } | 1255 | } |
1235 | 1256 | ||
1236 | pmif = &pmac_ide[i]; | ||
1237 | hwif = &ide_hwifs[i]; | ||
1238 | |||
1239 | if (pci_enable_device(pdev)) { | 1257 | if (pci_enable_device(pdev)) { |
1240 | printk(KERN_WARNING "ide%i: Can't enable PCI device for %s\n", | 1258 | printk(KERN_WARNING "ide-pmac: Can't enable PCI device for " |
1241 | i, np->full_name); | 1259 | "%s\n", np->full_name); |
1242 | return -ENXIO; | 1260 | rc = -ENXIO; |
1261 | goto out_free_pmif; | ||
1243 | } | 1262 | } |
1244 | pci_set_master(pdev); | 1263 | pci_set_master(pdev); |
1245 | 1264 | ||
1246 | if (pci_request_regions(pdev, "Kauai ATA")) { | 1265 | if (pci_request_regions(pdev, "Kauai ATA")) { |
1247 | printk(KERN_ERR "ide%d: Cannot obtain PCI resources for %s\n", | 1266 | printk(KERN_ERR "ide-pmac: Cannot obtain PCI resources for " |
1248 | i, np->full_name); | 1267 | "%s\n", np->full_name); |
1249 | return -ENXIO; | 1268 | rc = -ENXIO; |
1269 | goto out_free_pmif; | ||
1250 | } | 1270 | } |
1251 | 1271 | ||
1252 | hwif->dev = &pdev->dev; | 1272 | hwif->dev = &pdev->dev; |
@@ -1276,11 +1296,15 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1276 | /* The inteface is released to the common IDE layer */ | 1296 | /* The inteface is released to the common IDE layer */ |
1277 | pci_set_drvdata(pdev, NULL); | 1297 | pci_set_drvdata(pdev, NULL); |
1278 | iounmap(base); | 1298 | iounmap(base); |
1279 | memset(pmif, 0, sizeof(*pmif)); | ||
1280 | pci_release_regions(pdev); | 1299 | pci_release_regions(pdev); |
1300 | kfree(pmif); | ||
1281 | } | 1301 | } |
1282 | 1302 | ||
1283 | return rc; | 1303 | return rc; |
1304 | |||
1305 | out_free_pmif: | ||
1306 | kfree(pmif); | ||
1307 | return rc; | ||
1284 | } | 1308 | } |
1285 | 1309 | ||
1286 | static int | 1310 | static int |
@@ -1652,18 +1676,31 @@ pmac_ide_dma_lost_irq (ide_drive_t *drive) | |||
1652 | printk(KERN_ERR "ide-pmac lost interrupt, dma status: %lx\n", status); | 1676 | printk(KERN_ERR "ide-pmac lost interrupt, dma status: %lx\n", status); |
1653 | } | 1677 | } |
1654 | 1678 | ||
1679 | static const struct ide_dma_ops pmac_dma_ops = { | ||
1680 | .dma_host_set = pmac_ide_dma_host_set, | ||
1681 | .dma_setup = pmac_ide_dma_setup, | ||
1682 | .dma_exec_cmd = pmac_ide_dma_exec_cmd, | ||
1683 | .dma_start = pmac_ide_dma_start, | ||
1684 | .dma_end = pmac_ide_dma_end, | ||
1685 | .dma_test_irq = pmac_ide_dma_test_irq, | ||
1686 | .dma_timeout = ide_dma_timeout, | ||
1687 | .dma_lost_irq = pmac_ide_dma_lost_irq, | ||
1688 | }; | ||
1689 | |||
1655 | /* | 1690 | /* |
1656 | * Allocate the data structures needed for using DMA with an interface | 1691 | * Allocate the data structures needed for using DMA with an interface |
1657 | * and fill the proper list of functions pointers | 1692 | * and fill the proper list of functions pointers |
1658 | */ | 1693 | */ |
1659 | static int __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | 1694 | static int __devinit pmac_ide_init_dma(ide_hwif_t *hwif, |
1695 | const struct ide_port_info *d) | ||
1660 | { | 1696 | { |
1697 | pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif->hwif_data; | ||
1661 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 1698 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1662 | 1699 | ||
1663 | /* We won't need pci_dev if we switch to generic consistent | 1700 | /* We won't need pci_dev if we switch to generic consistent |
1664 | * DMA routines ... | 1701 | * DMA routines ... |
1665 | */ | 1702 | */ |
1666 | if (dev == NULL) | 1703 | if (dev == NULL || pmif->dma_regs == 0) |
1667 | return -ENODEV; | 1704 | return -ENODEV; |
1668 | /* | 1705 | /* |
1669 | * Allocate space for the DBDMA commands. | 1706 | * Allocate space for the DBDMA commands. |
@@ -1682,18 +1719,14 @@ static int __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1682 | 1719 | ||
1683 | hwif->sg_max_nents = MAX_DCMDS; | 1720 | hwif->sg_max_nents = MAX_DCMDS; |
1684 | 1721 | ||
1685 | hwif->dma_host_set = &pmac_ide_dma_host_set; | ||
1686 | hwif->dma_setup = &pmac_ide_dma_setup; | ||
1687 | hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd; | ||
1688 | hwif->dma_start = &pmac_ide_dma_start; | ||
1689 | hwif->ide_dma_end = &pmac_ide_dma_end; | ||
1690 | hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq; | ||
1691 | hwif->dma_timeout = &ide_dma_timeout; | ||
1692 | hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; | ||
1693 | |||
1694 | return 0; | 1722 | return 0; |
1695 | } | 1723 | } |
1696 | 1724 | #else | |
1725 | static int __devinit pmac_ide_init_dma(ide_hwif_t *hwif, | ||
1726 | const struct ide_port_info *d) | ||
1727 | { | ||
1728 | return -EOPNOTSUPP; | ||
1729 | } | ||
1697 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ | 1730 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ |
1698 | 1731 | ||
1699 | module_init(pmac_ide_probe); | 1732 | module_init(pmac_ide_probe); |