aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-iops.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:51 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:51 -0400
commitc6dfa867bb45f4bff2e48f3bc89ab1d6a7ab4c21 (patch)
tree54d9322fad75e48fb548e182fbb87d06a06cd048 /drivers/ide/ide-iops.c
parentebb00fb55d0566bb3e81518122a57b4b3bedf1e4 (diff)
ide: add ->exec_command method
Add ->exec_command method for writing ATA Command register and use it instead of ->OUTBSYNC. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r--drivers/ide/ide-iops.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 17cad6c39ee3..d8db25581909 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -103,6 +103,14 @@ void SELECT_MASK(ide_drive_t *drive, int mask)
103 port_ops->maskproc(drive, mask); 103 port_ops->maskproc(drive, mask);
104} 104}
105 105
106static void ide_exec_command(ide_hwif_t *hwif, u8 cmd)
107{
108 if (hwif->host_flags & IDE_HFLAG_MMIO)
109 writeb(cmd, (void __iomem *)hwif->io_ports.command_addr);
110 else
111 outb(cmd, hwif->io_ports.command_addr);
112}
113
106static u8 ide_read_sff_dma_status(ide_hwif_t *hwif) 114static u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
107{ 115{
108 if (hwif->host_flags & IDE_HFLAG_MMIO) 116 if (hwif->host_flags & IDE_HFLAG_MMIO)
@@ -331,6 +339,7 @@ static void ata_output_data(ide_drive_t *drive, struct request *rq,
331 339
332void default_hwif_transport(ide_hwif_t *hwif) 340void default_hwif_transport(ide_hwif_t *hwif)
333{ 341{
342 hwif->exec_command = ide_exec_command;
334 hwif->read_sff_dma_status = ide_read_sff_dma_status; 343 hwif->read_sff_dma_status = ide_read_sff_dma_status;
335 344
336 hwif->tf_load = ide_tf_load; 345 hwif->tf_load = ide_tf_load;
@@ -696,7 +705,7 @@ int ide_driveid_update(ide_drive_t *drive)
696 SELECT_MASK(drive, 1); 705 SELECT_MASK(drive, 1);
697 ide_set_irq(drive, 0); 706 ide_set_irq(drive, 0);
698 msleep(50); 707 msleep(50);
699 hwif->OUTBSYNC(hwif, WIN_IDENTIFY, hwif->io_ports.command_addr); 708 hwif->exec_command(hwif, WIN_IDENTIFY);
700 timeout = jiffies + WAIT_WORSTCASE; 709 timeout = jiffies + WAIT_WORSTCASE;
701 do { 710 do {
702 if (time_after(jiffies, timeout)) { 711 if (time_after(jiffies, timeout)) {
@@ -783,7 +792,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
783 ide_set_irq(drive, 0); 792 ide_set_irq(drive, 0);
784 hwif->OUTB(speed, io_ports->nsect_addr); 793 hwif->OUTB(speed, io_ports->nsect_addr);
785 hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr); 794 hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr);
786 hwif->OUTBSYNC(hwif, WIN_SETFEATURES, io_ports->command_addr); 795 hwif->exec_command(hwif, WIN_SETFEATURES);
787 if (drive->quirk_list == 2) 796 if (drive->quirk_list == 2)
788 ide_set_irq(drive, 1); 797 ide_set_irq(drive, 1);
789 798
@@ -891,7 +900,7 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler,
891 900
892 spin_lock_irqsave(&ide_lock, flags); 901 spin_lock_irqsave(&ide_lock, flags);
893 __ide_set_handler(drive, handler, timeout, expiry); 902 __ide_set_handler(drive, handler, timeout, expiry);
894 hwif->OUTBSYNC(hwif, cmd, hwif->io_ports.command_addr); 903 hwif->exec_command(hwif, cmd);
895 /* 904 /*
896 * Drive takes 400nS to respond, we must avoid the IRQ being 905 * Drive takes 400nS to respond, we must avoid the IRQ being
897 * serviced before that. 906 * serviced before that.
@@ -909,7 +918,7 @@ void ide_execute_pkt_cmd(ide_drive_t *drive)
909 unsigned long flags; 918 unsigned long flags;
910 919
911 spin_lock_irqsave(&ide_lock, flags); 920 spin_lock_irqsave(&ide_lock, flags);
912 hwif->OUTBSYNC(hwif, WIN_PACKETCMD, hwif->io_ports.command_addr); 921 hwif->exec_command(hwif, WIN_PACKETCMD);
913 ndelay(400); 922 ndelay(400);
914 spin_unlock_irqrestore(&ide_lock, flags); 923 spin_unlock_irqrestore(&ide_lock, flags);
915} 924}
@@ -1116,7 +1125,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1116 pre_reset(drive); 1125 pre_reset(drive);
1117 SELECT_DRIVE(drive); 1126 SELECT_DRIVE(drive);
1118 udelay (20); 1127 udelay (20);
1119 hwif->OUTBSYNC(hwif, WIN_SRST, io_ports->command_addr); 1128 hwif->exec_command(hwif, WIN_SRST);
1120 ndelay(400); 1129 ndelay(400);
1121 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; 1130 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
1122 hwgroup->polling = 1; 1131 hwgroup->polling = 1;