aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/tx4939ide.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/tx4939ide.c')
-rw-r--r--drivers/ide/tx4939ide.c99
1 files changed, 6 insertions, 93 deletions
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index 2e27fcd41864..f9b68783d393 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -434,96 +434,17 @@ 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
438
439/* custom iops (independent from SWAP_IO_SPACE) */
440static u8 tx4939ide_inb(unsigned long port)
441{
442 return __raw_readb((void __iomem *)port);
443}
444
445static void tx4939ide_outb(u8 value, unsigned long port)
446{
447 __raw_writeb(value, (void __iomem *)port);
448}
449
450static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) 437static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
451{ 438{
452 ide_hwif_t *hwif = drive->hwif; 439 ide_tf_load(drive, cmd);
453 struct ide_io_ports *io_ports = &hwif->io_ports; 440
454 struct ide_taskfile *tf = &cmd->tf; 441 if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE)
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); 442 tx4939ide_tf_load_fixup(drive);
486 }
487} 443}
488 444
489static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) 445#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 446
447/* custom iops (independent from SWAP_IO_SPACE) */
527static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, 448static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq,
528 void *buf, unsigned int len) 449 void *buf, unsigned int len)
529{ 450{
@@ -558,7 +479,7 @@ static const struct ide_tp_ops tx4939ide_tp_ops = {
558 479
559 .dev_select = ide_dev_select, 480 .dev_select = ide_dev_select,
560 .tf_load = tx4939ide_tf_load, 481 .tf_load = tx4939ide_tf_load,
561 .tf_read = tx4939ide_tf_read, 482 .tf_read = ide_tf_read,
562 483
563 .input_data = tx4939ide_input_data_swap, 484 .input_data = tx4939ide_input_data_swap,
564 .output_data = tx4939ide_output_data_swap, 485 .output_data = tx4939ide_output_data_swap,
@@ -566,14 +487,6 @@ static const struct ide_tp_ops tx4939ide_tp_ops = {
566 487
567#else /* __LITTLE_ENDIAN */ 488#else /* __LITTLE_ENDIAN */
568 489
569static 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
577static const struct ide_tp_ops tx4939ide_tp_ops = { 490static const struct ide_tp_ops tx4939ide_tp_ops = {
578 .exec_command = ide_exec_command, 491 .exec_command = ide_exec_command,
579 .read_status = ide_read_status, 492 .read_status = ide_read_status,