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

Commit 7eef440a authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Paul Mackerras
Browse files

powerpc/pci: Cosmetic cleanups of pci-common.c



This does a few cosmetic cleanups, moving a couple of things around
but without actually changing what the code does.

(There is a minor change in ordering of operations in
pcibios_setup_bus_devices but it should have no impact).

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent fd6852c8
Loading
Loading
Loading
Loading
+36 −41
Original line number Diff line number Diff line
@@ -203,25 +203,6 @@ char __devinit *pcibios_setup(char *str)
	return str;
}

static void __devinit pcibios_setup_new_device(struct pci_dev *dev)
{
	struct dev_archdata *sd = &dev->dev.archdata;

	sd->of_node = pci_device_to_OF_node(dev);

	pr_debug("PCI: device %s OF node: %s\n", pci_name(dev),
		 sd->of_node ? sd->of_node->full_name : "<none>");

	sd->dma_ops = pci_dma_ops;
#ifdef CONFIG_PPC32
	sd->dma_data = (void *)PCI_DRAM_OFFSET;
#endif
	set_dev_node(&dev->dev, pcibus_to_node(dev->bus));

	if (ppc_md.pci_dma_dev_setup)
		ppc_md.pci_dma_dev_setup(dev);
}

/*
 * Reads the interrupt pin to determine if interrupt is use by card.
 * If the interrupt is used, then gets the interrupt line from the
@@ -1074,33 +1055,14 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
	}
}

void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
{
	struct pci_dev *dev;

	pr_debug("PCI: Fixup bus %d (%s)\n",
		 bus->number, bus->self ? pci_name(bus->self) : "PHB");

	/* Setup DMA for all PCI devices on that bus */
	list_for_each_entry(dev, &bus->devices, bus_list)
		pcibios_setup_new_device(dev);

	/* Read default IRQs and fixup if necessary */
	list_for_each_entry(dev, &bus->devices, bus_list) {
		pci_read_irq_line(dev);
		if (ppc_md.pci_irq_fixup)
			ppc_md.pci_irq_fixup(dev);
	}
}

void __devinit pcibios_setup_bus_self(struct pci_bus *bus)
{
	/* Fix up the bus resources */
	/* Fix up the bus resources for P2P bridges */
	if (bus->self != NULL)
		pcibios_fixup_bridge(bus);

	/* Platform specific bus fixups. This is currently only used
	 * by fsl_pci and I'm hoping getting rid of it at some point
	 * by fsl_pci and I'm hoping to get rid of it at some point
	 */
	if (ppc_md.pcibios_fixup_bus)
		ppc_md.pcibios_fixup_bus(bus);
@@ -1110,10 +1072,43 @@ void __devinit pcibios_setup_bus_self(struct pci_bus *bus)
		ppc_md.pci_dma_bus_setup(bus);
}

void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
{
	struct pci_dev *dev;

	pr_debug("PCI: Fixup bus devices %d (%s)\n",
		 bus->number, bus->self ? pci_name(bus->self) : "PHB");

	list_for_each_entry(dev, &bus->devices, bus_list) {
		struct dev_archdata *sd = &dev->dev.archdata;

		/* Setup OF node pointer in archdata */
		sd->of_node = pci_device_to_OF_node(dev);

		/* Fixup NUMA node as it may not be setup yet by the generic
		 * code and is needed by the DMA init
		 */
		set_dev_node(&dev->dev, pcibus_to_node(dev->bus));

		/* Hook up default DMA ops */
		sd->dma_ops = pci_dma_ops;
		sd->dma_data = (void *)PCI_DRAM_OFFSET;

		/* Additional platform DMA/iommu setup */
		if (ppc_md.pci_dma_dev_setup)
			ppc_md.pci_dma_dev_setup(dev);

		/* Read default IRQs and fixup if necessary */
		pci_read_irq_line(dev);
		if (ppc_md.pci_irq_fixup)
			ppc_md.pci_irq_fixup(dev);
	}
}

void __devinit pcibios_fixup_bus(struct pci_bus *bus)
{
	/* When called from the generic PCI probe, read PCI<->PCI bridge
	 * bases. This isn't called when generating the PCI tree from
	 * bases. This is -not- called when generating the PCI tree from
	 * the OF device-tree.
	 */
	if (bus->self != NULL)