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: 128331 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp550581ljc; Wed, 14 Feb 2018 04:25:28 -0800 (PST) X-Google-Smtp-Source: AH8x224obE2EPGab9kbY47VVXA+vCLh/LDPgnsI9SD5mMETqk4QsjZ7PqGLVF68A0nyXnY2+l3m8 X-Received: by 10.101.81.2 with SMTP id f2mr1800582pgq.361.1518611128315; Wed, 14 Feb 2018 04:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518611128; cv=none; d=google.com; s=arc-20160816; b=IVYeEX2y6EdOJ62bizMIPlgaoZ0NDSN41r4DnGV9EMHXf95meRZqrQ+sbiQ9jpNodS SWkjY3WSWIf6TotEm6VSjFReViVrLTOpUIX+rOeSBJHj/EpT0HCNI5HvqbeI/qJb/sOs fSPDx8AjaCAkFMaW6h8WTEIvEZHk7C0jeN5QYbDtKLTvucm9LWCS1E3JuJTAEDf9L2Wb xqdxBGjuaPAP3MfP7mEqvEBb2jm+uTb97b7bfjO/5an5A9UtOuGs+mZkd8flf2Dg8dM2 afF+565vOZuX9cXYWvA0MIonVIGsBn5kIWdxuEa1ZV6EXE+qvsI/Wa+7OtBantew9Pcc xa8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=nf8n5pU7TPicVAfpkljAVP74OCNFY2mLVb7Z3nk8LRQ=; b=QvrGBFEN2AHnzLOWEo9/L3JLSAk9Lh366seoLyeQosrfa2QdFeFb+/YMKaFCo+ZVdz rvDHTfoE0tigOy2FrZZwsuxIQ7pxPJfYOOYlpF/2KyQhyvMriUWouxDzxGfQNl6CG8s5 s70ITBDha4wNW3Y53LIaJ4cKkSUa/N0Ax7DBJJO0zjsbU2voNTgdlCg693jCFh18/inT nn3D3FH6e6iHRQC2kfz9VmXDj4XsG67pwV/8QyGg6RmmBgu/6kBQTitvisgqOCz9iJUO P+7Qk5AJCCagAizQV7L6+a4k0pZXvIyXiNLKCaapwk2Oj+D+o/IpcuDTQIOo9NMnELWK gvZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B3kuWeFH; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si3415049pgi.67.2018.02.14.04.25.27; Wed, 14 Feb 2018 04:25:28 -0800 (PST) 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 header.s=google header.b=B3kuWeFH; 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967663AbeBNMZX (ORCPT + 28 others); Wed, 14 Feb 2018 07:25:23 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:43680 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967584AbeBNMZV (ORCPT ); Wed, 14 Feb 2018 07:25:21 -0500 Received: by mail-wr0-f193.google.com with SMTP id b52so21934192wrd.10 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=Tq5VNRhb6P52S0SnX5fgrsDLdTR6zlnvbiX6KC9y2ATwrHiNxWXN9rvsM6T0byScNK wotveFDV2CkP83lVzvSptvmjx4yOVkL9NXx3l/OjqAEaF2nQ8VxWy7XAneW7edl9b6yE 7KtuE60n+7Bx0WNCpjzPDKqNPBlaoDOPsjW64MoOXZZTZ21SYxlO8bEO8aRD8P2gcn14 Ty7KclkpKPZzCnrEXcHHv7G3PRQObPof4AdiDHIMZcppwK0bzSgzGL55Dej0/UPyfFnn b1shdECPXCMfC87gBZvsCGm8kqtC/krrB8Thcwr2RxLsVWI0EIH1pn3KkNX5PBSpB3DD a2og== X-Gm-Message-State: APf1xPCkWeUUs8Qp3WG9/oLjtTXkOwQLaygStan9va5aHFXe3hGkyo2l nkS4vz9a4O6PFkPvbgCgkdbqsxxnmVA= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.15.1 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; }