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/sgiioc4.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/sgiioc4.c')
-rw-r--r-- | drivers/ide/pci/sgiioc4.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 47d6e0492dda..2cbb7fd1ddec 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -188,7 +188,7 @@ sgiioc4_clearirq(ide_drive_t * drive) | |||
188 | return intr_reg & 3; | 188 | return intr_reg & 3; |
189 | } | 189 | } |
190 | 190 | ||
191 | static void sgiioc4_ide_dma_start(ide_drive_t * drive) | 191 | static void sgiioc4_dma_start(ide_drive_t *drive) |
192 | { | 192 | { |
193 | ide_hwif_t *hwif = HWIF(drive); | 193 | ide_hwif_t *hwif = HWIF(drive); |
194 | unsigned long ioc4_dma_addr = hwif->dma_base + IOC4_DMA_CTRL * 4; | 194 | unsigned long ioc4_dma_addr = hwif->dma_base + IOC4_DMA_CTRL * 4; |
@@ -215,8 +215,7 @@ sgiioc4_ide_dma_stop(ide_hwif_t *hwif, u64 dma_base) | |||
215 | } | 215 | } |
216 | 216 | ||
217 | /* Stops the IOC4 DMA Engine */ | 217 | /* Stops the IOC4 DMA Engine */ |
218 | static int | 218 | static int sgiioc4_dma_end(ide_drive_t *drive) |
219 | sgiioc4_ide_dma_end(ide_drive_t * drive) | ||
220 | { | 219 | { |
221 | u32 ioc4_dma, bc_dev, bc_mem, num, valid = 0, cnt = 0; | 220 | u32 ioc4_dma, bc_dev, bc_mem, num, valid = 0, cnt = 0; |
222 | ide_hwif_t *hwif = HWIF(drive); | 221 | ide_hwif_t *hwif = HWIF(drive); |
@@ -279,8 +278,7 @@ static void sgiioc4_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
279 | } | 278 | } |
280 | 279 | ||
281 | /* returns 1 if dma irq issued, 0 otherwise */ | 280 | /* returns 1 if dma irq issued, 0 otherwise */ |
282 | static int | 281 | static int sgiioc4_dma_test_irq(ide_drive_t *drive) |
283 | sgiioc4_ide_dma_test_irq(ide_drive_t * drive) | ||
284 | { | 282 | { |
285 | return sgiioc4_checkirq(HWIF(drive)); | 283 | return sgiioc4_checkirq(HWIF(drive)); |
286 | } | 284 | } |
@@ -294,7 +292,7 @@ static void sgiioc4_dma_host_set(ide_drive_t *drive, int on) | |||
294 | static void | 292 | static void |
295 | sgiioc4_resetproc(ide_drive_t * drive) | 293 | sgiioc4_resetproc(ide_drive_t * drive) |
296 | { | 294 | { |
297 | sgiioc4_ide_dma_end(drive); | 295 | sgiioc4_dma_end(drive); |
298 | sgiioc4_clearirq(drive); | 296 | sgiioc4_clearirq(drive); |
299 | } | 297 | } |
300 | 298 | ||
@@ -327,8 +325,6 @@ sgiioc4_INB(unsigned long port) | |||
327 | return reg; | 325 | return reg; |
328 | } | 326 | } |
329 | 327 | ||
330 | static void __devinit ide_init_sgiioc4(ide_hwif_t *); | ||
331 | |||
332 | /* Creates a dma map for the scatter-gather list entries */ | 328 | /* Creates a dma map for the scatter-gather list entries */ |
333 | static int __devinit | 329 | static int __devinit |
334 | ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) | 330 | ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) |
@@ -377,7 +373,6 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) | |||
377 | 373 | ||
378 | if (pad) { | 374 | if (pad) { |
379 | ide_set_hwifdata(hwif, pad); | 375 | ide_set_hwifdata(hwif, pad); |
380 | ide_init_sgiioc4(hwif); | ||
381 | return 0; | 376 | return 0; |
382 | } | 377 | } |
383 | 378 | ||
@@ -526,7 +521,7 @@ use_pio_instead: | |||
526 | return 0; /* revert to PIO for this request */ | 521 | return 0; /* revert to PIO for this request */ |
527 | } | 522 | } |
528 | 523 | ||
529 | static int sgiioc4_ide_dma_setup(ide_drive_t *drive) | 524 | static int sgiioc4_dma_setup(ide_drive_t *drive) |
530 | { | 525 | { |
531 | struct request *rq = HWGROUP(drive)->rq; | 526 | struct request *rq = HWGROUP(drive)->rq; |
532 | unsigned int count = 0; | 527 | unsigned int count = 0; |
@@ -555,18 +550,6 @@ static int sgiioc4_ide_dma_setup(ide_drive_t *drive) | |||
555 | return 0; | 550 | return 0; |
556 | } | 551 | } |
557 | 552 | ||
558 | static void __devinit | ||
559 | ide_init_sgiioc4(ide_hwif_t * hwif) | ||
560 | { | ||
561 | hwif->dma_host_set = &sgiioc4_dma_host_set; | ||
562 | hwif->dma_setup = &sgiioc4_ide_dma_setup; | ||
563 | hwif->dma_start = &sgiioc4_ide_dma_start; | ||
564 | hwif->ide_dma_end = &sgiioc4_ide_dma_end; | ||
565 | hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq; | ||
566 | hwif->dma_lost_irq = &sgiioc4_dma_lost_irq; | ||
567 | hwif->dma_timeout = &ide_dma_timeout; | ||
568 | } | ||
569 | |||
570 | static const struct ide_port_ops sgiioc4_port_ops = { | 553 | static const struct ide_port_ops sgiioc4_port_ops = { |
571 | .set_dma_mode = sgiioc4_set_dma_mode, | 554 | .set_dma_mode = sgiioc4_set_dma_mode, |
572 | /* reset DMA engine, clear IRQs */ | 555 | /* reset DMA engine, clear IRQs */ |
@@ -575,10 +558,21 @@ static const struct ide_port_ops sgiioc4_port_ops = { | |||
575 | .maskproc = sgiioc4_maskproc, | 558 | .maskproc = sgiioc4_maskproc, |
576 | }; | 559 | }; |
577 | 560 | ||
561 | static struct ide_dma_ops sgiioc4_dma_ops = { | ||
562 | .dma_host_set = sgiioc4_dma_host_set, | ||
563 | .dma_setup = sgiioc4_dma_setup, | ||
564 | .dma_start = sgiioc4_dma_start, | ||
565 | .dma_end = sgiioc4_dma_end, | ||
566 | .dma_test_irq = sgiioc4_dma_test_irq, | ||
567 | .dma_lost_irq = sgiioc4_dma_lost_irq, | ||
568 | .dma_timeout = ide_dma_timeout, | ||
569 | }; | ||
570 | |||
578 | static const struct ide_port_info sgiioc4_port_info __devinitdata = { | 571 | static const struct ide_port_info sgiioc4_port_info __devinitdata = { |
579 | .chipset = ide_pci, | 572 | .chipset = ide_pci, |
580 | .init_dma = ide_dma_sgiioc4, | 573 | .init_dma = ide_dma_sgiioc4, |
581 | .port_ops = &sgiioc4_port_ops, | 574 | .port_ops = &sgiioc4_port_ops, |
575 | .dma_ops = &sgiioc4_dma_ops, | ||
582 | .host_flags = IDE_HFLAG_NO_AUTOTUNE, | 576 | .host_flags = IDE_HFLAG_NO_AUTOTUNE, |
583 | .mwdma_mask = ATA_MWDMA2_ONLY, | 577 | .mwdma_mask = ATA_MWDMA2_ONLY, |
584 | }; | 578 | }; |