From patchwork Fri Jan 8 00:03:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 7981041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3CC50BEEE5 for ; Fri, 8 Jan 2016 00:06:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D1EE20122 for ; Fri, 8 Jan 2016 00:06:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8270A200E9 for ; Fri, 8 Jan 2016 00:06:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aHKYV-0007HW-T2; Fri, 08 Jan 2016 00:05:23 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aHKXz-0006Bj-Sd for linux-arm-kernel@lists.infradead.org; Fri, 08 Jan 2016 00:04:53 +0000 Received: by mail-pa0-x235.google.com with SMTP id uo6so253338447pac.1 for ; Thu, 07 Jan 2016 16:04:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=494SfSfvLFHju5BYBCH4o+vRLbAN9TFRsC65zQgPNu0=; b=MVooTv3T3Wh8Tihrt0Y4Mus8CfBa51Rltjtlpcc6F2bdOiGpJ4YR4wdm4d/TT1g8pi VxSRXegYZbyIveBC2psOozUNoV8WywanMaN1/XmFb8Mgz47dOoO6Z8p23jKIpmy7tL3g TqOHsSNQjsJpjcHUEt83sBI2bJSEJqEziCFr+3Gp87/fbkt/ORnUcSOOoXW3+SO2NmsG u4B7BRUCvAvYDBrQn3ss55hJR/ZntFPYzWrqOT+w0acP62wsC8/3F7h5PNtOmH+sMmEn pTzfrQUKOjLC4vENTzba+5BhwLHarMdM/Xou09/EcD0gulWqlhC3Ur0zeUDGTaMv+hh/ U7nw== X-Received: by 10.66.100.135 with SMTP id ey7mr157187944pab.108.1452211473424; Thu, 07 Jan 2016 16:04:33 -0800 (PST) Received: from fainelli-desktop.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by smtp.gmail.com with ESMTPSA id wa17sm94069670pac.38.2016.01.07.16.04.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jan 2016 16:04:32 -0800 (PST) From: Florian Fainelli To: linux-ide@vger.kernel.org Subject: [PATCH 4/4] libata: skip debounce delay on link resume Date: Thu, 7 Jan 2016 16:03:33 -0800 Message-Id: <1452211413-1350-5-git-send-email-f.fainelli@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1452211413-1350-1-git-send-email-f.fainelli@gmail.com> References: <1452211413-1350-1-git-send-email-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160107_160452_113723_DD7D5326 X-CRM114-Status: GOOD ( 13.37 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , linux-kernel@vger.kernel.org, Danesh Petigara , bcm-kernel-feedback-list@broadcom.com, gregory.0xf0@gmail.com, computersforpeace@gmail.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Danesh Petigara The link resume logic uses a 200msec delay while debouncing the SControl register. The rationale behind that delay is to accommodate some PHYs that behave badly if their SStatus/ SControl registers are pounded immediately on resume. The Broadcom STB SATA PHY does not seem to have this issue. This patch introduces a new link flag that allows platforms to skip the debounce delay if it isn't needed. Signed-off-by: Danesh Petigara Signed-off-by: Florian Fainelli --- drivers/ata/ahci_brcmstb.c | 1 + drivers/ata/libata-core.c | 3 ++- include/linux/libata.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci_brcmstb.c b/drivers/ata/ahci_brcmstb.c index e518a992e774..9d57a27944bc 100644 --- a/drivers/ata/ahci_brcmstb.c +++ b/drivers/ata/ahci_brcmstb.c @@ -86,6 +86,7 @@ struct brcm_ahci_priv { static const struct ata_port_info ahci_brcm_port_info = { .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM, .flags2 = ATA_FLAG2_WAKE_BEFORE_STOP, + .link_flags = ATA_LFLAG_NO_DB_DELAY, .pio_mask = ATA_PIO4, .udma_mask = ATA_UDMA6, .port_ops = &ahci_platform_ops, diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c6117e1ad373..b7b578522a13 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -3597,7 +3597,8 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params, * immediately after resuming. Delay 200ms before * debouncing. */ - ata_msleep(link->ap, 200); + if (!(link->flags & ATA_LFLAG_NO_DB_DELAY)) + ata_msleep(link->ap, 200); /* is SControl restored correctly? */ if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol))) diff --git a/include/linux/libata.h b/include/linux/libata.h index f278ca897274..e8b1759ff855 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -205,6 +205,7 @@ enum { ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */ ATA_LFLAG_RST_ONCE = (1 << 9), /* limit recovery to one reset */ ATA_LFLAG_CHANGED = (1 << 10), /* LPM state changed on this link */ + ATA_LFLAG_NO_DB_DELAY = (1 << 11), /* no debounce delay on link resume */ /* struct ata_port flags */ ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */