aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-07-16 01:29:40 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-20 08:19:05 -0400
commit008a78961ec72990d09d7625ef9499d7317d040d (patch)
treeaa356bbd961b7425017a3037fec509ffb761d332 /drivers/ata/libata-eh.c
parentbadc2341579511a247f5993865aa68379e283c5c (diff)
libata: improve SATA PHY speed down logic
sata_down_spd_limit() first reads the current SPD from SStatus and limit the speed to the lower one of one below the current limit or one below the current SPD in SStatus. SPD may not be accessible or valid when SPD down is requested making sata_down_spd_limit() fail when it's most needed. This patch makes the current SPD cached after each successful reset and forces GEN I speed (1.5Gbps) if neither of SStatus or the cached value is valid, so sata_down_spd_limit() is now guaranteed to lower the speed limit if lower speed is available. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 19f9947bd96b..183eaf466d4f 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1799,12 +1799,18 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1799 } 1799 }
1800 1800
1801 if (rc == 0) { 1801 if (rc == 0) {
1802 u32 sstatus;
1803
1802 /* After the reset, the device state is PIO 0 and the 1804 /* After the reset, the device state is PIO 0 and the
1803 * controller state is undefined. Record the mode. 1805 * controller state is undefined. Record the mode.
1804 */ 1806 */
1805 for (i = 0; i < ATA_MAX_DEVICES; i++) 1807 for (i = 0; i < ATA_MAX_DEVICES; i++)
1806 ap->device[i].pio_mode = XFER_PIO_0; 1808 ap->device[i].pio_mode = XFER_PIO_0;
1807 1809
1810 /* record current link speed */
1811 if (sata_scr_read(ap, SCR_STATUS, &sstatus) == 0)
1812 ap->sata_spd = (sstatus >> 4) & 0xf;
1813
1808 if (postreset) 1814 if (postreset)
1809 postreset(ap, classes); 1815 postreset(ap, classes);
1810 1816