From patchwork Fri Apr 1 07:52:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 604611 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qbttQ4R3Vz9sCj for ; Fri, 1 Apr 2016 18:53:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=afMBiUnb; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758829AbcDAHxp (ORCPT ); Fri, 1 Apr 2016 03:53:45 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:38213 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758311AbcDAHxL (ORCPT ); Fri, 1 Apr 2016 03:53:11 -0400 Received: by mail-wm0-f46.google.com with SMTP id 20so12181973wmh.1 for ; Fri, 01 Apr 2016 00:53:09 -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=3V+ysiN5MIy9cOk1hbmqvENtUJH8uSaPqJMzOXy1oSA=; b=afMBiUnbp7JNwI0AYypxo79LIbMf6IonnftegLp+92qxj66gxsA3fJHKH34WlrsMkm 1SjKl6t03DBW2tpBug9RRehRue2XFfARlrxPp0BTzxesK6sBzGKxRYyjs2HTCGP2hymU /E4x3eewI+dhSVOaaTlIZGpk5e4Kkc1HEjVX4= 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=3V+ysiN5MIy9cOk1hbmqvENtUJH8uSaPqJMzOXy1oSA=; b=OKs6/cbC6RY56NGpcr6ap091wCBARhwNC/wUihKCokm5gnkbxX783K2fpwzlfxQC3e Id39ejADMDsaUh1mgLRLZTCWD1fpEtZDM8Kfn7jbh+DfVy3R6YDFxwAcA6NtKRhtt/z1 S+2SRr7ZcKUz6wsWbBBeKsgPTSQEG/0o92dpX5EWA+yoSoFWGWJoeF1nSKzJYDTpKW8u jNu8C622GBfmL9f8hFAFJxu8ImZABohtErAAjEAM4bMYl5/20GP5cKP9d0YiVeyKEBZY 57OoUkV48rgQJGYYGRmVxoO9NzOn5iZjyLgejqlkoSNe19OoHkNdVPBxynNE/MLqll3V 7Ynw== X-Gm-Message-State: AD7BkJJ9kNQ1xd16nt43gCtnXiToWCmqAu21K91XMq55xzjSm5EJEBicKUacEM7Y04RCS76E X-Received: by 10.28.19.140 with SMTP id 134mr2290821wmt.73.1459497188771; Fri, 01 Apr 2016 00:53:08 -0700 (PDT) Received: from localhost.localdomain (host-92-17-247-99.as13285.net. [92.17.247.99]) by smtp.gmail.com with ESMTPSA id x203sm13169192wmg.23.2016.04.01.00.53.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Apr 2016 00:53:08 -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: [PATCH v3 2/3] ata: ahci-platform: Add ports-implemented DT bindings. Date: Fri, 1 Apr 2016 08:52:57 +0100 Message-Id: <1459497178-31090-3-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459497178-31090-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1459497178-31090-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org On some SOCs PORTS_IMPL register value is never programmed by the firmware and left at zero value. Which means that no sata ports are available 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 can override the PORTS_IMPL register in cases where the firmware did not program it already. Fixes: 566d1827df2e ("libata: disable forced PORTS_IMPL for >= AHCI 1.3) Signed-off-by: Srinivas Kandagatla Acked-by: Tejun Heo Reviewed-by: Andy Gross Acked-by: Rob Herring --- Documentation/devicetree/bindings/ata/ahci-platform.txt | 4 ++++ drivers/ata/ahci_platform.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt index 30df832..87adfb2 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 diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 4044233..62a04c8 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -51,6 +51,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;