]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PCI: mvebu: Split port parsing and resource claiming from port setup
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 3 Oct 2015 18:13:07 +0000 (19:13 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 9 Oct 2015 16:20:24 +0000 (11:20 -0500)
Split the PCIe port DT parsing and resource claiming from setting up the
actual ports.  This allows us to gather all the resources first, before
touching the hardware.  This is important as some of these resources (such
as the GPIO for the PCIe reset) may defer probing.

Tested-by: Willy Tarreau <w@1wt.eu> (Iomega iConnect Kirkwood, MiraBox Armada 370)
Tested-by: Andrew Lunn <andrew@lunn.ch> (D-Link DIR664 Kirkwood)
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> (Armada XP GP)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
drivers/pci/host/pci-mvebu.c

index e8c51bb58e9965c8a46aba0c2f7997f6acabd48c..92c777e1aa3c89d20099fca1f5aa40786091a843 100644 (file)
@@ -1093,6 +1093,18 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
                        continue;
                }
 
+               port->dn = child;
+               i++;
+       }
+       pcie->nports = i;
+
+       for (i = 0; i < pcie->nports; i++) {
+               struct mvebu_pcie_port *port = &pcie->ports[i];
+
+               child = port->dn;
+               if (!child)
+                       continue;
+
                if (gpio_is_valid(port->reset_gpio)) {
                        u32 reset_udelay = 20000;
 
@@ -1118,10 +1130,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
                }
 
                mvebu_pcie_set_local_dev_nr(port, 1);
-
-               port->dn = child;
                mvebu_sw_pci_bridge_init(port);
-               i++;
        }
 
        pcie->nports = i;