aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2009-04-08 08:12:52 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-08 08:12:52 -0400
commitd68bab503e64e87c464c5a27a56877a04e4404b5 (patch)
tree3c4dff429fc6c8611d1f49f1860ad3ab8d42e8db /drivers/ide
parent805ec58ad7fd1f65eeb75ed38f11bd08fbd3b988 (diff)
tx493[89]ide: Remove big endian version of tx493[89]ide_tf_{load,read}
Now tx493[89]ide_tf_{load,read} do not contain word I/O operations. They are endian-free now. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>, Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/tx4938ide.c89
-rw-r--r--drivers/ide/tx4939ide.c99
2 files changed, 8 insertions, 180 deletions
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index 4cb79c4c2604..e33d764e2945 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -72,91 +72,6 @@ static void tx4938ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
72#ifdef __BIG_ENDIAN 72#ifdef __BIG_ENDIAN
73 73
74/* custom iops (independent from SWAP_IO_SPACE) */ 74/* custom iops (independent from SWAP_IO_SPACE) */
75static u8 tx4938ide_inb(unsigned long port)
76{
77 return __raw_readb((void __iomem *)port);
78}
79
80static void tx4938ide_outb(u8 value, unsigned long port)
81{
82 __raw_writeb(value, (void __iomem *)port);
83}
84
85static void tx4938ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
86{
87 ide_hwif_t *hwif = drive->hwif;
88 struct ide_io_ports *io_ports = &hwif->io_ports;
89 struct ide_taskfile *tf = &cmd->tf;
90 u8 HIHI = cmd->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF;
91
92 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
93 HIHI = 0xFF;
94
95 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
96 tx4938ide_outb(tf->hob_feature, io_ports->feature_addr);
97 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
98 tx4938ide_outb(tf->hob_nsect, io_ports->nsect_addr);
99 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL)
100 tx4938ide_outb(tf->hob_lbal, io_ports->lbal_addr);
101 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM)
102 tx4938ide_outb(tf->hob_lbam, io_ports->lbam_addr);
103 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH)
104 tx4938ide_outb(tf->hob_lbah, io_ports->lbah_addr);
105
106 if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE)
107 tx4938ide_outb(tf->feature, io_ports->feature_addr);
108 if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT)
109 tx4938ide_outb(tf->nsect, io_ports->nsect_addr);
110 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL)
111 tx4938ide_outb(tf->lbal, io_ports->lbal_addr);
112 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM)
113 tx4938ide_outb(tf->lbam, io_ports->lbam_addr);
114 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH)
115 tx4938ide_outb(tf->lbah, io_ports->lbah_addr);
116
117 if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE)
118 tx4938ide_outb((tf->device & HIHI) | drive->select,
119 io_ports->device_addr);
120}
121
122static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
123{
124 ide_hwif_t *hwif = drive->hwif;
125 struct ide_io_ports *io_ports = &hwif->io_ports;
126 struct ide_taskfile *tf = &cmd->tf;
127
128 /* be sure we're looking at the low order bits */
129 tx4938ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
130
131 if (cmd->tf_flags & IDE_TFLAG_IN_ERROR)
132 tf->error = tx4938ide_inb(io_ports->feature_addr);
133 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT)
134 tf->nsect = tx4938ide_inb(io_ports->nsect_addr);
135 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL)
136 tf->lbal = tx4938ide_inb(io_ports->lbal_addr);
137 if (cmd->tf_flags & IDE_TFLAG_IN_LBAM)
138 tf->lbam = tx4938ide_inb(io_ports->lbam_addr);
139 if (cmd->tf_flags & IDE_TFLAG_IN_LBAH)
140 tf->lbah = tx4938ide_inb(io_ports->lbah_addr);
141 if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE)
142 tf->device = tx4938ide_inb(io_ports->device_addr);
143
144 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
145 tx4938ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
146
147 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR)
148 tf->hob_error = tx4938ide_inb(io_ports->feature_addr);
149 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
150 tf->hob_nsect = tx4938ide_inb(io_ports->nsect_addr);
151 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
152 tf->hob_lbal = tx4938ide_inb(io_ports->lbal_addr);
153 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
154 tf->hob_lbam = tx4938ide_inb(io_ports->lbam_addr);
155 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
156 tf->hob_lbah = tx4938ide_inb(io_ports->lbah_addr);
157 }
158}
159
160static void tx4938ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, 75static void tx4938ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd,
161 void *buf, unsigned int len) 76 void *buf, unsigned int len)
162{ 77{
@@ -190,8 +105,8 @@ static const struct ide_tp_ops tx4938ide_tp_ops = {
190 .write_devctl = ide_write_devctl, 105 .write_devctl = ide_write_devctl,
191 106
192 .dev_select = ide_dev_select, 107 .dev_select = ide_dev_select,
193 .tf_load = tx4938ide_tf_load, 108 .tf_load = ide_tf_load,
194 .tf_read = tx4938ide_tf_read, 109 .tf_read = ide_tf_read,
195 110
196 .input_data = tx4938ide_input_data_swap, 111 .input_data = tx4938ide_input_data_swap,
197 .output_data = tx4938ide_output_data_swap, 112 .output_data = tx4938ide_output_data_swap,
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,