aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/at91_ide.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/at91_ide.c')
-rw-r--r--drivers/ide/at91_ide.c91
1 files changed, 3 insertions, 88 deletions
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c
index 8eda552326e9..403d0e4265db 100644
--- a/drivers/ide/at91_ide.c
+++ b/drivers/ide/at91_ide.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include <linux/version.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
25#include <linux/module.h> 24#include <linux/module.h>
26#include <linux/clk.h> 25#include <linux/clk.h>
@@ -175,90 +174,6 @@ static void at91_ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
175 leave_16bit(chipselect, mode); 174 leave_16bit(chipselect, mode);
176} 175}
177 176
178static u8 ide_mm_inb(unsigned long port)
179{
180 return readb((void __iomem *) port);
181}
182
183static void ide_mm_outb(u8 value, unsigned long port)
184{
185 writeb(value, (void __iomem *) port);
186}
187
188static void at91_ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
189{
190 ide_hwif_t *hwif = drive->hwif;
191 struct ide_io_ports *io_ports = &hwif->io_ports;
192 struct ide_taskfile *tf = &cmd->tf;
193 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
194
195 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
196 HIHI = 0xFF;
197
198 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
199 ide_mm_outb(tf->hob_feature, io_ports->feature_addr);
200 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
201 ide_mm_outb(tf->hob_nsect, io_ports->nsect_addr);
202 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL)
203 ide_mm_outb(tf->hob_lbal, io_ports->lbal_addr);
204 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM)
205 ide_mm_outb(tf->hob_lbam, io_ports->lbam_addr);
206 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH)
207 ide_mm_outb(tf->hob_lbah, io_ports->lbah_addr);
208
209 if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE)
210 ide_mm_outb(tf->feature, io_ports->feature_addr);
211 if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT)
212 ide_mm_outb(tf->nsect, io_ports->nsect_addr);
213 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL)
214 ide_mm_outb(tf->lbal, io_ports->lbal_addr);
215 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM)
216 ide_mm_outb(tf->lbam, io_ports->lbam_addr);
217 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH)
218 ide_mm_outb(tf->lbah, io_ports->lbah_addr);
219
220 if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE)
221 ide_mm_outb((tf->device & HIHI) | drive->select, io_ports->device_addr);
222}
223
224static void at91_ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
225{
226 ide_hwif_t *hwif = drive->hwif;
227 struct ide_io_ports *io_ports = &hwif->io_ports;
228 struct ide_taskfile *tf = &cmd->tf;
229
230 /* be sure we're looking at the low order bits */
231 ide_mm_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
232
233 if (cmd->tf_flags & IDE_TFLAG_IN_ERROR)
234 tf->error = ide_mm_inb(io_ports->feature_addr);
235 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT)
236 tf->nsect = ide_mm_inb(io_ports->nsect_addr);
237 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL)
238 tf->lbal = ide_mm_inb(io_ports->lbal_addr);
239 if (cmd->tf_flags & IDE_TFLAG_IN_LBAM)
240 tf->lbam = ide_mm_inb(io_ports->lbam_addr);
241 if (cmd->tf_flags & IDE_TFLAG_IN_LBAH)
242 tf->lbah = ide_mm_inb(io_ports->lbah_addr);
243 if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE)
244 tf->device = ide_mm_inb(io_ports->device_addr);
245
246 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
247 ide_mm_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
248
249 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR)
250 tf->hob_error = ide_mm_inb(io_ports->feature_addr);
251 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
252 tf->hob_nsect = ide_mm_inb(io_ports->nsect_addr);
253 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
254 tf->hob_lbal = ide_mm_inb(io_ports->lbal_addr);
255 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
256 tf->hob_lbam = ide_mm_inb(io_ports->lbam_addr);
257 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
258 tf->hob_lbah = ide_mm_inb(io_ports->lbah_addr);
259 }
260}
261
262static void at91_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) 177static void at91_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
263{ 178{
264 struct ide_timing *timing; 179 struct ide_timing *timing;
@@ -284,8 +199,8 @@ static const struct ide_tp_ops at91_ide_tp_ops = {
284 .write_devctl = ide_write_devctl, 199 .write_devctl = ide_write_devctl,
285 200
286 .dev_select = ide_dev_select, 201 .dev_select = ide_dev_select,
287 .tf_load = at91_ide_tf_load, 202 .tf_load = ide_tf_load,
288 .tf_read = at91_ide_tf_read, 203 .tf_read = ide_tf_read,
289 204
290 .input_data = at91_ide_input_data, 205 .input_data = at91_ide_input_data,
291 .output_data = at91_ide_output_data, 206 .output_data = at91_ide_output_data,
@@ -300,7 +215,7 @@ static const struct ide_port_info at91_ide_port_info __initdata = {
300 .tp_ops = &at91_ide_tp_ops, 215 .tp_ops = &at91_ide_tp_ops,
301 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA | IDE_HFLAG_SINGLE | 216 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA | IDE_HFLAG_SINGLE |
302 IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_UNMASK_IRQS, 217 IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_UNMASK_IRQS,
303 .pio_mask = ATA_PIO5, 218 .pio_mask = ATA_PIO6,
304}; 219};
305 220
306/* 221/*