diff options
Diffstat (limited to 'drivers/ide/tx4939ide.c')
-rw-r--r-- | drivers/ide/tx4939ide.c | 110 |
1 files changed, 12 insertions, 98 deletions
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 0040a9a3e26e..564422d23976 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c | |||
@@ -327,15 +327,15 @@ static int tx4939ide_dma_end(ide_drive_t *drive) | |||
327 | /* read and clear the INTR & ERROR bits */ | 327 | /* read and clear the INTR & ERROR bits */ |
328 | dma_stat = tx4939ide_clear_dma_status(base); | 328 | dma_stat = tx4939ide_clear_dma_status(base); |
329 | 329 | ||
330 | wmb(); | 330 | #define CHECK_DMA_MASK (ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR) |
331 | 331 | ||
332 | /* verify good DMA status */ | 332 | /* verify good DMA status */ |
333 | if ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) == 0 && | 333 | if ((dma_stat & CHECK_DMA_MASK) == 0 && |
334 | (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == | 334 | (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == |
335 | (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) | 335 | (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) |
336 | /* INT_IDE lost... bug? */ | 336 | /* INT_IDE lost... bug? */ |
337 | return 0; | 337 | return 0; |
338 | return ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) != | 338 | return ((dma_stat & CHECK_DMA_MASK) != |
339 | ATA_DMA_INTR) ? 0x10 | dma_stat : 0; | 339 | ATA_DMA_INTR) ? 0x10 | dma_stat : 0; |
340 | } | 340 | } |
341 | 341 | ||
@@ -434,97 +434,19 @@ static void tx4939ide_tf_load_fixup(ide_drive_t *drive) | |||
434 | tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); | 434 | tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); |
435 | } | 435 | } |
436 | 436 | ||
437 | #ifdef __BIG_ENDIAN | 437 | static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, |
438 | 438 | u8 valid) | |
439 | /* custom iops (independent from SWAP_IO_SPACE) */ | ||
440 | static u8 tx4939ide_inb(unsigned long port) | ||
441 | { | 439 | { |
442 | return __raw_readb((void __iomem *)port); | 440 | ide_tf_load(drive, tf, valid); |
443 | } | ||
444 | 441 | ||
445 | static void tx4939ide_outb(u8 value, unsigned long port) | 442 | if (valid & IDE_VALID_DEVICE) |
446 | { | ||
447 | __raw_writeb(value, (void __iomem *)port); | ||
448 | } | ||
449 | |||
450 | static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | ||
451 | { | ||
452 | ide_hwif_t *hwif = drive->hwif; | ||
453 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
454 | struct ide_taskfile *tf = &cmd->tf; | ||
455 | u8 HIHI = cmd->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; | ||
456 | |||
457 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) | ||
458 | HIHI = 0xFF; | ||
459 | |||
460 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | ||
461 | tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); | ||
462 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | ||
463 | tx4939ide_outb(tf->hob_nsect, io_ports->nsect_addr); | ||
464 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | ||
465 | tx4939ide_outb(tf->hob_lbal, io_ports->lbal_addr); | ||
466 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | ||
467 | tx4939ide_outb(tf->hob_lbam, io_ports->lbam_addr); | ||
468 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | ||
469 | tx4939ide_outb(tf->hob_lbah, io_ports->lbah_addr); | ||
470 | |||
471 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) | ||
472 | tx4939ide_outb(tf->feature, io_ports->feature_addr); | ||
473 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) | ||
474 | tx4939ide_outb(tf->nsect, io_ports->nsect_addr); | ||
475 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) | ||
476 | tx4939ide_outb(tf->lbal, io_ports->lbal_addr); | ||
477 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) | ||
478 | tx4939ide_outb(tf->lbam, io_ports->lbam_addr); | ||
479 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) | ||
480 | tx4939ide_outb(tf->lbah, io_ports->lbah_addr); | ||
481 | |||
482 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) { | ||
483 | tx4939ide_outb((tf->device & HIHI) | drive->select, | ||
484 | io_ports->device_addr); | ||
485 | tx4939ide_tf_load_fixup(drive); | 443 | tx4939ide_tf_load_fixup(drive); |
486 | } | ||
487 | } | 444 | } |
488 | 445 | ||
489 | static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | 446 | #ifdef __BIG_ENDIAN |
490 | { | ||
491 | ide_hwif_t *hwif = drive->hwif; | ||
492 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
493 | struct ide_taskfile *tf = &cmd->tf; | ||
494 | |||
495 | /* be sure we're looking at the low order bits */ | ||
496 | tx4939ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
497 | |||
498 | if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) | ||
499 | tf->error = tx4939ide_inb(io_ports->feature_addr); | ||
500 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) | ||
501 | tf->nsect = tx4939ide_inb(io_ports->nsect_addr); | ||
502 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) | ||
503 | tf->lbal = tx4939ide_inb(io_ports->lbal_addr); | ||
504 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) | ||
505 | tf->lbam = tx4939ide_inb(io_ports->lbam_addr); | ||
506 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) | ||
507 | tf->lbah = tx4939ide_inb(io_ports->lbah_addr); | ||
508 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) | ||
509 | tf->device = tx4939ide_inb(io_ports->device_addr); | ||
510 | |||
511 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
512 | tx4939ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
513 | |||
514 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) | ||
515 | tf->hob_error = tx4939ide_inb(io_ports->feature_addr); | ||
516 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
517 | tf->hob_nsect = tx4939ide_inb(io_ports->nsect_addr); | ||
518 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
519 | tf->hob_lbal = tx4939ide_inb(io_ports->lbal_addr); | ||
520 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
521 | tf->hob_lbam = tx4939ide_inb(io_ports->lbam_addr); | ||
522 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
523 | tf->hob_lbah = tx4939ide_inb(io_ports->lbah_addr); | ||
524 | } | ||
525 | } | ||
526 | 447 | ||
527 | static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, | 448 | /* custom iops (independent from SWAP_IO_SPACE) */ |
449 | static void tx4939ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, | ||
528 | void *buf, unsigned int len) | 450 | void *buf, unsigned int len) |
529 | { | 451 | { |
530 | unsigned long port = drive->hwif->io_ports.data_addr; | 452 | unsigned long port = drive->hwif->io_ports.data_addr; |
@@ -536,7 +458,7 @@ static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, | |||
536 | __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); | 458 | __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); |
537 | } | 459 | } |
538 | 460 | ||
539 | static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request *rq, | 461 | static void tx4939ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, |
540 | void *buf, unsigned int len) | 462 | void *buf, unsigned int len) |
541 | { | 463 | { |
542 | unsigned long port = drive->hwif->io_ports.data_addr; | 464 | unsigned long port = drive->hwif->io_ports.data_addr; |
@@ -558,7 +480,7 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { | |||
558 | 480 | ||
559 | .dev_select = ide_dev_select, | 481 | .dev_select = ide_dev_select, |
560 | .tf_load = tx4939ide_tf_load, | 482 | .tf_load = tx4939ide_tf_load, |
561 | .tf_read = tx4939ide_tf_read, | 483 | .tf_read = ide_tf_read, |
562 | 484 | ||
563 | .input_data = tx4939ide_input_data_swap, | 485 | .input_data = tx4939ide_input_data_swap, |
564 | .output_data = tx4939ide_output_data_swap, | 486 | .output_data = tx4939ide_output_data_swap, |
@@ -566,14 +488,6 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { | |||
566 | 488 | ||
567 | #else /* __LITTLE_ENDIAN */ | 489 | #else /* __LITTLE_ENDIAN */ |
568 | 490 | ||
569 | static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | ||
570 | { | ||
571 | ide_tf_load(drive, cmd); | ||
572 | |||
573 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) | ||
574 | tx4939ide_tf_load_fixup(drive); | ||
575 | } | ||
576 | |||
577 | static const struct ide_tp_ops tx4939ide_tp_ops = { | 491 | static const struct ide_tp_ops tx4939ide_tp_ops = { |
578 | .exec_command = ide_exec_command, | 492 | .exec_command = ide_exec_command, |
579 | .read_status = ide_read_status, | 493 | .read_status = ide_read_status, |