MLK-16982 PCI: imx: fix the failure of the msi verification
authorRichard Zhu <hongxing.zhu@nxp.com>
Mon, 27 Nov 2017 05:06:15 +0000 (13:06 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:55:43 +0000 (15:55 -0500)
Failed to verify the MSI in the EP RC system.
Root cause: the MSI address is not fetched corretly.
The second port of iMX8MQ EVK board should be used
as EP port, not the first one.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
drivers/pci/host/pci-imx6-ep-driver.c

index dd300a9..4ea0782 100644 (file)
@@ -51,10 +51,10 @@ static int imx_pcie_ep_probe(struct pci_dev *pdev,
                const struct pci_device_id *id)
 {
        int ret = 0, index = 0, found = 0;
-       unsigned int msi_addr = 0, cpu_base;
+       unsigned int hard_wired = 0, msi_addr = 0, cpu_base;
        struct resource cfg_res;
        const char *name = NULL;
-       struct device_node *np;
+       struct device_node *np = NULL;
        struct device *dev = &pdev->dev;
        struct imx_pcie_ep_priv *priv;
 
@@ -90,7 +90,13 @@ static int imx_pcie_ep_probe(struct pci_dev *pdev,
                goto err_pci_unmap_mmio;
        }
 
-       np = of_find_compatible_node(NULL, NULL, "snps,dw-pcie");
+       /* Use the first none-hard-wired port as ep */
+       while ((np = of_find_node_by_type(np, "pci"))) {
+               if (of_property_read_u32(np, "hard-wired", &hard_wired)) {
+                       hard_wired = 0;
+                       break;
+               }
+       }
        if (of_property_read_u32(np, "cpu-base-addr", &cpu_base))
                cpu_base = 0;