From patchwork Wed Feb 14 12:23:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10218683 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A98F0601D7 for ; Wed, 14 Feb 2018 12:25:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A134028FA2 for ; Wed, 14 Feb 2018 12:25:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9560928FAC; Wed, 14 Feb 2018 12:25:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09A0428FA2 for ; Wed, 14 Feb 2018 12:25:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967608AbeBNMZW (ORCPT ); Wed, 14 Feb 2018 07:25:22 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:39065 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967603AbeBNMZV (ORCPT ); Wed, 14 Feb 2018 07:25:21 -0500 Received: by mail-wr0-f194.google.com with SMTP id w77so7475771wrc.6 for ; Wed, 14 Feb 2018 04:25:20 -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=nf8n5pU7TPicVAfpkljAVP74OCNFY2mLVb7Z3nk8LRQ=; b=B3kuWeFH7CD/H4GvzdyKqcPV+DefYdWshK7scXN9zA0qTehH3OCbLsT6ew632DqnYp 1XvEvFfxYRS/1XQfajD+Zr6o/KTuPN6uZsxfWI9vFpV1l7XMa24cFSEoaY5t3/TN88FU uKoBX+y3w/nkc0Ps870PlZnry6gsBTOON/vLE= 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=nf8n5pU7TPicVAfpkljAVP74OCNFY2mLVb7Z3nk8LRQ=; b=KHkjCL6JdDLEwqHBvJ6U1S0fYfusjt5VTDLvg+WKG2mxUFoSZ6RHGSTqpWutrOKtFE qm0wdkv8yPWnYe9z67gRWiLa4MKsuEEAxvNkKiDAimfyedJqYfDj8P52a8Rsql4uoIRX d/nKdXh/NQXDtgi1NsFFKfVPpowFkQ2li7xlrDefDEtAcsg2mjzQjF0lptVKLLxL9Xse 5QCiQEgLEbBXYTOauXERXKaIEW9Xezblhw1AwAhc7qynVvAuLDixGGXkmSecjj9zKu9q us3G/56axiK4P9dY9siEIy1afXu/2tmj1OC0GYdhnS9t7hCfwkWic6OrbluWq2g4mIlC iN4Q== X-Gm-Message-State: APf1xPB/OqnijQuf3l99QYu/eL6q0eqSi9K81qKW+l+jQdvOdJ012Sbs oHLkp5HlTh9YRDI/AXJl7OrDBw== X-Google-Smtp-Source: AH8x224kNIVtldGmOZukWKdnUtMP6dO0XrUkngT9dMDQUQJt6oT+J4LmWd+FzqRo8VoR0h0zwK+rXQ== X-Received: by 10.223.188.144 with SMTP id g16mr4500145wrh.258.1518611119507; Wed, 14 Feb 2018 04:25:19 -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 p14sm12893124wrg.42.2018.02.14.04.25.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Feb 2018 04:25:18 -0800 (PST) From: srinivas.kandagatla@linaro.org To: stanimir.varbanov@linaro.org, svarbanov@mm-sol.com, linux-pci@vger.kernel.org, bhelgaas@google.com Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH] PCI: qcom: use regulator bluk api for apq8064 supplies Date: Wed, 14 Feb 2018 12:23:15 +0000 Message-Id: <20180214122315.2069-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Srinivas Kandagatla This patch converts existing regulators to use regulator bulk apis, to make it consistent with msm8996 changes also cut down some redundant code. Signed-off-by: Srinivas Kandagatla --- drivers/pci/dwc/pcie-qcom.c | 52 +++++++++++++-------------------------------- 1 file changed, 15 insertions(+), 37 deletions(-) diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c index 519a2ae416eb..ba923cfeaa25 100644 --- a/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/dwc/pcie-qcom.c @@ -79,6 +79,7 @@ #define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358 #define SLV_ADDR_SPACE_SZ 0x10000000 +#define QCOM_PCIE_2_1_0_MAX_SUPPLY 3 struct qcom_pcie_resources_2_1_0 { struct clk *iface_clk; struct clk *core_clk; @@ -88,9 +89,7 @@ struct qcom_pcie_resources_2_1_0 { struct reset_control *ahb_reset; struct reset_control *por_reset; struct reset_control *phy_reset; - struct regulator *vdda; - struct regulator *vdda_phy; - struct regulator *vdda_refclk; + struct regulator_bulk_data supplies[QCOM_PCIE_2_1_0_MAX_SUPPLY]; }; struct qcom_pcie_resources_1_0_0 { @@ -217,18 +216,15 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; + int ret; - res->vdda = devm_regulator_get(dev, "vdda"); - if (IS_ERR(res->vdda)) - return PTR_ERR(res->vdda); - - res->vdda_phy = devm_regulator_get(dev, "vdda_phy"); - if (IS_ERR(res->vdda_phy)) - return PTR_ERR(res->vdda_phy); - - res->vdda_refclk = devm_regulator_get(dev, "vdda_refclk"); - if (IS_ERR(res->vdda_refclk)) - return PTR_ERR(res->vdda_refclk); + res->supplies[0].supply = "vdda"; + res->supplies[1].supply = "vdda_phy"; + res->supplies[1].supply = "vdda_refclk"; + ret = devm_regulator_bulk_get(dev, QCOM_PCIE_2_1_0_MAX_SUPPLY, + res->supplies); + if (ret) + return ret; res->iface_clk = devm_clk_get(dev, "iface"); if (IS_ERR(res->iface_clk)) @@ -274,9 +270,7 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->phy_clk); - regulator_disable(res->vdda); - regulator_disable(res->vdda_phy); - regulator_disable(res->vdda_refclk); + regulator_bulk_disable(QCOM_PCIE_2_1_0_MAX_SUPPLY, res->supplies); } static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) @@ -287,24 +281,12 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) u32 val; int ret; - ret = regulator_enable(res->vdda); - if (ret) { - dev_err(dev, "cannot enable vdda regulator\n"); + ret = regulator_bulk_enable(QCOM_PCIE_2_1_0_MAX_SUPPLY, res->supplies); + if (ret < 0) { + dev_err(dev, "cannot enable regulators\n"); return ret; } - ret = regulator_enable(res->vdda_refclk); - if (ret) { - dev_err(dev, "cannot enable vdda_refclk regulator\n"); - goto err_refclk; - } - - ret = regulator_enable(res->vdda_phy); - if (ret) { - dev_err(dev, "cannot enable vdda_phy regulator\n"); - goto err_vdda_phy; - } - ret = reset_control_assert(res->ahb_reset); if (ret) { dev_err(dev, "cannot assert ahb reset\n"); @@ -388,11 +370,7 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) err_clk_phy: clk_disable_unprepare(res->iface_clk); err_assert_ahb: - regulator_disable(res->vdda_phy); -err_vdda_phy: - regulator_disable(res->vdda_refclk); -err_refclk: - regulator_disable(res->vdda); + regulator_bulk_disable(QCOM_PCIE_2_1_0_MAX_SUPPLY, res->supplies); return ret; }