MLK-15080 PCI: imx: pcie ep can't be probed properly
authorRichard Zhu <hongxing.zhu@nxp.com>
Fri, 11 Jan 2019 10:17:43 +0000 (15:47 +0530)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
iMX7D Sabre SD board implement the GPIO expander
connected to a peripheral bus.
Probe deferral would be triggered when try to request
the expanded GPIO at the first time.
pcie ep can't be probed properly at the second probe,
because of the duplicated registration of the sysfs.

Change the registration point of the sysfs to fix
this issue.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
drivers/pci/controller/dwc/pci-imx6.c

index 7420edd..5111427 100644 (file)
@@ -1226,13 +1226,6 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
        imx6_pcie->variant =
                (enum imx6_pcie_variants)of_device_get_match_data(dev);
 
-       if (IS_ENABLED(CONFIG_EP_MODE_IN_EP_RC_SYS)) {
-               /* add attributes for device */
-               ret = sysfs_create_group(&pdev->dev.kobj, &imx_pcie_attrgroup);
-               if (ret)
-                       return -EINVAL;
-       }
-
        np = of_find_compatible_node(NULL, NULL, "fsl,imx-pcie-phy");
        if (np != NULL) {
                imx6_pcie->phy_base = of_iomap(np, 0);
@@ -1425,6 +1418,11 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
                LIST_HEAD(res);
                struct resource_entry *win, *tmp;
 
+               /* add attributes for device */
+               ret = sysfs_create_group(&pdev->dev.kobj, &imx_pcie_attrgroup);
+               if (ret)
+                       return -EINVAL;
+
                ret = devm_of_pci_get_host_bridge_resources(dev, 0, 0xff, &res,
                                                            &pp->io_base);
                if (ret)