From patchwork Thu Oct 20 00:02:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 120709 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 078F5B71C7 for ; Thu, 20 Oct 2011 11:03:11 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755512Ab1JTADH (ORCPT ); Wed, 19 Oct 2011 20:03:07 -0400 Received: from smtp-out.google.com ([216.239.44.51]:51237 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019Ab1JTADH (ORCPT ); Wed, 19 Oct 2011 20:03:07 -0400 Received: from wpaz29.hot.corp.google.com (wpaz29.hot.corp.google.com [172.24.198.93]) by smtp-out.google.com with ESMTP id p9K02umW008078; Wed, 19 Oct 2011 17:02:56 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1319068976; bh=u0k6Z+8TQqBpZLgNtxuviTK7aN8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=W0qL8veG5pY83EhnbUnU3FbMuA1nr5ksTlsZnUWx8MDqEMKpFeXqLAD2NnBejfC4Z IRVNpPU1TQMn+9b+FH7wQ== 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=ErimQgKMhSg2tN/vVgmsYyyg5Pqr4KNIZ5GNCGkS5D7sXhSPAjLZ6K/Tkk06AYEfQ PfiYRXObaY9Kp9j+fPO2A== Received: from hippo3.mtv.corp.google.com (hippo3.mtv.corp.google.com [172.18.64.15]) by wpaz29.hot.corp.google.com with ESMTP id p9K02sWG012541; Wed, 19 Oct 2011 17:02:55 -0700 Received: by hippo3.mtv.corp.google.com (Postfix, from userid 60833) id 8E21620AAF; Wed, 19 Oct 2011 17:02:49 -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 Sil3726 PMP Date: Wed, 19 Oct 2011 17:02:42 -0700 Message-Id: <1319068962-18983-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 controller reissues the reset until the drive is ready, while some [Sil3124] returns an error. In ata_eh_error, wait 10s before reset the ATA port and try again. --- 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)