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>
This commit is contained in:

committed by
Jeff Garzik

orang tua
badc234157
melakukan
008a78961e
@@ -1799,12 +1799,18 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
u32 sstatus;
|
||||
|
||||
/* After the reset, the device state is PIO 0 and the
|
||||
* controller state is undefined. Record the mode.
|
||||
*/
|
||||
for (i = 0; i < ATA_MAX_DEVICES; i++)
|
||||
ap->device[i].pio_mode = XFER_PIO_0;
|
||||
|
||||
/* record current link speed */
|
||||
if (sata_scr_read(ap, SCR_STATUS, &sstatus) == 0)
|
||||
ap->sata_spd = (sstatus >> 4) & 0xf;
|
||||
|
||||
if (postreset)
|
||||
postreset(ap, classes);
|
||||
|
||||
|
Reference in New Issue
Block a user