public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <mani@kernel.org>
To: Pavan Kondeti <quic_pkondeti@quicinc.com>
Cc: "Krishna chaitanya chundru" <quic_krichai@quicinc.com>,
	manivannan.sadhasivam@linaro.org, helgaas@kernel.org,
	linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, quic_vbadigan@quicinc.com,
	quic_nitegupt@quicinc.com, quic_skananth@quicinc.com,
	quic_ramkri@quicinc.com, krzysztof.kozlowski@linaro.org,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH v5 3/3] PCI: qcom-ep: Add ICC bandwidth voting support
Date: Tue, 27 Jun 2023 20:37:18 +0530	[thread overview]
Message-ID: <20230627150718.GJ5490@thinkpad> (raw)
In-Reply-To: <bdce0719-4f12-4e75-a8e7-1b38d269ac15@quicinc.com>

On Tue, Jun 27, 2023 at 12:05:23PM +0530, Pavan Kondeti wrote:
> On Tue, Jun 27, 2023 at 06:31:31AM +0530, Krishna chaitanya chundru wrote:
> > +static void qcom_pcie_ep_icc_update(struct qcom_pcie_ep *pcie_ep)
> > +{
> > +	struct dw_pcie *pci = &pcie_ep->pci;
> > +	u32 offset, status, bw;
> > +	int speed, width;
> > +	int ret;
> > +
> > +	if (!pcie_ep->icc_mem)
> > +		return;
> > +
> 
> Is this check needed? interconnect is added as required property and
> probe is failed if interconnect get fails. qcom_pcie_enable_resources()
> which gets called before enabling this interrupt is assuming that
> interconnect available.
> 

Even though the current binding requires interconnect, driver needs to be
backwards compatible with old dts where there was no interconnect.

Also, devm_of_icc_get() will return NULL if the property is missing in dts. But
we are just checking for IS_ERR not IS_ERR_OR_NULL. So this check is required.

- Mani

> 
> > +	offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
> > +	status = readw(pci->dbi_base + offset + PCI_EXP_LNKSTA);
> > +
> > +	speed = FIELD_GET(PCI_EXP_LNKSTA_CLS, status);
> > +	width = FIELD_GET(PCI_EXP_LNKSTA_NLW, status);
> > +
> > +	switch (speed) {
> > +	case 1:
> > +		bw = MBps_to_icc(PCIE_GEN1_BW_MBPS);
> > +		break;
> > +	case 2:
> > +		bw = MBps_to_icc(PCIE_GEN2_BW_MBPS);
> > +		break;
> > +	case 3:
> > +		bw = MBps_to_icc(PCIE_GEN3_BW_MBPS);
> > +		break;
> > +	default:
> > +		dev_warn(pci->dev, "using default GEN4 bandwidth\n");
> > +		fallthrough;
> > +	case 4:
> > +		bw = MBps_to_icc(PCIE_GEN4_BW_MBPS);
> > +		break;
> > +	}
> > +
> > +	ret = icc_set_bw(pcie_ep->icc_mem, 0, width * bw);
> > +	if (ret) {
> > +		dev_err(pci->dev, "failed to set interconnect bandwidth: %d\n",
> > +			ret);
> > +	}
> 
> Are you not seeing the below warning from checkpatch?
> 
> WARNING: braces {} are not necessary for single statement blocks
> 
> > +}
> > +
> >  static int qcom_pcie_enable_resources(struct qcom_pcie_ep *pcie_ep)
> >  {
> >  	int ret;
> > +	struct dw_pcie *pci = &pcie_ep->pci;
> >  
> >  	ret = clk_bulk_prepare_enable(pcie_ep->num_clks, pcie_ep->clks);
> >  	if (ret)
> > @@ -277,6 +331,20 @@ static int qcom_pcie_enable_resources(struct qcom_pcie_ep *pcie_ep)
> >  	if (ret)
> >  		goto err_phy_exit;
> >  
> > +	/*
> > +	 * Some Qualcomm platforms require interconnect bandwidth constraints
> > +	 * to be set before enabling interconnect clocks.
> > +	 *
> > +	 * Set an initial peak bandwidth corresponding to single-lane Gen 1
> > +	 * for the pcie-mem path.
> > +	 */
> > +	ret = icc_set_bw(pcie_ep->icc_mem, 0, MBps_to_icc(PCIE_GEN1_BW_MBPS));
> > +	if (ret) {
> > +		dev_err(pci->dev, "failed to set interconnect bandwidth: %d\n",
> > +			ret);
> > +		goto err_phy_exit;
> > +	}
> > +
> >  	return 0;
> 
> Thanks,
> Pavan

-- 
மணிவண்ணன் சதாசிவம்

  reply	other threads:[~2023-06-27 15:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27  1:01 [PATCH v5 0/3] PCI: qcom: ep: Add basic interconnect support Krishna chaitanya chundru
2023-06-27  1:01 ` [PATCH v5 1/3] dt-bindings: PCI: qcom: ep: Add interconnects path Krishna chaitanya chundru
2023-06-27 14:41   ` Manivannan Sadhasivam
2023-06-27  1:01 ` [PATCH v5 2/3] arm: dts: qcom: sdx65: Add interconnect path Krishna chaitanya chundru
2023-06-27 14:39   ` Manivannan Sadhasivam
2023-06-28  2:20     ` Krishna Chaitanya Chundru
2023-06-27  1:01 ` [PATCH v5 3/3] PCI: qcom-ep: Add ICC bandwidth voting support Krishna chaitanya chundru
2023-06-27  6:35   ` Pavan Kondeti
2023-06-27 15:07     ` Manivannan Sadhasivam [this message]
2023-06-28  2:21     ` Krishna Chaitanya Chundru
2023-06-27 15:01   ` Manivannan Sadhasivam
2023-06-28  2:22     ` Krishna Chaitanya Chundru

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=20230627150718.GJ5490@thinkpad \
    --to=mani@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=kw@linux.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=quic_krichai@quicinc.com \
    --cc=quic_nitegupt@quicinc.com \
    --cc=quic_pkondeti@quicinc.com \
    --cc=quic_ramkri@quicinc.com \
    --cc=quic_skananth@quicinc.com \
    --cc=quic_vbadigan@quicinc.com \
    --cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox