summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2013-02-11 18:02:00 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-02-13 18:09:17 +0100
commita3f74d928ce73f37eab5b398e018aaeb42fd2ba4 (patch)
treeb592f937a4d924ea32ce1bd36f6a3c26c6238549 /drivers
parent650e2daa9fc847aaced5302b2a287da2d1d58c04 (diff)
downloadbarebox-a3f74d928ce73f37eab5b398e018aaeb42fd2ba4.tar.gz
barebox-a3f74d928ce73f37eab5b398e018aaeb42fd2ba4.tar.xz
ahci: handle COMINIT received during spin-up
Some Intel SSDs can send a COMINIT after the initial COMRESET. This causes the link to go down and we need to re-initialize the link. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 14de3c5061..3aff3f3c2d 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -385,14 +385,21 @@ static int ahci_init_port(struct ahci_port *ahci_port)
ahci_port_info(ahci_port, "Spinning up device...\n");
ret = wait_on_timeout(WAIT_SPINUP,
- (readl(port_mmio + PORT_TFDATA) &
- (ATA_STATUS_BUSY | ATA_STATUS_DRQ)) == 0);
+ ((readl(port_mmio + PORT_TFDATA) &
+ (ATA_STATUS_BUSY | ATA_STATUS_DRQ)) == 0)
+ || !((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1));
if (ret) {
ahci_port_info(ahci_port, "timeout.\n");
ret = -ENODEV;
goto err_init;
}
+ if ((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1) {
+ ahci_port_info(ahci_port, "down.\n");
+ ret = -ENODEV;
+ goto err_init;
+ }
+
ahci_port_info(ahci_port, "ok.\n");
val = ahci_port_read(ahci_port, PORT_SCR_ERR);