aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/tx4938ide.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/tx4938ide.c')
-rw-r--r--drivers/ide/tx4938ide.c89
1 files changed, 2 insertions, 87 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,