From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Frank Li <Frank.Li@nxp.com>
Cc: "Richard Zhu" <hongxing.zhu@nxp.com>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"NXP Linux Team" <linux-imx@nxp.com>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
linux-pci@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v7 10/10] PCI: imx6: Add i.MX8Q PCIe root complex (RC) support
Date: Sun, 21 Jul 2024 13:53:36 +0530 [thread overview]
Message-ID: <20240721082336.GG1908@thinkpad> (raw)
In-Reply-To: <20240708-pci2_upstream-v7-10-ac00b8174f89@nxp.com>
On Mon, Jul 08, 2024 at 01:08:14PM -0400, Frank Li wrote:
> From: Richard Zhu <hongxing.zhu@nxp.com>
>
> Implement i.MX8Q (i.MX8QM, i.MX8QXP, and i.MX8DXL) PCIe RC support. While
> the controller resembles that of iMX8MP, the PHY differs significantly.
> Notably, there's a distinction between PCI bus addresses and CPU addresses.
>
> Introduce IMX_PCIE_FLAG_CPU_ADDR_FIXUP in drvdata::flags to indicate driver
> need the cpu_addr_fixup() callback to facilitate CPU address to PCI bus
> address conversion according to "ranges" property.
>
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
One comment below.
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index c72c7a0b0e02d..4e029d1c284e8 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -66,6 +66,7 @@ enum imx_pcie_variants {
> IMX8MQ,
> IMX8MM,
> IMX8MP,
> + IMX8Q,
> IMX95,
> IMX8MQ_EP,
> IMX8MM_EP,
> @@ -81,6 +82,7 @@ enum imx_pcie_variants {
> #define IMX_PCIE_FLAG_HAS_PHY_RESET BIT(5)
> #define IMX_PCIE_FLAG_HAS_SERDES BIT(6)
> #define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7)
> +#define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(8)
>
> #define imx_check_flag(pci, val) (pci->drvdata->flags & val)
>
> @@ -1015,6 +1017,22 @@ static void imx_pcie_host_exit(struct dw_pcie_rp *pp)
> regulator_disable(imx_pcie->vpcie);
> }
>
> +static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr)
> +{
> + struct imx_pcie *imx_pcie = to_imx_pcie(pcie);
> + struct dw_pcie_rp *pp = &pcie->pp;
> + struct resource_entry *entry;
> + unsigned int offset;
> +
> + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_CPU_ADDR_FIXUP))
> + return cpu_addr;
> +
> + entry = resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM);
> + offset = entry->offset;
> +
> + return (cpu_addr - offset);
> +}
> +
> static const struct dw_pcie_host_ops imx_pcie_host_ops = {
> .init = imx_pcie_host_init,
> .deinit = imx_pcie_host_exit,
> @@ -1023,6 +1041,7 @@ static const struct dw_pcie_host_ops imx_pcie_host_ops = {
> static const struct dw_pcie_ops dw_pcie_ops = {
> .start_link = imx_pcie_start_link,
> .stop_link = imx_pcie_stop_link,
> + .cpu_addr_fixup = imx_pcie_cpu_addr_fixup,
> };
>
> static void imx_pcie_ep_init(struct dw_pcie_ep *ep)
> @@ -1452,6 +1471,13 @@ static int imx_pcie_probe(struct platform_device *pdev)
> if (ret < 0)
> return ret;
>
> + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_CPU_ADDR_FIXUP)) {
> + if (!resource_list_first_type(&pci->pp.bridge->windows, IORESOURCE_MEM)) {
> + dw_pcie_host_deinit(&pci->pp);
> + return dev_err_probe(dev, -ENODEV, "DTS Miss PCI memory range");
> + }
Is this check really necessary? Can the driver work if there is no MEM region
defined in DT (irrespective of the flag)?
I can understand your intentions, but this check seems pointless to me.
- Mani
--
மணிவண்ணன் சதாசிவம்
prev parent reply other threads:[~2024-07-21 8:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 17:08 [PATCH v7 00/10] PCI: imx6: Fix\rename\clean up and add lut information for imx95 Frank Li
2024-07-08 17:08 ` [PATCH v7 01/10] PCI: imx6: Fix establish link failure in EP mode for iMX8MM and iMX8MP Frank Li
2024-07-08 17:08 ` [PATCH v7 02/10] PCI: imx6: Fix i.MX8MP PCIe EP's occasional failure to trigger MSI Frank Li
2024-07-21 7:39 ` Manivannan Sadhasivam
2024-07-08 17:08 ` [PATCH v7 03/10] PCI: imx6: Rename imx6_* with imx_* Frank Li
2024-07-08 17:08 ` [PATCH v7 04/10] PCI: imx6: Introduce SoC specific callbacks for controlling REFCLK Frank Li
2024-07-21 7:56 ` Manivannan Sadhasivam
2024-07-22 15:16 ` Frank Li
2024-07-24 17:16 ` Manivannan Sadhasivam
2024-07-08 17:08 ` [PATCH v7 05/10] PCI: imx6: Simplify switch-case logic by involve core_reset callback Frank Li
2024-07-08 17:08 ` [PATCH v7 06/10] PCI: imx6: Improve comment for workaround ERR010728 Frank Li
2024-07-21 7:57 ` Manivannan Sadhasivam
2024-07-08 17:08 ` [PATCH v7 07/10] PCI: imx6: Consolidate redundant if-checks Frank Li
2024-07-08 17:08 ` [PATCH v7 08/10] dt-bindings: imx6q-pcie: Add i.MX8Q pcie compatible string Frank Li
2024-07-21 7:58 ` Manivannan Sadhasivam
2024-07-08 17:08 ` [PATCH v7 09/10] PCI: imx6: Call common PHY API to set mode, speed, and submode Frank Li
2024-07-21 8:07 ` Manivannan Sadhasivam
2024-07-08 17:08 ` [PATCH v7 10/10] PCI: imx6: Add i.MX8Q PCIe root complex (RC) support Frank Li
2024-07-21 8:23 ` Manivannan Sadhasivam [this message]
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=20240721082336.GG1908@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=Frank.Li@nxp.com \
--cc=bhelgaas@google.com \
--cc=bpf@vger.kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=hongxing.zhu@nxp.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kw@linux.com \
--cc=l.stach@pengutronix.de \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@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 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.