From patchwork Thu Oct 20 00:17:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 120713 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 7D2F5B71AB for ; Thu, 20 Oct 2011 11:17:40 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753997Ab1JTARf (ORCPT ); Wed, 19 Oct 2011 20:17:35 -0400 Received: from smtp-out.google.com ([216.239.44.51]:57478 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751007Ab1JTARe (ORCPT ); Wed, 19 Oct 2011 20:17:34 -0400 Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id p9K0H5WL001145; Wed, 19 Oct 2011 17:17:05 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1319069825; bh=FLtOKoSlnK5shN4bKj/WxPT9M4E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=DMm+SJq3a0vzP7wJOlv2vJnpLy8ShyI7hAF2TBvg708FkDmhPDCAiozskmyuZsmfI DaK6P/e11bgqyj4bFjMig== 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=jszBJ6IUGWdJO/TgojeAPxNCxctfe4DNA5zHELORSCRwm9DMCuP0PiMfcQyeKmP8o uek0xoUs9UBO2yPSp1E0g== Received: from hippo3.mtv.corp.google.com (hippo3.mtv.corp.google.com [172.18.64.15]) by wpaz21.hot.corp.google.com with ESMTP id p9K0H4sN018643; Wed, 19 Oct 2011 17:17:04 -0700 Received: by hippo3.mtv.corp.google.com (Postfix, from userid 60833) id 3EFE820BD1; Wed, 19 Oct 2011 17:17:04 -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:17:02 -0700 Message-Id: <1319069822-21351-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. 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)