From patchwork Tue Mar 29 13:11:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 64597 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2003415lbc; Tue, 29 Mar 2016 06:11:59 -0700 (PDT) X-Received: by 10.66.164.39 with SMTP id yn7mr3288423pab.107.1459257109737; Tue, 29 Mar 2016 06:11:49 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13si21338167pfj.73.2016.03.29.06.11.49; Tue, 29 Mar 2016 06:11:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756283AbcC2NLn (ORCPT + 29 others); Tue, 29 Mar 2016 09:11:43 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37348 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756042AbcC2NLi (ORCPT ); Tue, 29 Mar 2016 09:11:38 -0400 Received: by mail-wm0-f45.google.com with SMTP id p65so25785093wmp.0 for ; Tue, 29 Mar 2016 06:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=40+8i3n82kyhmxK2Io//5lIxtAjsLj58Pej6GPj55ug=; b=Js2Id0x1H5cowEJ/i3fav6/kMRamaUjWKBwWosAhq0txxaaju4P8dkXWw5xObIiu4E mfF6RLe9IY9iNzVGeYJk9K8Wviro25SnSqNfOGpqTW+9lpnOIax4w+MAvQjTciWbf89r 5sQt9HZqu1fgQ5Vr8UiiAXpcATkS1RZs+0VU8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=40+8i3n82kyhmxK2Io//5lIxtAjsLj58Pej6GPj55ug=; b=MSj5d62R4bWh4jI71mTl/kLjokK/9CtSAKQg6ILb3RpdSV+G9VLsIOSmp2k73gUIfG nkscqlibCsCVCf+ZKwOI1iyntMsS2s3G95pWlZ+ATMeR2XL+pvuFr6ATrujp44TQE2x8 VPjlzzFh7v+yOlZR3ZBOq2ZjyTA3gAQePL0ilypyU1Ov78eXqSzyyU+O1Xg3PyiepmNq /J9eBJGQM2yekNqLo/kmKveSUzuzC0ugNF3S7rBSFSbM2D1XVtiEwRNHM8JvJJHZfh/y 6qEofxdZnCgXYZ+itJqeZ97iF2GtAWhVUaNc0fqEb5x9JIs8dSxAlr9z1cWSFcub/i6t Am4g== X-Gm-Message-State: AD7BkJI+5yOpI4TAvfR6WJLrg/IWNoYtFa+30KapEcrwYYCH7WEFiD7Yc2JKihx/ErsaboZ5 X-Received: by 10.28.105.5 with SMTP id e5mr3370646wmc.87.1459257091756; Tue, 29 Mar 2016 06:11:31 -0700 (PDT) Received: from localhost.localdomain (host-92-17-247-99.as13285.net. [92.17.247.99]) by smtp.gmail.com with ESMTPSA id m141sm14708795wma.3.2016.03.29.06.11.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Mar 2016 06:11:31 -0700 (PDT) From: Srinivas Kandagatla To: Tejun Heo , linux-ide@vger.kernel.org Cc: Rob Herring , Andy Gross , Hans de Goede , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jmaggard10@gmail.com, Srinivas Kandagatla Subject: [RFC PATCH 2/3] ata: ahci-platform: Add ports-implemented dt bindings. Date: Tue, 29 Mar 2016 14:11:14 +0100 Message-Id: <1459257075-21393-3-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459257075-21393-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1459257075-21393-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On some SOCs PORTS_IMPL register value is never programmed by the BIOS and left at zero value. Which means that no sata ports are avaiable for software. AHCI driver used to cope up with this by fabricating the port_map if the PORTS_IMPL register is read zero, but recent patch broke this workaround as zero value was valid for nvme disks. This patch adds ports-implemented dt bindings as workaround for this issue in a way that DT can dictate the port_map incase where the SOCs does not program it already. Fixes: 566d1827df2e ("libata: disable forced PORTS_IMPL for >= AHCI 1.3) Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/ata/ahci-platform.txt | 11 +++++++++++ drivers/ata/ahci_platform.c | 4 ++++ 2 files changed, 15 insertions(+) -- 2.5.0 diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt index 30df832..8165db3 100644 --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt @@ -32,6 +32,10 @@ Optional properties: - target-supply : regulator for SATA target power - phys : reference to the SATA PHY node - phy-names : must be "sata-phy" +- ports-implemented : Mask that indicates which ports that the HBA supports + are available for software to use. Useful if PORTS_IMPL + is not programmed by the BIOS, which is true with + some embedded SOC's. Required properties when using sub-nodes: - #address-cells : number of cells to encode an address @@ -59,6 +63,13 @@ Examples: target-supply = <®_ahci_5v>; }; + sata0: sata@29000000 { /* Qualcomm APQ8064 */ + compatible = "generic-ahci"; + reg = <0x29000000 0x180>; + interrupts = ; + ports-implemented = <0x1>; + }; + With sub-nodes: sata@f7e90000 { compatible = "marvell,berlin2q-achi", "generic-ahci"; diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 4044233..ec8db80 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -42,6 +42,7 @@ static int ahci_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ahci_host_priv *hpriv; int rc; + u32 ports_impl; hpriv = ahci_platform_get_resources(pdev); if (IS_ERR(hpriv)) @@ -51,6 +52,9 @@ static int ahci_probe(struct platform_device *pdev) if (rc) return rc; + of_property_read_u32(dev->of_node, + "ports-implemented", &hpriv->force_port_map); + if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ;