All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: "Andy Gross" <agross@kernel.org>,
	"Bjorn Andersson" <bjorn.andersson@linaro.org>,
	"Stephen Boyd" <swboyd@chromium.org>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Taniya Das" <tdas@codeaurora.org>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Prasad Malisetty" <quic_pmaliset@quicinc.com>,
	linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v1 4/5] PCI: qcom: Remove unnecessary pipe_clk handling
Date: Fri, 1 Apr 2022 12:17:20 +0200	[thread overview]
Message-ID: <YkbRMPBblbccWeTw@hovoldconsulting.com> (raw)
In-Reply-To: <20220323085010.1753493-5-dmitry.baryshkov@linaro.org>

On Wed, Mar 23, 2022 at 11:50:09AM +0300, Dmitry Baryshkov wrote:
> QMP PHY driver already does clk_prepare_enable()/_disable() pipe_clk.
> Remove extra calls to enable/disable this clock from the PCIe driver, so
> that the PHY driver can manage the clock on its own.
> 
> Fixes: aa9c0df98c29 ("PCI: qcom: Switch pcie_1_pipe_clk_src after PHY init in SC7280")
> Cc: Prasad Malisetty <quic_pmaliset@quicinc.com>

Looks like you're blaming the wrong author and commit, but a Fixes tag
probably isn't warranted at all here.

The first commit to introduce pipe clock handling to this driver was

	d0491fc39bdd ("PCI: qcom: Add support for MSM8996 PCIe controller")

back in 2016.

This was followed up in 2019 with

	ed8cc3b1fc84 ("PCI: qcom: Add support for SDM845 PCIe controller")

which also introduced a clock imbalance by enabling the pipe clock both
in init() and post_init() but only disabling in post_deinit().

Note that this commit also started enabling the pipe clock before
powering up the PHY (i.e. the call in init()) which looks like another
bug.

This bit should be fixed separately and you can just drop the Fixes tag
from this patch. I've sent a fix here:

	https://lore.kernel.org/r/20220401101325.16983-1-johan+linaro@kernel.org

> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  drivers/pci/controller/dwc/pcie-qcom.c | 50 ++------------------------
>  1 file changed, 3 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c

>  static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
> @@ -1238,12 +1211,6 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
>  		goto err_disable_clocks;
>  	}
>  
> -	ret = clk_prepare_enable(res->pipe_clk);
> -	if (ret) {
> -		dev_err(dev, "cannot prepare/enable pipe clock\n");
> -		goto err_disable_clocks;
> -	}
> -

Here's the imbalance.

>  	/* Wait for reset to complete, required on SM8450 */
>  	usleep_range(1000, 1500);
>  
> @@ -1298,14 +1265,7 @@ static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
>  	if (pcie->cfg->pipe_clk_need_muxing)
>  		clk_set_parent(res->pipe_clk_src, res->phy_pipe_clk);
>  
> -	return clk_prepare_enable(res->pipe_clk);
> -}
> -
> -static void qcom_pcie_post_deinit_2_7_0(struct qcom_pcie *pcie)
> -{
> -	struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0;
> -
> -	clk_disable_unprepare(res->pipe_clk);
> +	return 0;
>  }

Johan

  reply	other threads:[~2022-04-01 10:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23  8:50 [PATCH v1 0/5] PCI: qcom: rework pipe_clk/pipe_clk_src handling Dmitry Baryshkov
2022-03-23  8:50 ` [PATCH v1 1/5] clk: qcom: regmap-mux: add pipe clk implementation Dmitry Baryshkov
2022-04-08 11:15   ` Lorenzo Pieralisi
2022-04-12 18:45     ` Bjorn Andersson
2022-04-13  8:16       ` Johan Hovold
2022-04-13  9:56       ` Lorenzo Pieralisi
2022-04-12 18:32   ` Bjorn Andersson
2022-03-23  8:50 ` [PATCH v1 2/5] clk: qcom: gcc-sm8450: use new clk_regmap_mux_safe_ops for PCIe pipe clocks Dmitry Baryshkov
2022-03-23  8:50 ` [PATCH v1 3/5] clk: qcom: gcc-sc7280: " Dmitry Baryshkov
2022-03-23  8:50 ` [PATCH v1 4/5] PCI: qcom: Remove unnecessary pipe_clk handling Dmitry Baryshkov
2022-04-01 10:17   ` Johan Hovold [this message]
2022-03-23  8:50 ` [PATCH v1 5/5] PCI: qcom: Drop manual pipe_clk_src handling Dmitry Baryshkov
2022-03-30 12:56 ` [PATCH v1 0/5] PCI: qcom: rework pipe_clk/pipe_clk_src handling Dmitry Baryshkov
2022-04-04  5:03   ` Prasad Malisetty (Temp) (QUIC)

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=YkbRMPBblbccWeTw@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=agross@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=kw@linux.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=quic_pmaliset@quicinc.com \
    --cc=swboyd@chromium.org \
    --cc=tdas@codeaurora.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.