From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Herring Date: Sat, 24 Aug 2013 10:10:52 -0500 Subject: [U-Boot] [PATCH v2 6/8] ahci: handle COMINIT received during spin-up In-Reply-To: <1377357054-27408-1-git-send-email-robherring2@gmail.com> References: <1377357054-27408-1-git-send-email-robherring2@gmail.com> Message-ID: <1377357054-27408-6-git-send-email-robherring2@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Rob Herring 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 --- v2: Use define values for PORT_SCR drivers/block/ahci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index 5e7d01b..a7044f2 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -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"); -- 1.8.1.2