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: 8686761 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 866B69F3D1 for ; Tue, 29 Mar 2016 13:14:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3F832026F for ; Tue, 29 Mar 2016 13:14:08 +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 C6A1620263 for ; Tue, 29 Mar 2016 13:14:07 +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 1aktRj-0004Vp-8L; Tue, 29 Mar 2016 13:12:35 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aktR3-000452-MM for linux-arm-kernel@lists.infradead.org; Tue, 29 Mar 2016 13:11:55 +0000 Received: by mail-wm0-x235.google.com with SMTP id r72so56344351wmg.0 for ; Tue, 29 Mar 2016 06:11:33 -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=k9qK8+yoJchBcYWRdZxiEI/YMylOG7Oh0FxG6HUSbHboSrXvcAGdoS1uX71H0RSgQ3 ltwPwFJqlYdCh3bUetAfbskTu6avLrTwoXh5gdjqK+BQzZiNz+zWGZqOUrHFHGIzxw8e d1PqUt4RSA7HfFE1SrXQb6mlfiZilLvC87bFH9/6iAOhRN8ZWuaJSH6Zf1M9ZktSRczy 3lZi2FaR31UnfzyIh6KhXbbFAf0X9LzGPmgfMa7hDdPTfy+tAsHl7OdecoRNMyDp75T3 VIuS58zz5W+ptVlj6wpHIE8H2oo6guRPyMkCyvDnVHOrihJUny6hhTGxQHyBST+2wr9y oBDA== X-Gm-Message-State: AD7BkJL1JHfko7il180ugICE5DSvYSAUhYZMUxtflRFqmCBo6+A2T5KHA3Xj4WVfGwKrTp+q 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160329_061153_978871_CEB452C4 X-CRM114-Status: GOOD ( 13.71 ) 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: devicetree@vger.kernel.org, jmaggard10@gmail.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Hans de Goede , Rob Herring , Srinivas Kandagatla , Andy Gross , linux-soc@vger.kernel.org, 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=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 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(+) 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;