From patchwork Tue May 21 22:44:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 245443 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 317C52C0084 for ; Wed, 22 May 2013 08:46:09 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EE4A14A131; Wed, 22 May 2013 00:45:59 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u64BGOYYubYb; Wed, 22 May 2013 00:45:59 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9BEA4A141; Wed, 22 May 2013 00:45:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5D08D4A105 for ; Wed, 22 May 2013 00:45:20 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xhZNTwK0LFgj for ; Wed, 22 May 2013 00:45:15 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=ERR(-1.5) (only DNSBL check requested) Received: from mail-ie0-f181.google.com (mail-ie0-f181.google.com [209.85.223.181]) by theia.denx.de (Postfix) with ESMTPS id 505AA4A10D for ; Wed, 22 May 2013 00:44:59 +0200 (CEST) Received: by mail-ie0-f181.google.com with SMTP id x12so3475862ief.12 for ; Tue, 21 May 2013 15:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=VaAIUvv7hszFxLU+CELG4SYeGksRYHGvY1+Xb3xifqA=; b=PUpVWjL/xC0Ap0yNfnK+Q2pyQfvVWkLbB22lKXG87wT7AA/6uWk+1MRxknl0/Ib75I GiBjipS/lDZedUMHiXp4nb2xkAvoqY12oNttfyg/xSprHRsHA6eBVaMS9dZMJ0PGUoy6 azozTynyd9AeovibZ7AQ4zL8Z/tv7sxL4ePOsY3Aqkcjv/e2GqWGlQWGPianCJS3uDDH Rzy2EIXoF33CO7S4ho37Tixi4uPbATeHUIv5MrtPJ4Qi1qR1+wYqvUGhZBZCupw95kcS 9o3sQmZzcC5kJuSBf1iwBsHXJUabz4dGuR8WU3T0t34ue9Jmr5+u9i8XV8YvBg9EpH0o Qoeg== X-Received: by 10.50.153.42 with SMTP id vd10mr2690009igb.43.1369176297850; Tue, 21 May 2013 15:44:57 -0700 (PDT) Received: from rob-laptop.calxeda.com ([173.226.190.126]) by mx.google.com with ESMTPSA id 9sm18381610igy.7.2013.05.21.15.44.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 May 2013 15:44:57 -0700 (PDT) From: Rob Herring To: u-boot@lists.denx.de Date: Tue, 21 May 2013 17:44:34 -0500 Message-Id: <1369176276-1895-5-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1369176276-1895-1-git-send-email-robherring2@gmail.com> References: <1369176276-1895-1-git-send-email-robherring2@gmail.com> Cc: Rob Herring Subject: [U-Boot] [PATCH 5/7] ahci: handle COMINIT received during spin-up X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@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 --- drivers/block/ahci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index 79710ef..5ffdf95 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -260,8 +260,19 @@ 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) & 0xf; + if (tmp == 0x1) + break; j++; } + + tmp = readl(port_mmio + PORT_SCR_STAT) & 0xf; + if (tmp == 0x1) { + 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");