From: Niklas Cassel <niklas.cassel@linaro.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Stanimir Varbanov <svarbanov@mm-sol.com>,
Andy Gross <andy.gross@linaro.org>,
David Brown <david.brown@linaro.org>,
Khasim Syed Mohammed <khasim.mohammed@linaro.org>,
Kishon Vijay Abraham I <kishon@ti.com>,
Mark Rutland <mark.rutland@arm.com>,
Michael Turquette <mturquette@baylibre.com>,
Rob Herring <robh+dt@kernel.org>, Stephen Boyd <sboyd@kernel.org>,
devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 4/7] PCI: qcom: Use clk_bulk API for 2.4.0 controllers
Date: Fri, 8 Feb 2019 15:17:38 +0100 [thread overview]
Message-ID: <20190208141738.GC773@centauri.lan> (raw)
In-Reply-To: <20190125234509.26419-5-bjorn.andersson@linaro.org>
On Fri, Jan 25, 2019 at 03:45:06PM -0800, Bjorn Andersson wrote:
> Before introducing the QCS404 platform, which uses the same PCIe
> controller as IPQ4019, migrate this to use the bulk clock API, in order
> to make the error paths slighly cleaner.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
> drivers/pci/controller/dwc/pcie-qcom.c | 48 +++++++-------------------
> 1 file changed, 13 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index a7f703556790..9d366fad2b7f 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -113,9 +113,8 @@ struct qcom_pcie_resources_2_3_2 {
> };
>
> struct qcom_pcie_resources_2_4_0 {
> - struct clk *aux_clk;
> - struct clk *master_clk;
> - struct clk *slave_clk;
> + struct clk_bulk_data clks[3];
> + int num_clks;
> struct reset_control *axi_m_reset;
> struct reset_control *axi_s_reset;
> struct reset_control *pipe_reset;
> @@ -638,18 +637,17 @@ static int qcom_pcie_get_resources_2_4_0(struct qcom_pcie *pcie)
> struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0;
> struct dw_pcie *pci = pcie->pci;
> struct device *dev = pci->dev;
> + int ret;
>
> - res->aux_clk = devm_clk_get(dev, "aux");
> - if (IS_ERR(res->aux_clk))
> - return PTR_ERR(res->aux_clk);
> + res->clks[0].id = "aux";
> + res->clks[1].id = "master_bus";
> + res->clks[2].id = "slave_bus";
>
> - res->master_clk = devm_clk_get(dev, "master_bus");
> - if (IS_ERR(res->master_clk))
> - return PTR_ERR(res->master_clk);
> + res->num_clks = 3;
>
> - res->slave_clk = devm_clk_get(dev, "slave_bus");
> - if (IS_ERR(res->slave_clk))
> - return PTR_ERR(res->slave_clk);
> + ret = devm_clk_bulk_get(dev, res->num_clks, res->clks);
> + if (ret < 0)
> + return ret;
>
> res->axi_m_reset = devm_reset_control_get_exclusive(dev, "axi_m");
> if (IS_ERR(res->axi_m_reset))
> @@ -719,9 +717,7 @@ static void qcom_pcie_deinit_2_4_0(struct qcom_pcie *pcie)
> reset_control_assert(res->axi_m_sticky_reset);
> reset_control_assert(res->pwr_reset);
> reset_control_assert(res->ahb_reset);
> - clk_disable_unprepare(res->aux_clk);
> - clk_disable_unprepare(res->master_clk);
> - clk_disable_unprepare(res->slave_clk);
> + clk_bulk_disable_unprepare(res->num_clks, res->clks);
> }
>
> static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie)
> @@ -850,23 +846,9 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie)
>
> usleep_range(10000, 12000);
>
> - ret = clk_prepare_enable(res->aux_clk);
> - if (ret) {
> - dev_err(dev, "cannot prepare/enable iface clock\n");
> + ret = clk_bulk_prepare_enable(res->num_clks, res->clks);
> + if (ret)
> goto err_clk_aux;
> - }
> -
> - ret = clk_prepare_enable(res->master_clk);
> - if (ret) {
> - dev_err(dev, "cannot prepare/enable core clock\n");
> - goto err_clk_axi_m;
> - }
> -
> - ret = clk_prepare_enable(res->slave_clk);
> - if (ret) {
> - dev_err(dev, "cannot prepare/enable phy clock\n");
> - goto err_clk_axi_s;
> - }
>
> /* enable PCIe clocks and resets */
> val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL);
> @@ -891,10 +873,6 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie)
>
> return 0;
>
> -err_clk_axi_s:
> - clk_disable_unprepare(res->master_clk);
> -err_clk_axi_m:
> - clk_disable_unprepare(res->aux_clk);
> err_clk_aux:
> reset_control_assert(res->ahb_reset);
> err_rst_ahb:
> --
> 2.18.0
>
Reviewed-by: Niklas Cassel <niklas.cassel@linaro.org>
next prev parent reply other threads:[~2019-02-08 14:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 23:45 [PATCH 0/7] QCS404 PCIe PHY and controller Bjorn Andersson
2019-01-25 23:45 ` [PATCH 1/7] clk: gcc-qcs404: Add PCIe resets Bjorn Andersson
2019-01-30 19:24 ` Stephen Boyd
2019-02-08 14:11 ` Niklas Cassel
2019-01-25 23:45 ` [PATCH 2/7] dt-bindings: phy: Add binding for Qualcomm PCIe2 PHY Bjorn Andersson
2019-02-05 5:54 ` Vinod Koul
2019-01-25 23:45 ` [PATCH 3/7] phy: qcom: Add Qualcomm PCIe2 PHY driver Bjorn Andersson
2019-02-08 14:14 ` Niklas Cassel
2019-01-25 23:45 ` [PATCH 4/7] PCI: qcom: Use clk_bulk API for 2.4.0 controllers Bjorn Andersson
2019-02-08 14:17 ` Niklas Cassel [this message]
2019-01-25 23:45 ` [PATCH 5/7] dt-bindings: PCI: qcom: Add QCS404 to the binding Bjorn Andersson
2019-01-25 23:45 ` [PATCH 6/7] PCI: qcom: Add QCS404 PCIe controller support Bjorn Andersson
2019-02-08 16:39 ` Niklas Cassel
2019-01-25 23:45 ` [PATCH 7/7] arm64: dts: qcom: qcs404: Add PCIe related nodes Bjorn Andersson
2019-01-30 19:24 ` Stephen Boyd
2019-02-05 6:01 ` Vinod Koul
2019-02-08 14:50 ` Niklas Cassel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190208141738.GC773@centauri.lan \
--to=niklas.cassel@linaro.org \
--cc=andy.gross@linaro.org \
--cc=bhelgaas@google.com \
--cc=bjorn.andersson@linaro.org \
--cc=david.brown@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=khasim.mohammed@linaro.org \
--cc=kishon@ti.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mark.rutland@arm.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=svarbanov@mm-sol.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).