From patchwork Fri Dec 8 09:20:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 846061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NiqexMaq"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ytRjW47pkz9s74 for ; Fri, 8 Dec 2017 20:23:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752604AbdLHJXG (ORCPT ); Fri, 8 Dec 2017 04:23:06 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:46276 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183AbdLHJXE (ORCPT ); Fri, 8 Dec 2017 04:23:04 -0500 Received: by mail-wm0-f65.google.com with SMTP id r78so2232973wme.5 for ; Fri, 08 Dec 2017 01:23:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=IT9l0qhS/t3jtZz4E9gIzBXPHLpp/hrKXN+Fiq3747w=; b=NiqexMaqFWGs+02HI7mJUv0uiGl2fDbJjYmsx68ta5ZqO94gymdPILTwja9fSul1lh 5OroXOzrW4ORq4FexknS0oavQ7q7Yyi60kLrkdvh4YvNUYeeMYi2DYW4Qdgx16+DQ0bx VG8yxXd4atrU+g+Z7tE4sQNcJ9aZ+ebn40RLg= 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; bh=IT9l0qhS/t3jtZz4E9gIzBXPHLpp/hrKXN+Fiq3747w=; b=SP9J0tSnEpGTU1UYDKYqehf3mSR19vO3gCN8WXjfyM2oXdFRkfRQbcw63Y7CvnXsBw uVYbp3WglGbcXt4NNKoV7UtFz0eqiKVZ8Qu2FWiKDbzNt1gjHa1WalKQXAXpqWpotKDW wzR8NJQgmkKNtUEiPQUPALcO6jvNj8nWmHEClz5N7FOa+yezOPfD0dfy9pf6xwzvPDCW N5W1LwC47UCag4GlFsh2wHRLoc9DuYd9D48Fl1A+HzfNnjSrz6k3c2Gmam0EAFe32m3s xSyHg48+tdwcRkHpKVSZfHmqLZt2qFISGN4bKl2fug41ZKIQNd/MMkhpMSkJ2kkucCPf oLJg== X-Gm-Message-State: AKGB3mKkNHHJd6BbwYLS6Txr8xz9XoqYiZ2I4tOtCk/LWCX/g4cCnvdq kYKx7NS/1yWGlga2AdQaz80bfA== X-Google-Smtp-Source: AGs4zMbunHtptAL5jhfq6kKZLaAeEj2SR3H/EqBsNqFqG2rHKi5FtKUFjVs8mGCTrK8A/kqJml83wg== X-Received: by 10.28.122.18 with SMTP id v18mr3962993wmc.3.1512724983356; Fri, 08 Dec 2017 01:23:03 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id y89sm1148740wmh.0.2017.12.08.01.23.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Dec 2017 01:23:02 -0800 (PST) From: srinivas.kandagatla@linaro.org To: stanimir.varbanov@linaro.org, Stanimir Varbanov , linux-pci@vger.kernel.org, bhelgaas@google.com Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH] PCI: qcom: add missing supplies required for msm8996 Date: Fri, 8 Dec 2017 09:20:53 +0000 Message-Id: <20171208092053.4417-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Srinivas Kandagatla This patch adds supplies that are required for msm8996. Two of them vdda and vdda-1p8 are analog supplies that go in to controller, and the rest of the two vddpe's are supplies to PCIe endpoints. Without these supplies PCIe endpoints which require power supplies are not enumerated at all, as there is no one to power it up. Signed-off-by: Srinivas Kandagatla Reviewed-by: Rob Herring --- .../devicetree/bindings/pci/qcom,pcie.txt | 16 +++++++++++++ drivers/pci/dwc/pcie-qcom.c | 28 ++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt index 3c9d321b3d3b..045102cb3e12 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt @@ -179,6 +179,11 @@ Value type: Definition: A phandle to the core analog power supply +- vdda-1p8-supply: + Usage: required for msm8996 + Value type: + Definition: A phandle to the 1.8v analog power supply + - vdda_phy-supply: Usage: required for ipq/apq8064 Value type: @@ -189,6 +194,15 @@ Value type: Definition: A phandle to the analog power supply for IC which generates reference clock +- vddpe-supply: + Usage: optional + Value type: + Definition: A phandle to the PCIe endpoint power supply + +- vddpe1-supply: + Usage: optional + Value type: + Definition: A phandle to the PCIe endpoint power supply 1 - phys: Usage: required for apq8084 @@ -205,6 +219,8 @@ Value type: Definition: List of phandle and GPIO specifier pairs. Should contain - "perst-gpios" PCIe endpoint reset signal line + - "pe_en-gpios" PCIe endpoint enable signal line + - "pe_en1-gpios" PCIe endpoint enable1 signal line - "wake-gpios" PCIe endpoint wake signal line * Example for ipq/apq8064 diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c index 952a4fc4bf3c..01488f90da31 100644 --- a/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/dwc/pcie-qcom.c @@ -109,13 +109,15 @@ struct qcom_pcie_resources_1_0_0 { struct reset_control *core; struct regulator *vdda; }; - +#define QCOM_PCIE_MAX_SUPPLY 4 struct qcom_pcie_resources_2_3_2 { struct clk *aux_clk; struct clk *master_clk; struct clk *slave_clk; struct clk *cfg_clk; struct clk *pipe_clk; + int num_supplies; + struct regulator_bulk_data supplies[QCOM_PCIE_MAX_SUPPLY]; }; struct qcom_pcie_resources_2_4_0 { @@ -529,6 +531,17 @@ static int qcom_pcie_get_resources_2_3_2(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_3_2 *res = &pcie->res.v2_3_2; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; + int ret; + + res->supplies[0].supply = "vdda"; + res->supplies[1].supply = "vdda-1p8"; + res->supplies[2].supply = "vddpe"; + res->supplies[3].supply = "vddpe1"; + res->num_supplies = QCOM_PCIE_MAX_SUPPLY; + ret = devm_regulator_bulk_get(dev, QCOM_PCIE_MAX_SUPPLY, + res->supplies); + if (ret) + return ret; res->aux_clk = devm_clk_get(dev, "aux"); if (IS_ERR(res->aux_clk)) @@ -558,6 +571,8 @@ static void qcom_pcie_deinit_2_3_2(struct qcom_pcie *pcie) clk_disable_unprepare(res->master_clk); clk_disable_unprepare(res->cfg_clk); clk_disable_unprepare(res->aux_clk); + + regulator_bulk_disable(res->num_supplies, res->supplies); } static void qcom_pcie_post_deinit_2_3_2(struct qcom_pcie *pcie) @@ -575,10 +590,16 @@ static int qcom_pcie_init_2_3_2(struct qcom_pcie *pcie) u32 val; int ret; + ret = regulator_bulk_enable(res->num_supplies, res->supplies); + if (ret < 0) { + dev_err(dev, "cannot enable regulators\n"); + return ret; + } + ret = clk_prepare_enable(res->aux_clk); if (ret) { dev_err(dev, "cannot prepare/enable aux clock\n"); - return ret; + goto err_aux_clk; } ret = clk_prepare_enable(res->cfg_clk); @@ -629,6 +650,9 @@ static int qcom_pcie_init_2_3_2(struct qcom_pcie *pcie) err_cfg_clk: clk_disable_unprepare(res->aux_clk); +err_aux_clk: + regulator_bulk_disable(res->num_supplies, res->supplies); + return ret; }