[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230928184808.GA12574@thinkpad>
Date: Thu, 28 Sep 2023 20:48:08 +0200
From: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: lpieralisi@...nel.org, kw@...ux.com, andersson@...nel.org,
konrad.dybcio@...aro.org, bhelgaas@...gle.com,
linux-arm-msm@...r.kernel.org, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, abel.vesa@...aro.org
Subject: Re: [PATCH v3 2/3] PCI: qcom-ep: Make use of PCIE_SPEED2MBS_ENC()
macro for encoding link speed
On Wed, Sep 27, 2023 at 12:55:42PM -0500, Bjorn Helgaas wrote:
> On Wed, Sep 27, 2023 at 05:46:02PM +0200, Manivannan Sadhasivam wrote:
> > Instead of hardcoding the link speed in MBps, let's make use of the
> > existing PCIE_SPEED2MBS_ENC() macro that does the encoding of the
> > link speed for us. Also, let's Wrap it with QCOM_PCIE_LINK_SPEED_TO_BW()
> > macro to do the conversion to ICC speed.
>
> In subject, /Make use of/Use/ would make better use of the subject
> line. Lots of "uses" there :)
>
> Above, s/let's//, and also s/make use of/use/.
>
Ok, I will reword accordingly.
> > +#define QCOM_PCIE_LINK_SPEED_TO_BW(speed) \
> > + Mbps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]))
>
> It's a shame to have to duplicate this macro in pcie-qcom.c and in
> pcie-qcom-ep.c, especially since there's nothing qcom-specific in it.
>
> Would a macro like this fit in interconnect.h?
>
Unfortunately, no. This macro is neither interconnect specific nor PCI, but a
kind of both used by the driver. So it makes sense to keep it in the driver
itself for now.
If we happen to create a common header for host and ep drivers in the future, it
can be moved to that.
> > - ret = icc_set_bw(pcie_ep->icc_mem, 0, MBps_to_icc(PCIE_GEN1_BW_MBPS));
> > + ret = icc_set_bw(pcie_ep->icc_mem, 0, QCOM_PCIE_LINK_SPEED_TO_BW(1));
>
> "1" is not very informative here. Maybe PCIE_SPEED_2_5GT? (I didn't
> completely verify that this is equivalent.)
>
No. PCIE_SPEED_2_5GT is defined as 0x14 in pci.h. And I do not want to add a
macro for just "1" here.
- Mani
> Bjorn
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists