diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:50 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:50 -0400 |
commit | ab86f91e8739e0b1587a16e4792ab5e4bb11f1b5 (patch) | |
tree | aa5696bb69c471fda2a21f6ce952de0705a1c152 /drivers/ide/ide-dma.c | |
parent | b2f951aabc9cc7d5fb987aeec9aef96ccce618a5 (diff) |
ide: use I/O ops directly in ide-dma.c
Use I/O ops directly in ide_dma_host_set(), ide_dma_setup(),
ide_dma_start() and __ide_dma_end().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r-- | drivers/ide/ide-dma.c | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index ebddedde24af..f3229642c052 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -376,7 +376,10 @@ void ide_dma_host_set(ide_drive_t *drive, int on) | |||
376 | else | 376 | else |
377 | dma_stat &= ~(1 << (5 + unit)); | 377 | dma_stat &= ~(1 << (5 + unit)); |
378 | 378 | ||
379 | hwif->OUTB(dma_stat, hwif->dma_status); | 379 | if (hwif->host_flags & IDE_HFLAG_MMIO) |
380 | writeb(dma_stat, (void __iomem *)hwif->dma_status); | ||
381 | else | ||
382 | outb(dma_stat, hwif->dma_status); | ||
380 | } | 383 | } |
381 | 384 | ||
382 | EXPORT_SYMBOL_GPL(ide_dma_host_set); | 385 | EXPORT_SYMBOL_GPL(ide_dma_host_set); |
@@ -449,6 +452,7 @@ int ide_dma_setup(ide_drive_t *drive) | |||
449 | ide_hwif_t *hwif = drive->hwif; | 452 | ide_hwif_t *hwif = drive->hwif; |
450 | struct request *rq = HWGROUP(drive)->rq; | 453 | struct request *rq = HWGROUP(drive)->rq; |
451 | unsigned int reading; | 454 | unsigned int reading; |
455 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | ||
452 | u8 dma_stat; | 456 | u8 dma_stat; |
453 | 457 | ||
454 | if (rq_data_dir(rq)) | 458 | if (rq_data_dir(rq)) |
@@ -470,13 +474,20 @@ int ide_dma_setup(ide_drive_t *drive) | |||
470 | outl(hwif->dmatable_dma, hwif->dma_base + ATA_DMA_TABLE_OFS); | 474 | outl(hwif->dmatable_dma, hwif->dma_base + ATA_DMA_TABLE_OFS); |
471 | 475 | ||
472 | /* specify r/w */ | 476 | /* specify r/w */ |
473 | hwif->OUTB(reading, hwif->dma_command); | 477 | if (mmio) |
478 | writeb(reading, (void __iomem *)hwif->dma_command); | ||
479 | else | ||
480 | outb(reading, hwif->dma_command); | ||
474 | 481 | ||
475 | /* read DMA status for INTR & ERROR flags */ | 482 | /* read DMA status for INTR & ERROR flags */ |
476 | dma_stat = hwif->read_sff_dma_status(hwif); | 483 | dma_stat = hwif->read_sff_dma_status(hwif); |
477 | 484 | ||
478 | /* clear INTR & ERROR flags */ | 485 | /* clear INTR & ERROR flags */ |
479 | hwif->OUTB(dma_stat|6, hwif->dma_status); | 486 | if (mmio) |
487 | writeb(dma_stat | 6, (void __iomem *)hwif->dma_status); | ||
488 | else | ||
489 | outb(dma_stat | 6, hwif->dma_status); | ||
490 | |||
480 | drive->waiting_for_dma = 1; | 491 | drive->waiting_for_dma = 1; |
481 | return 0; | 492 | return 0; |
482 | } | 493 | } |
@@ -492,16 +503,23 @@ EXPORT_SYMBOL_GPL(ide_dma_exec_cmd); | |||
492 | 503 | ||
493 | void ide_dma_start(ide_drive_t *drive) | 504 | void ide_dma_start(ide_drive_t *drive) |
494 | { | 505 | { |
495 | ide_hwif_t *hwif = HWIF(drive); | 506 | ide_hwif_t *hwif = drive->hwif; |
496 | u8 dma_cmd = hwif->INB(hwif->dma_command); | 507 | u8 dma_cmd; |
497 | 508 | ||
498 | /* Note that this is done *after* the cmd has | 509 | /* Note that this is done *after* the cmd has |
499 | * been issued to the drive, as per the BM-IDE spec. | 510 | * been issued to the drive, as per the BM-IDE spec. |
500 | * The Promise Ultra33 doesn't work correctly when | 511 | * The Promise Ultra33 doesn't work correctly when |
501 | * we do this part before issuing the drive cmd. | 512 | * we do this part before issuing the drive cmd. |
502 | */ | 513 | */ |
503 | /* start DMA */ | 514 | if (hwif->host_flags & IDE_HFLAG_MMIO) { |
504 | hwif->OUTB(dma_cmd|1, hwif->dma_command); | 515 | dma_cmd = readb((void __iomem *)hwif->dma_command); |
516 | /* start DMA */ | ||
517 | writeb(dma_cmd | 1, (void __iomem *)hwif->dma_command); | ||
518 | } else { | ||
519 | dma_cmd = inb(hwif->dma_command); | ||
520 | outb(dma_cmd | 1, hwif->dma_command); | ||
521 | } | ||
522 | |||
505 | hwif->dma = 1; | 523 | hwif->dma = 1; |
506 | wmb(); | 524 | wmb(); |
507 | } | 525 | } |
@@ -511,18 +529,31 @@ EXPORT_SYMBOL_GPL(ide_dma_start); | |||
511 | /* returns 1 on error, 0 otherwise */ | 529 | /* returns 1 on error, 0 otherwise */ |
512 | int __ide_dma_end (ide_drive_t *drive) | 530 | int __ide_dma_end (ide_drive_t *drive) |
513 | { | 531 | { |
514 | ide_hwif_t *hwif = HWIF(drive); | 532 | ide_hwif_t *hwif = drive->hwif; |
533 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | ||
515 | u8 dma_stat = 0, dma_cmd = 0; | 534 | u8 dma_stat = 0, dma_cmd = 0; |
516 | 535 | ||
517 | drive->waiting_for_dma = 0; | 536 | drive->waiting_for_dma = 0; |
518 | /* get dma_command mode */ | 537 | |
519 | dma_cmd = hwif->INB(hwif->dma_command); | 538 | if (mmio) { |
520 | /* stop DMA */ | 539 | /* get DMA command mode */ |
521 | hwif->OUTB(dma_cmd&~1, hwif->dma_command); | 540 | dma_cmd = readb((void __iomem *)hwif->dma_command); |
541 | /* stop DMA */ | ||
542 | writeb(dma_cmd & ~1, (void __iomem *)hwif->dma_command); | ||
543 | } else { | ||
544 | dma_cmd = inb(hwif->dma_command); | ||
545 | outb(dma_cmd & ~1, hwif->dma_command); | ||
546 | } | ||
547 | |||
522 | /* get DMA status */ | 548 | /* get DMA status */ |
523 | dma_stat = hwif->read_sff_dma_status(hwif); | 549 | dma_stat = hwif->read_sff_dma_status(hwif); |
524 | /* clear the INTR & ERROR bits */ | 550 | |
525 | hwif->OUTB(dma_stat|6, hwif->dma_status); | 551 | if (mmio) |
552 | /* clear the INTR & ERROR bits */ | ||
553 | writeb(dma_stat | 6, (void __iomem *)hwif->dma_status); | ||
554 | else | ||
555 | outb(dma_stat | 6, hwif->dma_status); | ||
556 | |||
526 | /* purge DMA mappings */ | 557 | /* purge DMA mappings */ |
527 | ide_destroy_dmatable(drive); | 558 | ide_destroy_dmatable(drive); |
528 | /* verify good DMA status */ | 559 | /* verify good DMA status */ |