From patchwork Thu Oct 20 00:35:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 120716 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 98C58B71C4 for ; Thu, 20 Oct 2011 11:36:12 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755244Ab1JTAgK (ORCPT ); Wed, 19 Oct 2011 20:36:10 -0400 Received: from smtp-out.google.com ([74.125.121.67]:22899 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753830Ab1JTAgJ (ORCPT ); Wed, 19 Oct 2011 20:36:09 -0400 Received: from hpaq14.eem.corp.google.com (hpaq14.eem.corp.google.com [172.25.149.14]) by smtp-out.google.com with ESMTP id p9K0a06b010447; Wed, 19 Oct 2011 17:36:00 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1319070960; bh=6c6PbYXlVvz7f59rFRK1WcvwvDU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=WlKilHHq87NcGNeCfAT+EBQMHO79M6n3D4f8rnS9CeAw4tXWmg2/F4O/1HHXcCbzM OIG6WvhRvd0G6liTnn+dQ== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=vJEIKnUe4zkDf+xpqz4H8XHkkX5RsLmRYIt33Knqb89brGd52OM7cmW9BTG1LU5cn o1paNTcbJhmmQjFPe/+4Q== Received: from hippo3.mtv.corp.google.com (hippo3.mtv.corp.google.com [172.18.64.15]) by hpaq14.eem.corp.google.com with ESMTP id p9K0ZtFx014951; Wed, 19 Oct 2011 17:35:55 -0700 Received: by hippo3.mtv.corp.google.com (Postfix, from userid 60833) id DDC0820AAF; Wed, 19 Oct 2011 17:35:54 -0700 (PDT) From: Gwendal Grignou To: htejun@gmail.com, kernel@teksavvy.com, mihrcke@gmail.com, derry@high-rely.com Cc: linux-ide@vger.kernel.org, Gwendal Grignou Subject: [PATCH] [libata]Issue SRST to Disks behind Sil3726 Date: Wed, 19 Oct 2011 17:35:53 -0700 Message-Id: <1319070953-24391-2-git-send-email-gwendal@google.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <4E959E1F.20001@teksavvy.com> References: <4E959E1F.20001@teksavvy.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Reenable sending SRST to devices connected behind a Sil3726 PMP. This allow staggered spinups and handles drives that spins up slowly. While the drives spin up, the PMP will not accept SRST. Most controllers reissue the reset until the drive is ready, while some [Sil3124] returns an error. In ata_eh_error, wait for the next reset deadline before resetting the ATA port and trying again. Signed-off-by: Gwendal Grignou --- drivers/ata/libata-eh.c | 12 +++++++++++- drivers/ata/libata-pmp.c | 7 ++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c021186..927d750 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2882,7 +2882,7 @@ int ata_eh_reset(struct ata_link *link, int classify, sata_scr_read(link, SCR_STATUS, &sstatus)) rc = -ERESTART; - if (rc == -ERESTART || try >= max_tries) { + if (try >= max_tries) { /* * Thaw host port even if reset failed, so that the port * can be retried on the next phy event. This risks @@ -2908,6 +2908,16 @@ int ata_eh_reset(struct ata_link *link, int classify, ata_eh_acquire(ap); } + /* + * While disks spinup behind PMP, some controllers fail sending SRST. + * They need to be reset - as well as the PMP - before retrying. + */ + if (rc == -ERESTART) { + if (ata_is_host_link(link)) + ata_eh_thaw_port(ap); + goto out; + } + if (try == max_tries - 1) { sata_down_spd_limit(link, 0); if (slave) diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 3eb2b81..183643f 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c @@ -388,12 +388,9 @@ static void sata_pmp_quirks(struct ata_port *ap) /* link reports offline after LPM */ link->flags |= ATA_LFLAG_NO_LPM; - /* Class code report is unreliable and SRST - * times out under certain configurations. - */ + /* Class code report is unreliable. */ if (link->pmp < 5) - link->flags |= ATA_LFLAG_NO_SRST | - ATA_LFLAG_ASSUME_ATA; + link->flags |= ATA_LFLAG_ASSUME_ATA; /* port 5 is for SEMB device and it doesn't like SRST */ if (link->pmp == 5)