aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-10-29 03:41:09 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-29 06:21:33 -0400
commitcdeab1140799f09c5f728a5ff85e0bdfa5679cd2 (patch)
tree51e70854ce9a41e3d7e0363fe5748635671b6a6f /drivers/ata/libata-core.c
parenta9efacbad1a735ec410acb26c9de72be8efb33d5 (diff)
libata: relocate forcing PIO0 on reset
Forcing PIO0 on reset was done inside ata_bus_softreset(), which is a bit out of place as it should be applied to all resets - hard, soft and implementation which don't use ata_bus_softreset(). Relocate it such that... * For new EH, it's done in ata_eh_reset() before calling prereset. * For old EH, it's done before calling ap->ops->phy_reset() in ata_bus_probe(). This makes PIO0 forced after all resets. Another difference is that reset itself is done after PIO0 is forced. Signed-off-by: Tejun Heo <htejun@gmail.com> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8ee56e5cfb0c..bdd8778e5256 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2219,6 +2219,25 @@ int ata_bus_probe(struct ata_port *ap)
2219 tries[dev->devno] = ATA_PROBE_MAX_TRIES; 2219 tries[dev->devno] = ATA_PROBE_MAX_TRIES;
2220 2220
2221 retry: 2221 retry:
2222 ata_link_for_each_dev(dev, &ap->link) {
2223 /* If we issue an SRST then an ATA drive (not ATAPI)
2224 * may change configuration and be in PIO0 timing. If
2225 * we do a hard reset (or are coming from power on)
2226 * this is true for ATA or ATAPI. Until we've set a
2227 * suitable controller mode we should not touch the
2228 * bus as we may be talking too fast.
2229 */
2230 dev->pio_mode = XFER_PIO_0;
2231
2232 /* If the controller has a pio mode setup function
2233 * then use it to set the chipset to rights. Don't
2234 * touch the DMA setup as that will be dealt with when
2235 * configuring devices.
2236 */
2237 if (ap->ops->set_piomode)
2238 ap->ops->set_piomode(ap, dev);
2239 }
2240
2222 /* reset and determine device classes */ 2241 /* reset and determine device classes */
2223 ap->ops->phy_reset(ap); 2242 ap->ops->phy_reset(ap);
2224 2243
@@ -2234,12 +2253,6 @@ int ata_bus_probe(struct ata_port *ap)
2234 2253
2235 ata_port_probe(ap); 2254 ata_port_probe(ap);
2236 2255
2237 /* after the reset the device state is PIO 0 and the controller
2238 state is undefined. Record the mode */
2239
2240 ata_link_for_each_dev(dev, &ap->link)
2241 dev->pio_mode = XFER_PIO_0;
2242
2243 /* read IDENTIFY page and configure devices. We have to do the identify 2256 /* read IDENTIFY page and configure devices. We have to do the identify
2244 specific sequence bass-ackwards so that PDIAG- is released by 2257 specific sequence bass-ackwards so that PDIAG- is released by
2245 the slave device */ 2258 the slave device */
@@ -3272,8 +3285,6 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
3272 unsigned long deadline) 3285 unsigned long deadline)
3273{ 3286{
3274 struct ata_ioports *ioaddr = &ap->ioaddr; 3287 struct ata_ioports *ioaddr = &ap->ioaddr;
3275 struct ata_device *dev;
3276 int i = 0;
3277 3288
3278 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); 3289 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
3279 3290
@@ -3284,25 +3295,6 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
3284 udelay(20); /* FIXME: flush */ 3295 udelay(20); /* FIXME: flush */
3285 iowrite8(ap->ctl, ioaddr->ctl_addr); 3296 iowrite8(ap->ctl, ioaddr->ctl_addr);
3286 3297
3287 /* If we issued an SRST then an ATA drive (not ATAPI)
3288 * may have changed configuration and be in PIO0 timing. If
3289 * we did a hard reset (or are coming from power on) this is
3290 * true for ATA or ATAPI. Until we've set a suitable controller
3291 * mode we should not touch the bus as we may be talking too fast.
3292 */
3293
3294 ata_link_for_each_dev(dev, &ap->link)
3295 dev->pio_mode = XFER_PIO_0;
3296
3297 /* If the controller has a pio mode setup function then use
3298 it to set the chipset to rights. Don't touch the DMA setup
3299 as that will be dealt with when revalidating */
3300 if (ap->ops->set_piomode) {
3301 ata_link_for_each_dev(dev, &ap->link)
3302 if (devmask & (1 << i++))
3303 ap->ops->set_piomode(ap, dev);
3304 }
3305
3306 /* wait a while before checking status */ 3298 /* wait a while before checking status */
3307 ata_wait_after_reset(ap, deadline); 3299 ata_wait_after_reset(ap, deadline);
3308 3300