@@ -27,6 +27,7 @@ struct hw_pci {
void (*postinit)(void);
u8 (*swizzle)(struct pci_dev *dev, u8 *pin);
int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
+ struct device_node *of_node;
};
/*
@@ -47,6 +48,7 @@ struct pci_sys_data {
/* IRQ mapping */
int (*map_irq)(const struct pci_dev *, u8, u8);
void *private_data; /* platform controller private data */
+ struct device_node *of_node; /* device tree node */
};
/*
@@ -11,6 +11,7 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <asm/mach-types.h>
#include <asm/mach/pci.h>
@@ -426,10 +427,10 @@ static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
static void __init pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
{
struct pci_sys_data *sys = NULL;
+ static int busnr;
int ret;
- int nr, busnr;
-
- for (nr = busnr = 0; nr < hw->nr_controllers; nr++) {
+ int nr;
+ for (nr = 0; nr < hw->nr_controllers; nr++) {
sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
if (!sys)
panic("PCI: unable to allocate sys data!");
@@ -440,6 +441,7 @@ static void __init pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
sys->busnr = busnr;
sys->swizzle = hw->swizzle;
sys->map_irq = hw->map_irq;
+ sys->of_node = hw->of_node;
INIT_LIST_HEAD(&sys->resources);
ret = hw->setup(nr, sys);
@@ -484,10 +486,11 @@ void __init pci_common_init(struct hw_pci *hw)
if (hw->postinit)
hw->postinit();
- pci_fixup_irqs(pcibios_swizzle, pcibios_map_irq);
-
list_for_each_entry(sys, &head, node) {
struct pci_bus *bus = sys->bus;
+ struct pci_bus *child;
+
+ pci_bus_fixup_irqs(bus, pcibios_swizzle, pcibios_map_irq);
if (!pci_has_flag(PCI_PROBE_ONLY)) {
/*
@@ -504,6 +507,16 @@ void __init pci_common_init(struct hw_pci *hw)
* Enable bridges
*/
pci_enable_bridges(bus);
+
+ /*
+ * Configure children (MPS, MRRS)
+ */
+ list_for_each_entry(child, &bus->children, node) {
+ struct pci_dev *self = child->self;
+ if (!self)
+ continue;
+ pcie_bus_configure_settings(child, self->pcie_mpss);
+ }
}
/*
@@ -627,3 +640,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
return 0;
}
+
+struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
+{
+ struct pci_sys_data *sys = bus->sysdata;
+ return of_node_get(sys->of_node);
+}