]> git.sur5r.net Git - u-boot/commitdiff
ahci: handle COMINIT received during spin-up
authorRob Herring <rob.herring@calxeda.com>
Sat, 24 Aug 2013 15:10:52 +0000 (10:10 -0500)
committerTom Rini <trini@ti.com>
Fri, 6 Sep 2013 17:09:07 +0000 (13:09 -0400)
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>
drivers/block/ahci.c

index 5e7d01ba61dff763d898d62d67e256f03d9273c5..a7044f2ea7aef3b5a65a382783e5f90a72988f21 100644 (file)
@@ -243,8 +243,20 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
                        if (!(tmp & (ATA_STAT_BUSY | ATA_STAT_DRQ)))
                                break;
                        udelay(1000);
+                       tmp = readl(port_mmio + PORT_SCR_STAT);
+                       tmp &= PORT_SCR_STAT_DET_MASK;
+                       if (tmp == PORT_SCR_STAT_DET_PHYRDY)
+                               break;
                        j++;
                }
+
+               tmp = readl(port_mmio + PORT_SCR_STAT) & PORT_SCR_STAT_DET_MASK;
+               if (tmp == PORT_SCR_STAT_DET_COMINIT) {
+                       debug("SATA link %d down (COMINIT received), retrying...\n", i);
+                       i--;
+                       continue;
+               }
+
                printf("Target spinup took %d ms.\n", j);
                if (j == WAIT_MS_SPINUP)
                        debug("timeout.\n");