From patchwork Mon Jan 23 17:00:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 92247 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1320709qgi; Mon, 23 Jan 2017 09:07:17 -0800 (PST) X-Received: by 10.200.37.125 with SMTP id 58mr25453078qtn.232.1485191237659; Mon, 23 Jan 2017 09:07:17 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id k5si11196100qta.43.2017.01.23.09.07.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2017 09:07:17 -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 1cVi5K-0007BK-Q0; Mon, 23 Jan 2017 17:07:14 +0000 Received: from mail-wm0-f54.google.com ([74.125.82.54]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cVi0q-0002b8-0d for linux-arm-kernel@lists.infradead.org; Mon, 23 Jan 2017 17:02:37 +0000 Received: by mail-wm0-f54.google.com with SMTP id c206so165799461wme.0 for ; Mon, 23 Jan 2017 09:02:15 -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=Awn7ZjAtjuKnYoy8GrOllkRz+fCJp74u4CmvWaqCx/M=; b=Hv38iPgXrlxmN3Uy/G/kVHMM2ofZzXDZ7UL7u8vXZhKr5Lh26ZQd5SEjaXlygSXM/D HOJL91sxtnetQamCONoMQ9zo/lYCDlFaFyePRFvj+FpQYS0NhcpeM+8xysh/pzy71Qml Agi7sdDgBn2SdG0+2lKxgWIAGEIqTMBvXV3drHx9BFzAdGZ1vW4FFNO7DSkFjREyY6SC pfEW2e9n9raQEIuB7hmQYqWYA35+Q79UcX59pWOjcTGOcITVP4t1TUaQRKrE8S4nsjn/ XuSOdwfkx3ZvT+9okehDZCsW2CwAxekXGFsWDzLQiErOL9UUFjrHpcxL+ADkNsJNdi2E P8SQ== 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=Awn7ZjAtjuKnYoy8GrOllkRz+fCJp74u4CmvWaqCx/M=; b=Y6T/sipzqtLVq6SCHZtOeuunXibsK8KXaPSC0BSM3HiwGB7kO5JJNRTUkTnlEb/7iW S6vloKN7EjJ+6U+UNC1hlw9kL/A9AblMS2n0lAVDroJgA9PrbWIcIuJFDxSuI5e4gUVj nP0hQ+jh0A4X5nCJkSLbLRSK37cZst4PCHM5Q4x5XA0yfLHBIFJU4K8inv0wvcOeCfSX gYpDW7wq+QUw0g3qpi+nOI2/0UYZJtjxvWyWxRvtG+tLwaJWGxSZNxBCnJWpp/Jipdo4 2+QdVjxilRXzhmSS5l/gRuxnPKriClNq+SF2IJ/cgDGq8Ur1ATzdm2vOPeVMrXLhN0rH CZFw== X-Gm-Message-State: AIkVDXJVcbUsl27VCIWuiXtoxlEdRJkT61j6e8JW6kyYXgvBZbp6SK3p2yMekROENmvDuX0T X-Received: by 10.223.176.16 with SMTP id f16mr15082398wra.113.1485190874208; Mon, 23 Jan 2017 09:01:14 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l10sm12758910wrb.44.2017.01.23.09.01.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 09:01:13 -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 08/14] sata: ahci-da850: implement a workaround for the softreset quirk Date: Mon, 23 Jan 2017 18:00:50 +0100 Message-Id: <1485190856-4711-9-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_090236_221487_AD312115 X-CRM114-Status: GOOD ( 16.86 ) 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.54 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.54 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.54 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 There's an issue with the da850 SATA controller: if port multiplier support is compiled in, but we're connecting the drive directly to the SATA port on the board, the drive can't be detected. To make SATA work on the da850-lcdk board: first try to softreset with pmp - if the operation fails with -EBUSY, retry without pmp. Signed-off-by: Bartosz Golaszewski Acked-by: Tejun Heo --- drivers/ata/ahci_da850.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 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 7f5328f..11dd87e 100644 --- a/drivers/ata/ahci_da850.c +++ b/drivers/ata/ahci_da850.c @@ -54,11 +54,42 @@ static void da850_sata_init(struct device *dev, void __iomem *pwrdn_reg, writel(val, ahci_base + SATA_P0PHYCR_REG); } +static int ahci_da850_softreset(struct ata_link *link, + unsigned int *class, unsigned long deadline) +{ + int pmp, ret; + + pmp = sata_srst_pmp(link); + + /* + * There's an issue with the SATA controller on da850 SoCs: if we + * enable Port Multiplier support, but the drive is connected directly + * to the board, it can't be detected. As a workaround: if PMP is + * enabled, we first call ahci_do_softreset() and pass it the result of + * sata_srst_pmp(). If this call fails, we retry with pmp = 0. + */ + ret = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready); + if (pmp && ret == -EBUSY) + return ahci_do_softreset(link, class, 0, + deadline, ahci_check_ready); + + return ret; +} + +static struct ata_port_operations ahci_da850_port_ops = { + .inherits = &ahci_platform_ops, + .softreset = ahci_da850_softreset, + /* + * No need to override .pmp_softreset - it's only used for actual + * PMP-enabled ports. + */ +}; + static const struct ata_port_info ahci_da850_port_info = { .flags = AHCI_FLAG_COMMON, .pio_mask = ATA_PIO4, .udma_mask = ATA_UDMA6, - .port_ops = &ahci_platform_ops, + .port_ops = &ahci_da850_port_ops, }; static struct scsi_host_template ahci_platform_sht = {