diff options
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 8cb35bb87605..ec55d63cf20e 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2083,6 +2083,25 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2083 | 2083 | ||
2084 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); | 2084 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); |
2085 | 2085 | ||
2086 | ata_link_for_each_dev(dev, link) { | ||
2087 | /* If we issue an SRST then an ATA drive (not ATAPI) | ||
2088 | * may change configuration and be in PIO0 timing. If | ||
2089 | * we do a hard reset (or are coming from power on) | ||
2090 | * this is true for ATA or ATAPI. Until we've set a | ||
2091 | * suitable controller mode we should not touch the | ||
2092 | * bus as we may be talking too fast. | ||
2093 | */ | ||
2094 | dev->pio_mode = XFER_PIO_0; | ||
2095 | |||
2096 | /* If the controller has a pio mode setup function | ||
2097 | * then use it to set the chipset to rights. Don't | ||
2098 | * touch the DMA setup as that will be dealt with when | ||
2099 | * configuring devices. | ||
2100 | */ | ||
2101 | if (ap->ops->set_piomode) | ||
2102 | ap->ops->set_piomode(ap, dev); | ||
2103 | } | ||
2104 | |||
2086 | /* Determine which reset to use and record in ehc->i.action. | 2105 | /* Determine which reset to use and record in ehc->i.action. |
2087 | * prereset() may examine and modify it. | 2106 | * prereset() may examine and modify it. |
2088 | */ | 2107 | */ |
@@ -2208,9 +2227,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2208 | ata_link_for_each_dev(dev, link) { | 2227 | ata_link_for_each_dev(dev, link) { |
2209 | /* After the reset, the device state is PIO 0 | 2228 | /* After the reset, the device state is PIO 0 |
2210 | * and the controller state is undefined. | 2229 | * and the controller state is undefined. |
2211 | * Record the mode. | 2230 | * Reset also wakes up drives from sleeping |
2231 | * mode. | ||
2212 | */ | 2232 | */ |
2213 | dev->pio_mode = XFER_PIO_0; | 2233 | dev->pio_mode = XFER_PIO_0; |
2234 | dev->flags &= ~ATA_DFLAG_SLEEPING; | ||
2214 | 2235 | ||
2215 | if (ata_link_offline(link)) | 2236 | if (ata_link_offline(link)) |
2216 | continue; | 2237 | continue; |
@@ -2416,7 +2437,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2416 | /* give it just one more chance */ | 2437 | /* give it just one more chance */ |
2417 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); | 2438 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); |
2418 | case -EIO: | 2439 | case -EIO: |
2419 | if (ehc->tries[dev->devno] == 1) { | 2440 | if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) { |
2420 | /* This is the last chance, better to slow | 2441 | /* This is the last chance, better to slow |
2421 | * down than lose it. | 2442 | * down than lose it. |
2422 | */ | 2443 | */ |