From patchwork Thu Oct 6 06:03:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 117952 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 23D3DB6F9A for ; Thu, 6 Oct 2011 17:04:20 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932717Ab1JFGER (ORCPT ); Thu, 6 Oct 2011 02:04:17 -0400 Received: from smtp-out.google.com ([74.125.121.67]:1902 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932714Ab1JFGEQ (ORCPT ); Thu, 6 Oct 2011 02:04:16 -0400 Received: from hpaq5.eem.corp.google.com (hpaq5.eem.corp.google.com [172.25.149.5]) by smtp-out.google.com with ESMTP id p9664FXP031929; Wed, 5 Oct 2011 23:04:15 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1317881055; bh=ecMwOzE/+pvMk4QcIn8QUbpGBmw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=sUUPLi1tMayq1LefFTxgwxHjfpcBO2uFqkAMjzSvf7ON31vgHThuj1AAIlh3MwNjm 1zR7aZBhTY6qbB66dtx5Q== 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=E1ukh8ESw4AVI8pE4AYb6jxF4jgmRoymlJBeJeatWCHHJ5J4Z3FbVDsDc2NkwKiTU sVLIjFnTZwOW5aXvxPI/w== Received: from hippo3.mtv.corp.google.com (hippo3.mtv.corp.google.com [172.18.64.15]) by hpaq5.eem.corp.google.com with ESMTP id p9664DUL015643; Wed, 5 Oct 2011 23:04:13 -0700 Received: by hippo3.mtv.corp.google.com (Postfix, from userid 60833) id 09CA52137A; Wed, 5 Oct 2011 23:04:12 -0700 (PDT) From: Gwendal Grignou To: mihrcke@gmail.com Cc: linux-ide@vger.kernel.org, Gwendal Grignou Subject: [PATCH] libata: Allow SOFT_RESET for Sil3726 Date: Wed, 5 Oct 2011 23:03:57 -0700 Message-Id: <1317881037-11831-1-git-send-email-gwendal@google.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: References: Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Allow controllers to send SOFT_RESET to Sil3726 PMP. This PMP does not accept frames until the drive connected to its port spins up. Some controller [Sil3132 family] can not wait for the drive to spinup and fails the reset, leading to unnecessary speed downgrade. Not allowing to send SOFT_RESET can lead some drive slow to spinup to be ignored and produces weird error messages. This fix allows the error handler to wait if the controller is unable to send a SOFT_RESET. Change-Id: I7eeea152facb4b76e5c69cfde5ef8188874fbaba Signed-off-by: Gwendal Grignou --- drivers/ata/libata-eh.c | 11 ++++++++++- drivers/ata/libata-pmp.c | 10 ++++------ include/linux/libata.h | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 49af350..60223c3 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2805,7 +2805,14 @@ 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) + goto out; + + /* Some PMP will not serve SRST until the disk is spunup, + * if the controller can not wait for the PMP to acknowledge the frame, + * wait here */ + if (rc == -ERESTART && + !((lflags & ATA_LFLAG_WAIT_SRST) && (reset == softreset))) goto out; now = jiffies; @@ -2820,6 +2827,8 @@ int ata_eh_reset(struct ata_link *link, int classify, delta = schedule_timeout_uninterruptible(delta); } + if (rc == -ERESTART) + 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 ad0e71d..5fbbe2f 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c @@ -365,13 +365,11 @@ static void sata_pmp_quirks(struct ata_port *ap) if (vendor == 0x1095 && devid == 0x3726) { /* sil3726 quirks */ ata_for_each_link(link, ap, EDGE) { - /* Class code report is unreliable and SRST - * times out under certain configurations. - */ + /* Class code report is unreliable */ + /* PMP does not forward SRST until the drive spins up */ if (link->pmp < 5) - link->flags |= ATA_LFLAG_NO_SRST | - ATA_LFLAG_ASSUME_ATA; - + link->flags |= ATA_LFLAG_ASSUME_ATA | + ATA_LFLAG_WAIT_SRST; /* port 5 is for SEMB device and it doesn't like SRST */ if (link->pmp == 5) link->flags |= ATA_LFLAG_NO_SRST | diff --git a/include/linux/libata.h b/include/linux/libata.h index 14b9f50..4577ed2 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -173,6 +173,7 @@ enum { ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */ ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */ ATA_LFLAG_PHYOFF = (1 << 8), /* phy is powered off */ + ATA_LFLAG_WAIT_SRST = (1 << 9), /* add delay when SRST fails */ /* struct ata_port flags */ ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */