diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:24 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:24 -0400 |
commit | 5e37bdc081a980dd0d669e6387bcf15ca9666f81 (patch) | |
tree | d842166c3bd23fbf3dfba0ccaa0f9ed5cc3096db /drivers/ide/pci/pdc202xx_old.c | |
parent | 1fd1890594bd355a4217f5658a34763e77decee3 (diff) |
ide: add struct ide_dma_ops (take 3)
Add struct ide_dma_ops and convert core code + drivers to use it.
While at it:
* Drop "ide_" prefix from ->ide_dma_end and ->ide_dma_test_irq methods.
* Drop "ide_" "infixes" from DMA methods.
* au1xxx-ide.c:
- use auide_dma_{test_irq,end}() directly in auide_dma_timeout()
* pdc202xx_old.c:
- drop "old_" "infixes" from DMA methods
* siimage.c:
- add siimage_dma_test_irq() helper
- print SATA warning in siimage_init_one()
* Remove no longer needed ->init_hwif implementations.
v2:
* Changes based on review from Sergei:
- s/siimage_ide_dma_test_irq/siimage_dma_test_irq/
- s/drive->hwif/hwif/ in idefloppy_pc_intr().
- fix patch description w.r.t. au1xxx-ide changes
- fix au1xxx-ide build
- fix naming for cmd64*_dma_ops
- drop "ide_" and "old_" infixes
- s/hpt3xxx_dma_ops/hpt37x_dma_ops/
- s/hpt370x_dma_ops/hpt370_dma_ops/
- use correct DMA ops for HPT302/N, HPT371/N and HPT374
- s/it821x_smart_dma_ops/it821x_pass_through_dma_ops/
v3:
* Two bugs slipped in v2 (noticed by Sergei):
- use correct DMA ops for HPT374 (for real this time)
- handle HPT370/HPT370A properly
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/pdc202xx_old.c')
-rw-r--r-- | drivers/ide/pci/pdc202xx_old.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 24e440de4c80..9c490fd63fde 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 | ||
166 | static void pdc202xx_old_ide_dma_start(ide_drive_t *drive) | 166 | static 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 | ||
188 | static int pdc202xx_old_ide_dma_end(ide_drive_t *drive) | 188 | static 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 | ||
205 | static int pdc202xx_old_ide_dma_test_irq(ide_drive_t *drive) | 205 | static 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 | ||
266 | static 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 | |||
283 | static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, | 266 | static 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 | ||
332 | static 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 | |||
338 | static 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, |