[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240507-pci2_upstream-v4-7-e8c80d874057@nxp.com>
Date: Tue, 07 May 2024 14:45:45 -0400
From: Frank Li <Frank.Li@....com>
To: Richard Zhu <hongxing.zhu@....com>,
Lucas Stach <l.stach@...gutronix.de>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Rob Herring <robh@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>,
Shawn Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, NXP Linux Team <linux-imx@....com>,
Philipp Zabel <p.zabel@...gutronix.de>, Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: linux-pci@...r.kernel.org, imx@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org, devicetree@...r.kernel.org,
Frank Li <Frank.Li@....com>
Subject: [PATCH v4 07/12] PCI: imx6: Add help function
imx_pcie_match_device()
Introduce the help function imx_pcie_match_device() to facilitate
imx_pcie_quirk() in verifying whether the device's bus driver corresponds
to the IMX6 PCI controller. This addition lays the groundwork for future
support of ITS and IOMMU in the IMX95.
Signed-off-by: Frank Li <Frank.Li@....com>
---
drivers/pci/controller/dwc/pci-imx6.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index d074bcc34d7a7..b33d8790a93af 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1652,17 +1652,25 @@ static struct platform_driver imx_pcie_driver = {
.shutdown = imx_pcie_shutdown,
};
-static void imx_pcie_quirk(struct pci_dev *dev)
+static bool imx_pcie_match_device(struct pci_bus *bus)
{
- struct pci_bus *bus = dev->bus;
- struct dw_pcie_rp *pp = bus->sysdata;
-
/* Bus parent is the PCI bridge, its parent is this platform driver */
if (!bus->dev.parent || !bus->dev.parent->parent)
- return;
+ return false;
/* Make sure we only quirk devices associated with this driver */
if (bus->dev.parent->parent->driver != &imx_pcie_driver.driver)
+ return false;
+
+ return true;
+}
+
+static void imx_pcie_quirk(struct pci_dev *dev)
+{
+ struct pci_bus *bus = dev->bus;
+ struct dw_pcie_rp *pp = bus->sysdata;
+
+ if (!imx_pcie_match_device(bus))
return;
if (pci_is_root_bus(bus)) {
--
2.34.1
Powered by blists - more mailing lists