aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/pdc202xx_old.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/pdc202xx_old.c')
-rw-r--r--drivers/ide/pci/pdc202xx_old.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index 24e440de4c8..9c490fd63fd 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -163,7 +163,7 @@ static void pdc202xx_quirkproc(ide_drive_t *drive)
163 drive->quirk_list = 0; 163 drive->quirk_list = 0;
164} 164}
165 165
166static void pdc202xx_old_ide_dma_start(ide_drive_t *drive) 166static void pdc202xx_dma_start(ide_drive_t *drive)
167{ 167{
168 if (drive->current_speed > XFER_UDMA_2) 168 if (drive->current_speed > XFER_UDMA_2)
169 pdc_old_enable_66MHz_clock(drive->hwif); 169 pdc_old_enable_66MHz_clock(drive->hwif);
@@ -185,7 +185,7 @@ static void pdc202xx_old_ide_dma_start(ide_drive_t *drive)
185 ide_dma_start(drive); 185 ide_dma_start(drive);
186} 186}
187 187
188static int pdc202xx_old_ide_dma_end(ide_drive_t *drive) 188static int pdc202xx_dma_end(ide_drive_t *drive)
189{ 189{
190 if (drive->media != ide_disk || drive->addressing == 1) { 190 if (drive->media != ide_disk || drive->addressing == 1) {
191 ide_hwif_t *hwif = HWIF(drive); 191 ide_hwif_t *hwif = HWIF(drive);
@@ -202,7 +202,7 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
202 return __ide_dma_end(drive); 202 return __ide_dma_end(drive);
203} 203}
204 204
205static int pdc202xx_old_ide_dma_test_irq(ide_drive_t *drive) 205static int pdc202xx_dma_test_irq(ide_drive_t *drive)
206{ 206{
207 ide_hwif_t *hwif = HWIF(drive); 207 ide_hwif_t *hwif = HWIF(drive);
208 unsigned long high_16 = hwif->extra_base - 16; 208 unsigned long high_16 = hwif->extra_base - 16;
@@ -263,23 +263,6 @@ static void pdc202xx_dma_timeout(ide_drive_t *drive)
263 ide_dma_timeout(drive); 263 ide_dma_timeout(drive);
264} 264}
265 265
266static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
267{
268 struct pci_dev *dev = to_pci_dev(hwif->dev);
269
270 if (hwif->dma_base == 0)
271 return;
272
273 hwif->dma_lost_irq = &pdc202xx_dma_lost_irq;
274 hwif->dma_timeout = &pdc202xx_dma_timeout;
275
276 if (dev->device != PCI_DEVICE_ID_PROMISE_20246) {
277 hwif->dma_start = &pdc202xx_old_ide_dma_start;
278 hwif->ide_dma_end = &pdc202xx_old_ide_dma_end;
279 }
280 hwif->ide_dma_test_irq = &pdc202xx_old_ide_dma_test_irq;
281}
282
283static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, 266static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev,
284 const char *name) 267 const char *name)
285{ 268{
@@ -346,12 +329,26 @@ static const struct ide_port_ops pdc2026x_port_ops = {
346 .cable_detect = pdc2026x_cable_detect, 329 .cable_detect = pdc2026x_cable_detect,
347}; 330};
348 331
332static struct ide_dma_ops pdc20246_dma_ops = {
333 .dma_test_irq = pdc202xx_dma_test_irq,
334 .dma_lost_irq = pdc202xx_dma_lost_irq,
335 .dma_timeout = pdc202xx_dma_timeout,
336};
337
338static struct ide_dma_ops pdc2026x_dma_ops = {
339 .dma_start = pdc202xx_dma_start,
340 .dma_end = pdc202xx_dma_end,
341 .dma_test_irq = pdc202xx_dma_test_irq,
342 .dma_lost_irq = pdc202xx_dma_lost_irq,
343 .dma_timeout = pdc202xx_dma_timeout,
344};
345
349#define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \ 346#define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \
350 { \ 347 { \
351 .name = name_str, \ 348 .name = name_str, \
352 .init_chipset = init_chipset_pdc202xx, \ 349 .init_chipset = init_chipset_pdc202xx, \
353 .init_hwif = init_hwif_pdc202xx, \
354 .port_ops = &pdc2026x_port_ops, \ 350 .port_ops = &pdc2026x_port_ops, \
351 .dma_ops = &pdc2026x_dma_ops, \
355 .host_flags = IDE_HFLAGS_PDC202XX | extra_flags, \ 352 .host_flags = IDE_HFLAGS_PDC202XX | extra_flags, \
356 .pio_mask = ATA_PIO4, \ 353 .pio_mask = ATA_PIO4, \
357 .mwdma_mask = ATA_MWDMA2, \ 354 .mwdma_mask = ATA_MWDMA2, \
@@ -362,8 +359,8 @@ static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = {
362 { /* 0 */ 359 { /* 0 */
363 .name = "PDC20246", 360 .name = "PDC20246",
364 .init_chipset = init_chipset_pdc202xx, 361 .init_chipset = init_chipset_pdc202xx,
365 .init_hwif = init_hwif_pdc202xx,
366 .port_ops = &pdc20246_port_ops, 362 .port_ops = &pdc20246_port_ops,
363 .dma_ops = &pdc20246_dma_ops,
367 .host_flags = IDE_HFLAGS_PDC202XX, 364 .host_flags = IDE_HFLAGS_PDC202XX,
368 .pio_mask = ATA_PIO4, 365 .pio_mask = ATA_PIO4,
369 .mwdma_mask = ATA_MWDMA2, 366 .mwdma_mask = ATA_MWDMA2,