diff options
-rw-r--r-- | drivers/ata/libata-core.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 1501d63db2cb..aecbdad960fb 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3209,6 +3209,8 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
3209 | unsigned long deadline) | 3209 | unsigned long deadline) |
3210 | { | 3210 | { |
3211 | struct ata_ioports *ioaddr = &ap->ioaddr; | 3211 | struct ata_ioports *ioaddr = &ap->ioaddr; |
3212 | struct ata_device *dev; | ||
3213 | int i = 0; | ||
3212 | 3214 | ||
3213 | DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); | 3215 | DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); |
3214 | 3216 | ||
@@ -3219,6 +3221,25 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
3219 | udelay(20); /* FIXME: flush */ | 3221 | udelay(20); /* FIXME: flush */ |
3220 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 3222 | iowrite8(ap->ctl, ioaddr->ctl_addr); |
3221 | 3223 | ||
3224 | /* If we issued an SRST then an ATA drive (not ATAPI) | ||
3225 | * may have changed configuration and be in PIO0 timing. If | ||
3226 | * we did a hard reset (or are coming from power on) this is | ||
3227 | * true for ATA or ATAPI. Until we've set a suitable controller | ||
3228 | * mode we should not touch the bus as we may be talking too fast. | ||
3229 | */ | ||
3230 | |||
3231 | ata_link_for_each_dev(dev, &ap->link) | ||
3232 | dev->pio_mode = XFER_PIO_0; | ||
3233 | |||
3234 | /* If the controller has a pio mode setup function then use | ||
3235 | it to set the chipset to rights. Don't touch the DMA setup | ||
3236 | as that will be dealt with when revalidating */ | ||
3237 | if (ap->ops->set_piomode) { | ||
3238 | ata_link_for_each_dev(dev, &ap->link) | ||
3239 | if (devmask & (1 << i++)) | ||
3240 | ap->ops->set_piomode(ap, dev); | ||
3241 | } | ||
3242 | |||
3222 | /* spec mandates ">= 2ms" before checking status. | 3243 | /* spec mandates ">= 2ms" before checking status. |
3223 | * We wait 150ms, because that was the magic delay used for | 3244 | * We wait 150ms, because that was the magic delay used for |
3224 | * ATAPI devices in Hale Landis's ATADRVR, for the period of time | 3245 | * ATAPI devices in Hale Landis's ATADRVR, for the period of time |