|
@@ -579,12 +579,14 @@ static int altera_pcie_probe(struct platform_device *pdev)
|
|
struct altera_pcie *pcie;
|
|
struct altera_pcie *pcie;
|
|
struct pci_bus *bus;
|
|
struct pci_bus *bus;
|
|
struct pci_bus *child;
|
|
struct pci_bus *child;
|
|
|
|
+ struct pci_host_bridge *bridge;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
|
|
|
|
- if (!pcie)
|
|
|
|
|
|
+ bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
|
|
|
|
+ if (!bridge)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
+ pcie = pci_host_bridge_priv(bridge);
|
|
pcie->pdev = pdev;
|
|
pcie->pdev = pdev;
|
|
|
|
|
|
ret = altera_pcie_parse_dt(pcie);
|
|
ret = altera_pcie_parse_dt(pcie);
|
|
@@ -613,12 +615,20 @@ static int altera_pcie_probe(struct platform_device *pdev)
|
|
cra_writel(pcie, P2A_INT_ENA_ALL, P2A_INT_ENABLE);
|
|
cra_writel(pcie, P2A_INT_ENA_ALL, P2A_INT_ENABLE);
|
|
altera_pcie_host_init(pcie);
|
|
altera_pcie_host_init(pcie);
|
|
|
|
|
|
- bus = pci_scan_root_bus(dev, pcie->root_bus_nr, &altera_pcie_ops,
|
|
|
|
- pcie, &pcie->resources);
|
|
|
|
- if (!bus)
|
|
|
|
- return -ENOMEM;
|
|
|
|
|
|
+ list_splice_init(&pcie->resources, &bridge->windows);
|
|
|
|
+ bridge->dev.parent = dev;
|
|
|
|
+ bridge->sysdata = pcie;
|
|
|
|
+ bridge->busnr = pcie->root_bus_nr;
|
|
|
|
+ bridge->ops = &altera_pcie_ops;
|
|
|
|
+
|
|
|
|
+ ret = pci_scan_root_bus_bridge(bridge);
|
|
|
|
+ if (ret < 0)
|
|
|
|
+ return ret;
|
|
|
|
+
|
|
|
|
+ bus = bridge->bus;
|
|
|
|
|
|
pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
|
|
pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
|
|
|
|
+
|
|
pci_assign_unassigned_bus_resources(bus);
|
|
pci_assign_unassigned_bus_resources(bus);
|
|
|
|
|
|
/* Configure PCI Express setting. */
|
|
/* Configure PCI Express setting. */
|