From patchwork Mon Jan 23 17:00:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 92249 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1321120qgi; Mon, 23 Jan 2017 09:08:10 -0800 (PST) X-Received: by 10.237.47.161 with SMTP id m30mr25744547qtd.20.1485191290353; Mon, 23 Jan 2017 09:08:10 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id z13si11178006qtb.229.2017.01.23.09.08.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2017 09:08:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cVi6C-0007ar-7D; Mon, 23 Jan 2017 17:08:08 +0000 Received: from mail-wm0-f41.google.com ([74.125.82.41]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cVi0s-0002bG-FP for linux-arm-kernel@lists.infradead.org; Mon, 23 Jan 2017 17:02:40 +0000 Received: by mail-wm0-f41.google.com with SMTP id r126so142649501wmr.0 for ; Mon, 23 Jan 2017 09:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VaEcPb8epkQ54nK3HBwY3922VqlqjjxvgCWx3XjYNFs=; b=I7Z+4hIZex+ZEaFijo9Asr8K+yWDt7nlftJ4wrvVEt39Ci4VGpHMzUvtdwuj+KJzUH kj8mia5hlDe2klLrme6qBdTeXcLhVhPzcoY3X/OLIUONMaJi1z/tvRQQl3Xc2Ejb7opD b5hRbBeByOyeBbaxnWkgOoCvGcFFMoBnm9rX97O73ovNJX5d05f8y9hVUvi4YkttEwc3 Upy4Qif8xfoCIRUrI7KSK4Kcs4h4LN23pfJ9k/ClMEeHiiMowb23PpNrXjiO1tX3MEic x3CIY0Dqolag6+2h3Th3/MBlxAN8pCBkJwbFtQzC6W82dL+rQ35Gv2wmk/PoQP5v+vju HD3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VaEcPb8epkQ54nK3HBwY3922VqlqjjxvgCWx3XjYNFs=; b=nwQNOr6LmQhdv3d46H7eMlN+mBnQt3b4UPqaxYIX9/X3IbvDen8YPE5R5BP7+V9zOk TEbZBU4a/yJc3/ISO0xGTd2c2CgIxPPwDTNi23dR95MWePBDIJ+c3Mcs5AmC61HO0cmZ 45mu8ty2gId1sSEg6y13XUe/nZFIe5EvIxqQeIXL9aG12hjqdcxJH2DLY9cDcbwO40fy 2vmfi3fmdsIvvwy0/PPlEPf8RFj/mzR8nDuCjebFFoS03XYHrumtWEWcpMbxr73FWTOl KCqJhsYIutJAhMezSYpoacQ2SQA0+5qQNAKPqoBZBrYaqrrNVS5YH0Q+R4E4kUTPZj/D wJ+Q== X-Gm-Message-State: AIkVDXKmRs4d0/c6BWscMgLuNIfBlzXVtPK+cW0T82TT5Y/d93iOIuGpP/ajZeN26aWaf20G X-Received: by 10.28.19.78 with SMTP id 75mr15954838wmt.108.1485190876641; Mon, 23 Jan 2017 09:01:16 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l10sm12758910wrb.44.2017.01.23.09.01.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 09:01:15 -0800 (PST) From: Bartosz Golaszewski To: Kevin Hilman , Sekhar Nori , Patrick Titiano , Michael Turquette , Tejun Heo , Rob Herring , Mark Rutland , Russell King , David Lechner Subject: [PATCH v6 10/14] sata: ahci-da850: add a workaround for controller instability Date: Mon, 23 Jan 2017 18:00:52 +0100 Message-Id: <1485190856-4711-11-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1485190856-4711-1-git-send-email-bgolaszewski@baylibre.com> References: <1485190856-4711-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170123_090238_672453_D7241F47 X-CRM114-Status: GOOD ( 17.04 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.5 RCVD_IN_SORBS_SPAM RBL: SORBS: sender is a spam source [74.125.82.41 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.41 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.41 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ide@vger.kernel.org, Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org We have a use case with the da850 SATA controller where at PLL0 frequency of 456MHz (needed to properly service the LCD controller) the chip becomes unstable and the hardreset operation is ignored the first time 50% of times. The sata core driver already retries to resume the link because some controllers ignore writes to the SControl register, but just retrying the resume operation doesn't work - we need to issue he phy/wake reset again to make it work. Reimplement ahci_hardreset() in the driver and poke the controller a couple times before really giving up. Signed-off-by: Bartosz Golaszewski Acked-by: Tejun Heo --- drivers/ata/ahci_da850.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) -- 2.9.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c index 11dd87e..0b2b1a4 100644 --- a/drivers/ata/ahci_da850.c +++ b/drivers/ata/ahci_da850.c @@ -16,7 +16,8 @@ #include #include "ahci.h" -#define DRV_NAME "ahci_da850" +#define DRV_NAME "ahci_da850" +#define HARDRESET_RETRIES 5 /* SATA PHY Control Register offset from AHCI base */ #define SATA_P0PHYCR_REG 0x178 @@ -76,6 +77,29 @@ static int ahci_da850_softreset(struct ata_link *link, return ret; } +static int ahci_da850_hardreset(struct ata_link *link, + unsigned int *class, unsigned long deadline) +{ + int ret, retry = HARDRESET_RETRIES; + bool online; + + /* + * In order to correctly service the LCD controller of the da850 SoC, + * we increased the PLL0 frequency to 456MHz from the default 300MHz. + * + * This made the SATA controller unstable and the hardreset operation + * does not always succeed the first time. Before really giving up to + * bring up the link, retry the reset a couple times. + */ + do { + ret = ahci_do_hardreset(link, class, deadline, &online); + if (online) + return ret; + } while (retry--); + + return ret; +} + static struct ata_port_operations ahci_da850_port_ops = { .inherits = &ahci_platform_ops, .softreset = ahci_da850_softreset, @@ -83,6 +107,8 @@ static struct ata_port_operations ahci_da850_port_ops = { * No need to override .pmp_softreset - it's only used for actual * PMP-enabled ports. */ + .hardreset = ahci_da850_hardreset, + .pmp_hardreset = ahci_da850_hardreset, }; static const struct ata_port_info ahci_da850_port_info = {