Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13635dfd authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt
Browse files

powerpc/fsl/pci: Fix PCIe fixup regression



Upstream changes to the way PHB resources are registered
broke the resource fixup for FSL boards.

We can no longer rely on the resource pointer array for the PHB's
pci_bus structure, so let's leave it alone and go straight for
the PHB resources instead. This also makes the code generally
more readable.

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 40c8cefa
Loading
Loading
Loading
Loading
+29 −19
Original line number Original line Diff line number Diff line
@@ -385,26 +385,36 @@ static void __init setup_pci_cmd(struct pci_controller *hose)
void fsl_pcibios_fixup_bus(struct pci_bus *bus)
void fsl_pcibios_fixup_bus(struct pci_bus *bus)
{
{
	struct pci_controller *hose = pci_bus_to_host(bus);
	struct pci_controller *hose = pci_bus_to_host(bus);
	int i;
	int i, is_pcie = 0, no_link;


	if ((bus->parent == hose->bus) &&
	/* The root complex bridge comes up with bogus resources,
	    ((fsl_pcie_bus_fixup &&
	 * we copy the PHB ones in.
	      early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) ||
	 *
	     (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK)))
	 * With the current generic PCI code, the PHB bus no longer
	{
	 * has bus->resource[0..4] set, so things are a bit more
		for (i = 0; i < 4; ++i) {
	 * tricky.
	 */

	if (fsl_pcie_bus_fixup)
		is_pcie = early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP);
	no_link = !!(hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK);

	if (bus->parent == hose->bus && (is_pcie || no_link)) {
		for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; ++i) {
			struct resource *res = bus->resource[i];
			struct resource *res = bus->resource[i];
			struct resource *par = bus->parent->resource[i];
			struct resource *par;
			if (res) {

				res->start = 0;
			if (!res)
				res->end   = 0;
				continue;
				res->flags = 0;
			if (i == 0)
			}
				par = &hose->io_resource;
			if (res && par) {
			else if (i < 4)
				res->start = par->start;
				par = &hose->mem_resources[i-1];
				res->end   = par->end;
			else par = NULL;
				res->flags = par->flags;

			}
			res->start = par ? par->start : 0;
			res->end   = par ? par->end   : 0;
			res->flags = par ? par->flags : 0;
		}
		}
	}
	}
}
}