diff options
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r-- | drivers/ide/ide-iops.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 0daf923541ff..80ad4f234f3f 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -42,7 +42,7 @@ static void ide_outb (u8 val, unsigned long port) | |||
42 | outb(val, port); | 42 | outb(val, port); |
43 | } | 43 | } |
44 | 44 | ||
45 | static void ide_outbsync (ide_drive_t *drive, u8 addr, unsigned long port) | 45 | static void ide_outbsync(ide_hwif_t *hwif, u8 addr, unsigned long port) |
46 | { | 46 | { |
47 | outb(addr, port); | 47 | outb(addr, port); |
48 | } | 48 | } |
@@ -68,7 +68,7 @@ static void ide_mm_outb (u8 value, unsigned long port) | |||
68 | writeb(value, (void __iomem *) port); | 68 | writeb(value, (void __iomem *) port); |
69 | } | 69 | } |
70 | 70 | ||
71 | static void ide_mm_outbsync (ide_drive_t *drive, u8 value, unsigned long port) | 71 | static void ide_mm_outbsync(ide_hwif_t *hwif, u8 value, unsigned long port) |
72 | { | 72 | { |
73 | writeb(value, (void __iomem *) port); | 73 | writeb(value, (void __iomem *) port); |
74 | } | 74 | } |
@@ -95,7 +95,7 @@ void SELECT_DRIVE (ide_drive_t *drive) | |||
95 | hwif->OUTB(drive->select.all, hwif->io_ports.device_addr); | 95 | hwif->OUTB(drive->select.all, hwif->io_ports.device_addr); |
96 | } | 96 | } |
97 | 97 | ||
98 | static void SELECT_MASK(ide_drive_t *drive, int mask) | 98 | void SELECT_MASK(ide_drive_t *drive, int mask) |
99 | { | 99 | { |
100 | const struct ide_port_ops *port_ops = drive->hwif->port_ops; | 100 | const struct ide_port_ops *port_ops = drive->hwif->port_ops; |
101 | 101 | ||
@@ -120,11 +120,6 @@ static void ide_tf_load(ide_drive_t *drive, ide_task_t *task) | |||
120 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 120 | if (task->tf_flags & IDE_TFLAG_FLAGGED) |
121 | HIHI = 0xFF; | 121 | HIHI = 0xFF; |
122 | 122 | ||
123 | ide_set_irq(drive, 1); | ||
124 | |||
125 | if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0) | ||
126 | SELECT_MASK(drive, 0); | ||
127 | |||
128 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) { | 123 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) { |
129 | u16 data = (tf->hob_data << 8) | tf->data; | 124 | u16 data = (tf->hob_data << 8) | tf->data; |
130 | 125 | ||
@@ -191,7 +186,7 @@ static void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
191 | } | 186 | } |
192 | 187 | ||
193 | /* be sure we're looking at the low order bits */ | 188 | /* be sure we're looking at the low order bits */ |
194 | tf_outb(drive->ctl & ~0x80, io_ports->ctl_addr); | 189 | tf_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
195 | 190 | ||
196 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 191 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) |
197 | tf->nsect = tf_inb(io_ports->nsect_addr); | 192 | tf->nsect = tf_inb(io_ports->nsect_addr); |
@@ -205,7 +200,7 @@ static void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
205 | tf->device = tf_inb(io_ports->device_addr); | 200 | tf->device = tf_inb(io_ports->device_addr); |
206 | 201 | ||
207 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 202 | if (task->tf_flags & IDE_TFLAG_LBA48) { |
208 | tf_outb(drive->ctl | 0x80, io_ports->ctl_addr); | 203 | tf_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); |
209 | 204 | ||
210 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 205 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
211 | tf->hob_feature = tf_inb(io_ports->feature_addr); | 206 | tf->hob_feature = tf_inb(io_ports->feature_addr); |
@@ -689,9 +684,9 @@ int ide_driveid_update(ide_drive_t *drive) | |||
689 | */ | 684 | */ |
690 | 685 | ||
691 | SELECT_MASK(drive, 1); | 686 | SELECT_MASK(drive, 1); |
692 | ide_set_irq(drive, 1); | 687 | ide_set_irq(drive, 0); |
693 | msleep(50); | 688 | msleep(50); |
694 | hwif->OUTBSYNC(drive, WIN_IDENTIFY, hwif->io_ports.command_addr); | 689 | hwif->OUTBSYNC(hwif, WIN_IDENTIFY, hwif->io_ports.command_addr); |
695 | timeout = jiffies + WAIT_WORSTCASE; | 690 | timeout = jiffies + WAIT_WORSTCASE; |
696 | do { | 691 | do { |
697 | if (time_after(jiffies, timeout)) { | 692 | if (time_after(jiffies, timeout)) { |
@@ -744,9 +739,6 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
744 | int error = 0; | 739 | int error = 0; |
745 | u8 stat; | 740 | u8 stat; |
746 | 741 | ||
747 | // while (HWGROUP(drive)->busy) | ||
748 | // msleep(50); | ||
749 | |||
750 | #ifdef CONFIG_BLK_DEV_IDEDMA | 742 | #ifdef CONFIG_BLK_DEV_IDEDMA |
751 | if (hwif->dma_ops) /* check if host supports DMA */ | 743 | if (hwif->dma_ops) /* check if host supports DMA */ |
752 | hwif->dma_ops->dma_host_set(drive, 0); | 744 | hwif->dma_ops->dma_host_set(drive, 0); |
@@ -781,7 +773,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
781 | ide_set_irq(drive, 0); | 773 | ide_set_irq(drive, 0); |
782 | hwif->OUTB(speed, io_ports->nsect_addr); | 774 | hwif->OUTB(speed, io_ports->nsect_addr); |
783 | hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr); | 775 | hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr); |
784 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, io_ports->command_addr); | 776 | hwif->OUTBSYNC(hwif, WIN_SETFEATURES, io_ports->command_addr); |
785 | if (drive->quirk_list == 2) | 777 | if (drive->quirk_list == 2) |
786 | ide_set_irq(drive, 1); | 778 | ide_set_irq(drive, 1); |
787 | 779 | ||
@@ -889,7 +881,7 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | |||
889 | 881 | ||
890 | spin_lock_irqsave(&ide_lock, flags); | 882 | spin_lock_irqsave(&ide_lock, flags); |
891 | __ide_set_handler(drive, handler, timeout, expiry); | 883 | __ide_set_handler(drive, handler, timeout, expiry); |
892 | hwif->OUTBSYNC(drive, cmd, hwif->io_ports.command_addr); | 884 | hwif->OUTBSYNC(hwif, cmd, hwif->io_ports.command_addr); |
893 | /* | 885 | /* |
894 | * Drive takes 400nS to respond, we must avoid the IRQ being | 886 | * Drive takes 400nS to respond, we must avoid the IRQ being |
895 | * serviced before that. | 887 | * serviced before that. |
@@ -907,7 +899,7 @@ void ide_execute_pkt_cmd(ide_drive_t *drive) | |||
907 | unsigned long flags; | 899 | unsigned long flags; |
908 | 900 | ||
909 | spin_lock_irqsave(&ide_lock, flags); | 901 | spin_lock_irqsave(&ide_lock, flags); |
910 | hwif->OUTBSYNC(drive, WIN_PACKETCMD, hwif->io_ports.command_addr); | 902 | hwif->OUTBSYNC(hwif, WIN_PACKETCMD, hwif->io_ports.command_addr); |
911 | ndelay(400); | 903 | ndelay(400); |
912 | spin_unlock_irqrestore(&ide_lock, flags); | 904 | spin_unlock_irqrestore(&ide_lock, flags); |
913 | } | 905 | } |
@@ -1102,7 +1094,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1102 | pre_reset(drive); | 1094 | pre_reset(drive); |
1103 | SELECT_DRIVE(drive); | 1095 | SELECT_DRIVE(drive); |
1104 | udelay (20); | 1096 | udelay (20); |
1105 | hwif->OUTBSYNC(drive, WIN_SRST, io_ports->command_addr); | 1097 | hwif->OUTBSYNC(hwif, WIN_SRST, io_ports->command_addr); |
1106 | ndelay(400); | 1098 | ndelay(400); |
1107 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1099 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |
1108 | hwgroup->polling = 1; | 1100 | hwgroup->polling = 1; |
@@ -1133,14 +1125,14 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1133 | * recover from reset very quickly, saving us the first 50ms wait time. | 1125 | * recover from reset very quickly, saving us the first 50ms wait time. |
1134 | */ | 1126 | */ |
1135 | /* set SRST and nIEN */ | 1127 | /* set SRST and nIEN */ |
1136 | hwif->OUTBSYNC(drive, drive->ctl|6, io_ports->ctl_addr); | 1128 | hwif->OUTBSYNC(hwif, ATA_DEVCTL_OBS | 6, io_ports->ctl_addr); |
1137 | /* more than enough time */ | 1129 | /* more than enough time */ |
1138 | udelay(10); | 1130 | udelay(10); |
1139 | if (drive->quirk_list == 2) | 1131 | if (drive->quirk_list == 2) |
1140 | ctl = drive->ctl; /* clear SRST and nIEN */ | 1132 | ctl = ATA_DEVCTL_OBS; /* clear SRST and nIEN */ |
1141 | else | 1133 | else |
1142 | ctl = drive->ctl | 2; /* clear SRST, leave nIEN */ | 1134 | ctl = ATA_DEVCTL_OBS | 2; /* clear SRST, leave nIEN */ |
1143 | hwif->OUTBSYNC(drive, ctl, io_ports->ctl_addr); | 1135 | hwif->OUTBSYNC(hwif, ctl, io_ports->ctl_addr); |
1144 | /* more than enough time */ | 1136 | /* more than enough time */ |
1145 | udelay(10); | 1137 | udelay(10); |
1146 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1138 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |