Commit 123db533 authored by Lorenzo Pieralisi's avatar Lorenzo Pieralisi Committed by Bjorn Helgaas

PCI: xilinx-nwl: Convert PCI scan API to pci_scan_root_bus_bridge()

The introduction of pci_scan_root_bus_bridge() provides a PCI core API to
scan a PCI root bus backed by an already initialized struct pci_host_bridge
object, which simplifies the bus scan interface and makes the PCI scan root
bus interface easier to generalize as members are added to the struct
pci_host_bridge.

Convert PCI xilinx-nwl host code to pci_scan_root_bus_bridge() to improve
the PCI root bus scanning interface.
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
parent ae13cb9b
...@@ -791,13 +791,16 @@ static int nwl_pcie_probe(struct platform_device *pdev) ...@@ -791,13 +791,16 @@ static int nwl_pcie_probe(struct platform_device *pdev)
struct nwl_pcie *pcie; struct nwl_pcie *pcie;
struct pci_bus *bus; struct pci_bus *bus;
struct pci_bus *child; struct pci_bus *child;
struct pci_host_bridge *bridge;
int err; int err;
resource_size_t iobase = 0; resource_size_t iobase = 0;
LIST_HEAD(res); LIST_HEAD(res);
pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
if (!pcie) if (!bridge)
return -ENOMEM; return -ENODEV;
pcie = pci_host_bridge_priv(bridge);
pcie->dev = dev; pcie->dev = dev;
pcie->ecam_value = NWL_ECAM_VALUE_DEFAULT; pcie->ecam_value = NWL_ECAM_VALUE_DEFAULT;
...@@ -830,12 +833,11 @@ static int nwl_pcie_probe(struct platform_device *pdev) ...@@ -830,12 +833,11 @@ static int nwl_pcie_probe(struct platform_device *pdev)
goto error; goto error;
} }
bus = pci_create_root_bus(dev, pcie->root_busno, list_splice_init(&res, &bridge->windows);
&nwl_pcie_ops, pcie, &res); bridge->dev.parent = dev;
if (!bus) { bridge->sysdata = pcie;
err = -ENOMEM; bridge->busnr = pcie->root_busno;
goto error; bridge->ops = &nwl_pcie_ops;
}
if (IS_ENABLED(CONFIG_PCI_MSI)) { if (IS_ENABLED(CONFIG_PCI_MSI)) {
err = nwl_pcie_enable_msi(pcie); err = nwl_pcie_enable_msi(pcie);
...@@ -844,7 +846,13 @@ static int nwl_pcie_probe(struct platform_device *pdev) ...@@ -844,7 +846,13 @@ static int nwl_pcie_probe(struct platform_device *pdev)
goto error; goto error;
} }
} }
pci_scan_child_bus(bus);
err = pci_scan_root_bus_bridge(bridge);
if (err)
goto error;
bus = bridge->bus;
pci_assign_unassigned_bus_resources(bus); pci_assign_unassigned_bus_resources(bus);
list_for_each_entry(child, &bus->children, node) list_for_each_entry(child, &bus->children, node)
pcie_bus_configure_settings(child); pcie_bus_configure_settings(child);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment