diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-04 11:36:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-04 11:36:56 -0400 |
commit | 246dd412d31e4f5de1d43aa6422a325b785f36e4 (patch) | |
tree | 404b0a126f523abd526daaf02846958a2647907c | |
parent | 2d9b57fbec9fde4deea3686f3927204efa218c7f (diff) | |
parent | a57c1bade5a0ee5cd8b74502db9cbebb7f5780b2 (diff) |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
libata-sff: Fix oops reported in kerneloops.org for pnp devices with no ctl
libata: kill unused constants
sata_mv: PHY_MODE4 cleanups
[libata] ata_piix: more acer short cable quirks
[libata] ACPI: Properly handle bay devices in dock stations
-rw-r--r-- | drivers/ata/ata_piix.c | 2 | ||||
-rw-r--r-- | drivers/ata/libata-acpi.c | 165 | ||||
-rw-r--r-- | drivers/ata/libata-sff.c | 115 | ||||
-rw-r--r-- | drivers/ata/pata_icside.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_rb532_cf.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_scc.c | 5 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 24 | ||||
-rw-r--r-- | include/linux/libata.h | 19 |
8 files changed, 239 insertions, 97 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 3548ee7014ca..81b7ae376951 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -574,6 +574,8 @@ static const struct ich_laptop ich_laptop[] = { | |||
574 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ | 574 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ |
575 | { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ | 575 | { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ |
576 | { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */ | 576 | { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */ |
577 | { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */ | ||
578 | { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */ | ||
577 | { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */ | 579 | { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */ |
578 | /* end marker */ | 580 | /* end marker */ |
579 | { 0, } | 581 | { 0, } |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index dbf6ca781f66..3ff8b14420d9 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -118,12 +118,62 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap) | |||
118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | 118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; |
119 | } | 119 | } |
120 | 120 | ||
121 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device | 121 | static void ata_acpi_eject_device(acpi_handle handle) |
122 | *dev, u32 event) | 122 | { |
123 | struct acpi_object_list arg_list; | ||
124 | union acpi_object arg; | ||
125 | |||
126 | arg_list.count = 1; | ||
127 | arg_list.pointer = &arg; | ||
128 | arg.type = ACPI_TYPE_INTEGER; | ||
129 | arg.integer.value = 1; | ||
130 | |||
131 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_EJ0", | ||
132 | &arg_list, NULL))) | ||
133 | printk(KERN_ERR "Failed to evaluate _EJ0!\n"); | ||
134 | } | ||
135 | |||
136 | /* @ap and @dev are the same as ata_acpi_handle_hotplug() */ | ||
137 | static void ata_acpi_detach_device(struct ata_port *ap, struct ata_device *dev) | ||
138 | { | ||
139 | if (dev) | ||
140 | dev->flags |= ATA_DFLAG_DETACH; | ||
141 | else { | ||
142 | struct ata_link *tlink; | ||
143 | struct ata_device *tdev; | ||
144 | |||
145 | ata_port_for_each_link(tlink, ap) | ||
146 | ata_link_for_each_dev(tdev, tlink) | ||
147 | tdev->flags |= ATA_DFLAG_DETACH; | ||
148 | } | ||
149 | |||
150 | ata_port_schedule_eh(ap); | ||
151 | } | ||
152 | |||
153 | /** | ||
154 | * ata_acpi_handle_hotplug - ACPI event handler backend | ||
155 | * @ap: ATA port ACPI event occurred | ||
156 | * @dev: ATA device ACPI event occurred (can be NULL) | ||
157 | * @event: ACPI event which occurred | ||
158 | * @is_dock_event: boolean indicating whether the event was a dock one | ||
159 | * | ||
160 | * All ACPI bay / device realted events end up in this function. If | ||
161 | * the event is port-wide @dev is NULL. If the event is specific to a | ||
162 | * device, @dev points to it. | ||
163 | * | ||
164 | * Hotplug (as opposed to unplug) notification is always handled as | ||
165 | * port-wide while unplug only kills the target device on device-wide | ||
166 | * event. | ||
167 | * | ||
168 | * LOCKING: | ||
169 | * ACPI notify handler context. May sleep. | ||
170 | */ | ||
171 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | ||
172 | u32 event, int is_dock_event) | ||
123 | { | 173 | { |
124 | char event_string[12]; | 174 | char event_string[12]; |
125 | char *envp[] = { event_string, NULL }; | 175 | char *envp[] = { event_string, NULL }; |
126 | struct ata_eh_info *ehi; | 176 | struct ata_eh_info *ehi = &ap->link.eh_info; |
127 | struct kobject *kobj = NULL; | 177 | struct kobject *kobj = NULL; |
128 | int wait = 0; | 178 | int wait = 0; |
129 | unsigned long flags; | 179 | unsigned long flags; |
@@ -131,87 +181,100 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device | |||
131 | unsigned long sta; | 181 | unsigned long sta; |
132 | acpi_status status; | 182 | acpi_status status; |
133 | 183 | ||
134 | if (!ap) | 184 | if (dev) { |
135 | ap = dev->link->ap; | 185 | if (dev->sdev) |
136 | ehi = &ap->link.eh_info; | 186 | kobj = &dev->sdev->sdev_gendev.kobj; |
137 | |||
138 | spin_lock_irqsave(ap->lock, flags); | ||
139 | |||
140 | if (dev) | ||
141 | handle = dev->acpi_handle; | 187 | handle = dev->acpi_handle; |
142 | else | 188 | } else { |
189 | kobj = &ap->dev->kobj; | ||
143 | handle = ap->acpi_handle; | 190 | handle = ap->acpi_handle; |
191 | } | ||
144 | 192 | ||
145 | status = acpi_get_handle(handle, "_EJ0", &tmphandle); | 193 | status = acpi_get_handle(handle, "_EJ0", &tmphandle); |
146 | if (ACPI_FAILURE(status)) { | 194 | if (ACPI_FAILURE(status)) |
147 | /* This device is not ejectable */ | 195 | /* This device does not support hotplug */ |
148 | spin_unlock_irqrestore(ap->lock, flags); | ||
149 | return; | 196 | return; |
150 | } | ||
151 | 197 | ||
152 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | 198 | spin_lock_irqsave(ap->lock, flags); |
153 | if (ACPI_FAILURE(status)) { | ||
154 | printk ("Unable to determine bay status\n"); | ||
155 | spin_unlock_irqrestore(ap->lock, flags); | ||
156 | return; | ||
157 | } | ||
158 | 199 | ||
159 | switch (event) { | 200 | switch (event) { |
160 | case ACPI_NOTIFY_BUS_CHECK: | 201 | case ACPI_NOTIFY_BUS_CHECK: |
161 | case ACPI_NOTIFY_DEVICE_CHECK: | 202 | case ACPI_NOTIFY_DEVICE_CHECK: |
162 | ata_ehi_push_desc(ehi, "ACPI event"); | 203 | ata_ehi_push_desc(ehi, "ACPI event"); |
163 | if (!sta) { | 204 | |
164 | /* Device has been unplugged */ | 205 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); |
165 | if (dev) | 206 | if (ACPI_FAILURE(status)) { |
166 | dev->flags |= ATA_DFLAG_DETACH; | 207 | ata_port_printk(ap, KERN_ERR, |
167 | else { | 208 | "acpi: failed to determine bay status (0x%x)\n", |
168 | struct ata_link *tlink; | 209 | status); |
169 | struct ata_device *tdev; | 210 | break; |
170 | 211 | } | |
171 | ata_port_for_each_link(tlink, ap) { | 212 | |
172 | ata_link_for_each_dev(tdev, tlink) { | 213 | if (sta) { |
173 | tdev->flags |= | ||
174 | ATA_DFLAG_DETACH; | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | ata_port_schedule_eh(ap); | ||
179 | wait = 1; | ||
180 | } else { | ||
181 | ata_ehi_hotplugged(ehi); | 214 | ata_ehi_hotplugged(ehi); |
182 | ata_port_freeze(ap); | 215 | ata_port_freeze(ap); |
216 | } else { | ||
217 | /* The device has gone - unplug it */ | ||
218 | ata_acpi_detach_device(ap, dev); | ||
219 | wait = 1; | ||
183 | } | 220 | } |
221 | break; | ||
222 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
223 | ata_ehi_push_desc(ehi, "ACPI event"); | ||
224 | |||
225 | if (!is_dock_event) | ||
226 | break; | ||
227 | |||
228 | /* undock event - immediate unplug */ | ||
229 | ata_acpi_detach_device(ap, dev); | ||
230 | wait = 1; | ||
231 | break; | ||
184 | } | 232 | } |
185 | 233 | ||
234 | /* make sure kobj doesn't go away while ap->lock is released */ | ||
235 | kobject_get(kobj); | ||
236 | |||
186 | spin_unlock_irqrestore(ap->lock, flags); | 237 | spin_unlock_irqrestore(ap->lock, flags); |
187 | 238 | ||
188 | if (wait) | 239 | if (wait) { |
189 | ata_port_wait_eh(ap); | 240 | ata_port_wait_eh(ap); |
241 | ata_acpi_eject_device(handle); | ||
242 | } | ||
190 | 243 | ||
191 | if (dev) { | 244 | if (kobj && !is_dock_event) { |
192 | if (dev->sdev) | ||
193 | kobj = &dev->sdev->sdev_gendev.kobj; | ||
194 | } else | ||
195 | kobj = &ap->dev->kobj; | ||
196 | |||
197 | if (kobj) { | ||
198 | sprintf(event_string, "BAY_EVENT=%d", event); | 245 | sprintf(event_string, "BAY_EVENT=%d", event); |
199 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); | 246 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); |
200 | } | 247 | } |
248 | |||
249 | kobject_put(kobj); | ||
250 | } | ||
251 | |||
252 | static void ata_acpi_dev_notify_dock(acpi_handle handle, u32 event, void *data) | ||
253 | { | ||
254 | struct ata_device *dev = data; | ||
255 | |||
256 | ata_acpi_handle_hotplug(dev->link->ap, dev, event, 1); | ||
257 | } | ||
258 | |||
259 | static void ata_acpi_ap_notify_dock(acpi_handle handle, u32 event, void *data) | ||
260 | { | ||
261 | struct ata_port *ap = data; | ||
262 | |||
263 | ata_acpi_handle_hotplug(ap, NULL, event, 1); | ||
201 | } | 264 | } |
202 | 265 | ||
203 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) | 266 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) |
204 | { | 267 | { |
205 | struct ata_device *dev = data; | 268 | struct ata_device *dev = data; |
206 | 269 | ||
207 | ata_acpi_handle_hotplug(NULL, dev, event); | 270 | ata_acpi_handle_hotplug(dev->link->ap, dev, event, 0); |
208 | } | 271 | } |
209 | 272 | ||
210 | static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data) | 273 | static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data) |
211 | { | 274 | { |
212 | struct ata_port *ap = data; | 275 | struct ata_port *ap = data; |
213 | 276 | ||
214 | ata_acpi_handle_hotplug(ap, NULL, event); | 277 | ata_acpi_handle_hotplug(ap, NULL, event, 0); |
215 | } | 278 | } |
216 | 279 | ||
217 | /** | 280 | /** |
@@ -252,7 +315,7 @@ void ata_acpi_associate(struct ata_host *host) | |||
252 | ata_acpi_ap_notify, ap); | 315 | ata_acpi_ap_notify, ap); |
253 | /* we might be on a docking station */ | 316 | /* we might be on a docking station */ |
254 | register_hotplug_dock_device(ap->acpi_handle, | 317 | register_hotplug_dock_device(ap->acpi_handle, |
255 | ata_acpi_ap_notify, ap); | 318 | ata_acpi_ap_notify_dock, ap); |
256 | } | 319 | } |
257 | 320 | ||
258 | for (j = 0; j < ata_link_max_devices(&ap->link); j++) { | 321 | for (j = 0; j < ata_link_max_devices(&ap->link); j++) { |
@@ -264,7 +327,7 @@ void ata_acpi_associate(struct ata_host *host) | |||
264 | ata_acpi_dev_notify, dev); | 327 | ata_acpi_dev_notify, dev); |
265 | /* we might be on a docking station */ | 328 | /* we might be on a docking station */ |
266 | register_hotplug_dock_device(dev->acpi_handle, | 329 | register_hotplug_dock_device(dev->acpi_handle, |
267 | ata_acpi_dev_notify, dev); | 330 | ata_acpi_dev_notify_dock, dev); |
268 | } | 331 | } |
269 | } | 332 | } |
270 | } | 333 | } |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 3c2d2289f85e..90d20c615ef5 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -247,7 +247,7 @@ u8 ata_sff_check_status(struct ata_port *ap) | |||
247 | * LOCKING: | 247 | * LOCKING: |
248 | * Inherited from caller. | 248 | * Inherited from caller. |
249 | */ | 249 | */ |
250 | u8 ata_sff_altstatus(struct ata_port *ap) | 250 | static u8 ata_sff_altstatus(struct ata_port *ap) |
251 | { | 251 | { |
252 | if (ap->ops->sff_check_altstatus) | 252 | if (ap->ops->sff_check_altstatus) |
253 | return ap->ops->sff_check_altstatus(ap); | 253 | return ap->ops->sff_check_altstatus(ap); |
@@ -256,6 +256,93 @@ u8 ata_sff_altstatus(struct ata_port *ap) | |||
256 | } | 256 | } |
257 | 257 | ||
258 | /** | 258 | /** |
259 | * ata_sff_irq_status - Check if the device is busy | ||
260 | * @ap: port where the device is | ||
261 | * | ||
262 | * Determine if the port is currently busy. Uses altstatus | ||
263 | * if available in order to avoid clearing shared IRQ status | ||
264 | * when finding an IRQ source. Non ctl capable devices don't | ||
265 | * share interrupt lines fortunately for us. | ||
266 | * | ||
267 | * LOCKING: | ||
268 | * Inherited from caller. | ||
269 | */ | ||
270 | static u8 ata_sff_irq_status(struct ata_port *ap) | ||
271 | { | ||
272 | u8 status; | ||
273 | |||
274 | if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { | ||
275 | status = ata_sff_altstatus(ap); | ||
276 | /* Not us: We are busy */ | ||
277 | if (status & ATA_BUSY) | ||
278 | return status; | ||
279 | } | ||
280 | /* Clear INTRQ latch */ | ||
281 | status = ata_sff_check_status(ap); | ||
282 | return status; | ||
283 | } | ||
284 | |||
285 | /** | ||
286 | * ata_sff_sync - Flush writes | ||
287 | * @ap: Port to wait for. | ||
288 | * | ||
289 | * CAUTION: | ||
290 | * If we have an mmio device with no ctl and no altstatus | ||
291 | * method this will fail. No such devices are known to exist. | ||
292 | * | ||
293 | * LOCKING: | ||
294 | * Inherited from caller. | ||
295 | */ | ||
296 | |||
297 | static void ata_sff_sync(struct ata_port *ap) | ||
298 | { | ||
299 | if (ap->ops->sff_check_altstatus) | ||
300 | ap->ops->sff_check_altstatus(ap); | ||
301 | else if (ap->ioaddr.altstatus_addr) | ||
302 | ioread8(ap->ioaddr.altstatus_addr); | ||
303 | } | ||
304 | |||
305 | /** | ||
306 | * ata_sff_pause - Flush writes and wait 400nS | ||
307 | * @ap: Port to pause for. | ||
308 | * | ||
309 | * CAUTION: | ||
310 | * If we have an mmio device with no ctl and no altstatus | ||
311 | * method this will fail. No such devices are known to exist. | ||
312 | * | ||
313 | * LOCKING: | ||
314 | * Inherited from caller. | ||
315 | */ | ||
316 | |||
317 | void ata_sff_pause(struct ata_port *ap) | ||
318 | { | ||
319 | ata_sff_sync(ap); | ||
320 | ndelay(400); | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * ata_sff_dma_pause - Pause before commencing DMA | ||
325 | * @ap: Port to pause for. | ||
326 | * | ||
327 | * Perform I/O fencing and ensure sufficient cycle delays occur | ||
328 | * for the HDMA1:0 transition | ||
329 | */ | ||
330 | |||
331 | void ata_sff_dma_pause(struct ata_port *ap) | ||
332 | { | ||
333 | if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { | ||
334 | /* An altstatus read will cause the needed delay without | ||
335 | messing up the IRQ status */ | ||
336 | ata_sff_altstatus(ap); | ||
337 | return; | ||
338 | } | ||
339 | /* There are no DMA controllers without ctl. BUG here to ensure | ||
340 | we never violate the HDMA1:0 transition timing and risk | ||
341 | corruption. */ | ||
342 | BUG(); | ||
343 | } | ||
344 | |||
345 | /** | ||
259 | * ata_sff_busy_sleep - sleep until BSY clears, or timeout | 346 | * ata_sff_busy_sleep - sleep until BSY clears, or timeout |
260 | * @ap: port containing status register to be polled | 347 | * @ap: port containing status register to be polled |
261 | * @tmout_pat: impatience timeout | 348 | * @tmout_pat: impatience timeout |
@@ -742,7 +829,7 @@ static void ata_pio_sectors(struct ata_queued_cmd *qc) | |||
742 | } else | 829 | } else |
743 | ata_pio_sector(qc); | 830 | ata_pio_sector(qc); |
744 | 831 | ||
745 | ata_sff_altstatus(qc->ap); /* flush */ | 832 | ata_sff_sync(qc->ap); /* flush */ |
746 | } | 833 | } |
747 | 834 | ||
748 | /** | 835 | /** |
@@ -763,8 +850,9 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
763 | WARN_ON(qc->dev->cdb_len < 12); | 850 | WARN_ON(qc->dev->cdb_len < 12); |
764 | 851 | ||
765 | ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); | 852 | ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); |
766 | ata_sff_altstatus(ap); /* flush */ | 853 | ata_sff_sync(ap); |
767 | 854 | /* FIXME: If the CDB is for DMA do we need to do the transition delay | |
855 | or is bmdma_start guaranteed to do it ? */ | ||
768 | switch (qc->tf.protocol) { | 856 | switch (qc->tf.protocol) { |
769 | case ATAPI_PROT_PIO: | 857 | case ATAPI_PROT_PIO: |
770 | ap->hsm_task_state = HSM_ST; | 858 | ap->hsm_task_state = HSM_ST; |
@@ -905,7 +993,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc) | |||
905 | 993 | ||
906 | if (unlikely(__atapi_pio_bytes(qc, bytes))) | 994 | if (unlikely(__atapi_pio_bytes(qc, bytes))) |
907 | goto err_out; | 995 | goto err_out; |
908 | ata_sff_altstatus(ap); /* flush */ | 996 | ata_sff_sync(ap); /* flush */ |
909 | 997 | ||
910 | return; | 998 | return; |
911 | 999 | ||
@@ -1489,14 +1577,10 @@ inline unsigned int ata_sff_host_intr(struct ata_port *ap, | |||
1489 | goto idle_irq; | 1577 | goto idle_irq; |
1490 | } | 1578 | } |
1491 | 1579 | ||
1492 | /* check altstatus */ | ||
1493 | status = ata_sff_altstatus(ap); | ||
1494 | if (status & ATA_BUSY) | ||
1495 | goto idle_irq; | ||
1496 | 1580 | ||
1497 | /* check main status, clearing INTRQ */ | 1581 | /* check main status, clearing INTRQ if needed */ |
1498 | status = ap->ops->sff_check_status(ap); | 1582 | status = ata_sff_irq_status(ap); |
1499 | if (unlikely(status & ATA_BUSY)) | 1583 | if (status & ATA_BUSY) |
1500 | goto idle_irq; | 1584 | goto idle_irq; |
1501 | 1585 | ||
1502 | /* ack bmdma irq events */ | 1586 | /* ack bmdma irq events */ |
@@ -2030,7 +2114,7 @@ void ata_sff_error_handler(struct ata_port *ap) | |||
2030 | ap->ops->bmdma_stop(qc); | 2114 | ap->ops->bmdma_stop(qc); |
2031 | } | 2115 | } |
2032 | 2116 | ||
2033 | ata_sff_altstatus(ap); | 2117 | ata_sff_sync(ap); /* FIXME: We don't need this */ |
2034 | ap->ops->sff_check_status(ap); | 2118 | ap->ops->sff_check_status(ap); |
2035 | ap->ops->sff_irq_clear(ap); | 2119 | ap->ops->sff_irq_clear(ap); |
2036 | 2120 | ||
@@ -2203,7 +2287,7 @@ void ata_bmdma_stop(struct ata_queued_cmd *qc) | |||
2203 | mmio + ATA_DMA_CMD); | 2287 | mmio + ATA_DMA_CMD); |
2204 | 2288 | ||
2205 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | 2289 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ |
2206 | ata_sff_altstatus(ap); /* dummy read */ | 2290 | ata_sff_dma_pause(ap); |
2207 | } | 2291 | } |
2208 | 2292 | ||
2209 | /** | 2293 | /** |
@@ -2722,7 +2806,8 @@ EXPORT_SYMBOL_GPL(ata_sff_qc_prep); | |||
2722 | EXPORT_SYMBOL_GPL(ata_sff_dumb_qc_prep); | 2806 | EXPORT_SYMBOL_GPL(ata_sff_dumb_qc_prep); |
2723 | EXPORT_SYMBOL_GPL(ata_sff_dev_select); | 2807 | EXPORT_SYMBOL_GPL(ata_sff_dev_select); |
2724 | EXPORT_SYMBOL_GPL(ata_sff_check_status); | 2808 | EXPORT_SYMBOL_GPL(ata_sff_check_status); |
2725 | EXPORT_SYMBOL_GPL(ata_sff_altstatus); | 2809 | EXPORT_SYMBOL_GPL(ata_sff_dma_pause); |
2810 | EXPORT_SYMBOL_GPL(ata_sff_pause); | ||
2726 | EXPORT_SYMBOL_GPL(ata_sff_busy_sleep); | 2811 | EXPORT_SYMBOL_GPL(ata_sff_busy_sleep); |
2727 | EXPORT_SYMBOL_GPL(ata_sff_wait_ready); | 2812 | EXPORT_SYMBOL_GPL(ata_sff_wait_ready); |
2728 | EXPORT_SYMBOL_GPL(ata_sff_tf_load); | 2813 | EXPORT_SYMBOL_GPL(ata_sff_tf_load); |
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c index 17138436423d..cf9e9848f8b5 100644 --- a/drivers/ata/pata_icside.c +++ b/drivers/ata/pata_icside.c | |||
@@ -270,7 +270,7 @@ static void pata_icside_bmdma_stop(struct ata_queued_cmd *qc) | |||
270 | disable_dma(state->dma); | 270 | disable_dma(state->dma); |
271 | 271 | ||
272 | /* see ata_bmdma_stop */ | 272 | /* see ata_bmdma_stop */ |
273 | ata_sff_altstatus(ap); | 273 | ata_sff_dma_pause(ap); |
274 | } | 274 | } |
275 | 275 | ||
276 | static u8 pata_icside_bmdma_status(struct ata_port *ap) | 276 | static u8 pata_icside_bmdma_status(struct ata_port *ap) |
diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c index a108d259f19d..f8b3ffc8ae9e 100644 --- a/drivers/ata/pata_rb532_cf.c +++ b/drivers/ata/pata_rb532_cf.c | |||
@@ -57,7 +57,9 @@ static inline void rb532_pata_finish_io(struct ata_port *ap) | |||
57 | struct ata_host *ah = ap->host; | 57 | struct ata_host *ah = ap->host; |
58 | struct rb532_cf_info *info = ah->private_data; | 58 | struct rb532_cf_info *info = ah->private_data; |
59 | 59 | ||
60 | ata_sff_altstatus(ap); | 60 | /* FIXME: Keep previous delay. If this is merely a fence then |
61 | ata_sff_sync might be sufficient. */ | ||
62 | ata_sff_dma_pause(ap); | ||
61 | ndelay(RB500_CF_IO_DELAY); | 63 | ndelay(RB500_CF_IO_DELAY); |
62 | 64 | ||
63 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); | 65 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index e965b251ca24..bbf5aa345e68 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -726,7 +726,7 @@ static void scc_bmdma_stop (struct ata_queued_cmd *qc) | |||
726 | in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START); | 726 | in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START); |
727 | 727 | ||
728 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | 728 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ |
729 | ata_sff_altstatus(ap); /* dummy read */ | 729 | ata_sff_dma_pause(ap); /* dummy read */ |
730 | } | 730 | } |
731 | 731 | ||
732 | /** | 732 | /** |
@@ -747,7 +747,8 @@ static u8 scc_bmdma_status (struct ata_port *ap) | |||
747 | return host_stat; | 747 | return host_stat; |
748 | 748 | ||
749 | /* errata A252,A308 workaround: Step4 */ | 749 | /* errata A252,A308 workaround: Step4 */ |
750 | if ((ata_sff_altstatus(ap) & ATA_ERR) && (int_status & INTSTS_INTRQ)) | 750 | if ((scc_check_altstatus(ap) & ATA_ERR) |
751 | && (int_status & INTSTS_INTRQ)) | ||
751 | return (host_stat | ATA_DMA_INTR); | 752 | return (host_stat | ATA_DMA_INTR); |
752 | 753 | ||
753 | /* errata A308 workaround Step5 */ | 754 | /* errata A308 workaround Step5 */ |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index acf347f71a2f..60391e9a84db 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -224,6 +224,11 @@ enum { | |||
224 | 224 | ||
225 | PHY_MODE3 = 0x310, | 225 | PHY_MODE3 = 0x310, |
226 | PHY_MODE4 = 0x314, | 226 | PHY_MODE4 = 0x314, |
227 | PHY_MODE4_CFG_MASK = 0x00000003, /* phy internal config field */ | ||
228 | PHY_MODE4_CFG_VALUE = 0x00000001, /* phy internal config field */ | ||
229 | PHY_MODE4_RSVD_ZEROS = 0x5de3fffa, /* Gen2e always write zeros */ | ||
230 | PHY_MODE4_RSVD_ONES = 0x00000005, /* Gen2e always write ones */ | ||
231 | |||
227 | PHY_MODE2 = 0x330, | 232 | PHY_MODE2 = 0x330, |
228 | SATA_IFCTL_OFS = 0x344, | 233 | SATA_IFCTL_OFS = 0x344, |
229 | SATA_TESTCTL_OFS = 0x348, | 234 | SATA_TESTCTL_OFS = 0x348, |
@@ -2563,17 +2568,16 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
2563 | m3 &= ~0x1c; | 2568 | m3 &= ~0x1c; |
2564 | 2569 | ||
2565 | if (fix_phy_mode4) { | 2570 | if (fix_phy_mode4) { |
2566 | u32 m4; | 2571 | u32 m4 = readl(port_mmio + PHY_MODE4); |
2567 | 2572 | /* | |
2568 | m4 = readl(port_mmio + PHY_MODE4); | 2573 | * Enforce reserved-bit restrictions on GenIIe devices only. |
2569 | 2574 | * For earlier chipsets, force only the internal config field | |
2570 | /* workaround for errata FEr SATA#10 (part 1) */ | 2575 | * (workaround for errata FEr SATA#10 part 1). |
2571 | m4 = (m4 & ~(1 << 1)) | (1 << 0); | 2576 | */ |
2572 | |||
2573 | /* enforce bit restrictions on GenIIe devices */ | ||
2574 | if (IS_GEN_IIE(hpriv)) | 2577 | if (IS_GEN_IIE(hpriv)) |
2575 | m4 = (m4 & ~0x5DE3FFFC) | (1 << 2); | 2578 | m4 = (m4 & ~PHY_MODE4_RSVD_ZEROS) | PHY_MODE4_RSVD_ONES; |
2576 | 2579 | else | |
2580 | m4 = (m4 & ~PHY_MODE4_CFG_MASK) | PHY_MODE4_CFG_VALUE; | ||
2577 | writel(m4, port_mmio + PHY_MODE4); | 2581 | writel(m4, port_mmio + PHY_MODE4); |
2578 | } | 2582 | } |
2579 | /* | 2583 | /* |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 4a92fbafce9d..e57e5d08312d 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -111,13 +111,10 @@ enum { | |||
111 | /* various global constants */ | 111 | /* various global constants */ |
112 | LIBATA_MAX_PRD = ATA_MAX_PRD / 2, | 112 | LIBATA_MAX_PRD = ATA_MAX_PRD / 2, |
113 | LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */ | 113 | LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */ |
114 | ATA_MAX_PORTS = 8, | ||
115 | ATA_DEF_QUEUE = 1, | 114 | ATA_DEF_QUEUE = 1, |
116 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ | 115 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ |
117 | ATA_MAX_QUEUE = 32, | 116 | ATA_MAX_QUEUE = 32, |
118 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, | 117 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, |
119 | ATA_MAX_BUS = 2, | ||
120 | ATA_DEF_BUSY_WAIT = 10000, | ||
121 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, | 118 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, |
122 | 119 | ||
123 | ATAPI_MAX_DRAIN = 16 << 10, | 120 | ATAPI_MAX_DRAIN = 16 << 10, |
@@ -1435,7 +1432,8 @@ extern void ata_sff_qc_prep(struct ata_queued_cmd *qc); | |||
1435 | extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc); | 1432 | extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc); |
1436 | extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); | 1433 | extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); |
1437 | extern u8 ata_sff_check_status(struct ata_port *ap); | 1434 | extern u8 ata_sff_check_status(struct ata_port *ap); |
1438 | extern u8 ata_sff_altstatus(struct ata_port *ap); | 1435 | extern void ata_sff_pause(struct ata_port *ap); |
1436 | extern void ata_sff_dma_pause(struct ata_port *ap); | ||
1439 | extern int ata_sff_busy_sleep(struct ata_port *ap, | 1437 | extern int ata_sff_busy_sleep(struct ata_port *ap, |
1440 | unsigned long timeout_pat, unsigned long timeout); | 1438 | unsigned long timeout_pat, unsigned long timeout); |
1441 | extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline); | 1439 | extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline); |
@@ -1496,19 +1494,6 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev, | |||
1496 | #endif /* CONFIG_PCI */ | 1494 | #endif /* CONFIG_PCI */ |
1497 | 1495 | ||
1498 | /** | 1496 | /** |
1499 | * ata_sff_pause - Flush writes and pause 400 nanoseconds. | ||
1500 | * @ap: Port to wait for. | ||
1501 | * | ||
1502 | * LOCKING: | ||
1503 | * Inherited from caller. | ||
1504 | */ | ||
1505 | static inline void ata_sff_pause(struct ata_port *ap) | ||
1506 | { | ||
1507 | ata_sff_altstatus(ap); | ||
1508 | ndelay(400); | ||
1509 | } | ||
1510 | |||
1511 | /** | ||
1512 | * ata_sff_busy_wait - Wait for a port status register | 1497 | * ata_sff_busy_wait - Wait for a port status register |
1513 | * @ap: Port to wait for. | 1498 | * @ap: Port to wait for. |
1514 | * @bits: bits that must be clear | 1499 | * @bits: bits that must be clear |