From patchwork Mon Jan 30 10:02:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 92810 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1358650qgi; Mon, 30 Jan 2017 02:04:45 -0800 (PST) X-Received: by 10.84.136.34 with SMTP id 31mr30465991plk.52.1485770685753; Mon, 30 Jan 2017 02:04:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t25si8111401pgo.353.2017.01.30.02.04.45; Mon, 30 Jan 2017 02:04:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; 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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751283AbdA3KEk (ORCPT + 7 others); Mon, 30 Jan 2017 05:04:40 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:38855 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752108AbdA3KCZ (ORCPT ); Mon, 30 Jan 2017 05:02:25 -0500 Received: by mail-wm0-f50.google.com with SMTP id r141so25579351wmg.1 for ; Mon, 30 Jan 2017 02:02:24 -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=I95IOP7tcXFVHnlw7gTmFwx+7Cy0Oe2Di4eUdxW5Jjo=; b=fBv5jzTT71fDD8ShvJVOdKMmTi0zqoZZoj8bt0aj65QFyANH0+kTNqQvTJjLGSatpF UJW9TnlXLBXO1xJHtHKAMzytnlvq8a2GlKIAHgnIDD6Xw/yTRXHExiXWnslTZQUny2+O i1kp1XhkHeeK5jvGD7Zhzei2hyhd4cFmxoKrXFxlOloM4NGsOrtBb2iIW4Fy82Y0v9k9 khLbYRfR94FN7+ew/UyTSGOfIIo7JUbz/lqnomp67l4rCIe3K9fhVt850RjIiZ/TGsa1 wY7d5NvaodOatLf0pAUt2uLcq2L+thnSbcohTFswfhEfXAk4VlLk1kC57H9wNt17oeRS jnnw== 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=I95IOP7tcXFVHnlw7gTmFwx+7Cy0Oe2Di4eUdxW5Jjo=; b=F3m7UKOnCzr5znq8aZUqX64BZeaJX5sKDNuS0/tvjT5Yg5WTKoS02H2I8RdHkFUXWv xWBOZ23CWbK5+PtdEMsq9MUbLu5p7woGCE30H2xeaFf58oTOZnKRTNtCXnRLNRN7bl6i fopG0Yldau4+0/d/8rim93XOCSc3250LpWGEwc3aXpyLBFmZ6VHrJclo/7gy+AehdF7A HWrI+Hp+vevz0DOu/JMa5Yw1CCc5C/dOXkaUd8QhbUveuUT4mwS6fgl94vOHtHxksqvE BqGFK9WkSIRQUS7637ZbVAuXOHX6ZyKuqyoevLdb7n1du3OV3sTh130LBUj1c640/Svi mdIw== X-Gm-Message-State: AIkVDXJdG6ckL2p/XxyUQQi1tmaDbP0G0rFy8heaI4PRATx1OxDGSNNMVN/o+dxBRyvJQjLA X-Received: by 10.28.185.77 with SMTP id j74mr13934425wmf.76.1485770543735; Mon, 30 Jan 2017 02:02:23 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id j18sm21939536wrb.33.2017.01.30.02.02.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Jan 2017 02:02:23 -0800 (PST) From: Bartosz Golaszewski To: Kevin Hilman , Sekhar Nori , Patrick Titiano , Michael Turquette , Tejun Heo , Rob Herring , Mark Rutland , Russell King , David Lechner Cc: linux-ide@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [PATCH v7 08/14] sata: ahci-da850: implement a workaround for the softreset quirk Date: Mon, 30 Jan 2017 11:02:05 +0100 Message-Id: <1485770531-6772-9-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1485770531-6772-1-git-send-email-bgolaszewski@baylibre.com> References: <1485770531-6772-1-git-send-email-bgolaszewski@baylibre.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c index 72126a0..84c7805 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 = {