powerpc/pci: Make IO workarounds init implicit when first bus is registered
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
parent
3cc30d0726
commit
d1109b7529
@ -31,7 +31,6 @@ struct iowa_bus {
|
|||||||
void *private;
|
void *private;
|
||||||
};
|
};
|
||||||
|
|
||||||
void __devinit io_workaround_init(void);
|
|
||||||
void __devinit iowa_register_bus(struct pci_controller *, struct ppc_pci_io *,
|
void __devinit iowa_register_bus(struct pci_controller *, struct ppc_pci_io *,
|
||||||
int (*)(struct iowa_bus *, void *), void *);
|
int (*)(struct iowa_bus *, void *), void *);
|
||||||
struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR);
|
struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR);
|
||||||
|
@ -144,7 +144,19 @@ static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Regist new bus to support workaround */
|
/* Enable IO workaround */
|
||||||
|
static void __devinit io_workaround_init(void)
|
||||||
|
{
|
||||||
|
static int io_workaround_inited;
|
||||||
|
|
||||||
|
if (io_workaround_inited)
|
||||||
|
return;
|
||||||
|
ppc_pci_io = iowa_pci_io;
|
||||||
|
ppc_md.ioremap = iowa_ioremap;
|
||||||
|
io_workaround_inited = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Register new bus to support workaround */
|
||||||
void __devinit iowa_register_bus(struct pci_controller *phb,
|
void __devinit iowa_register_bus(struct pci_controller *phb,
|
||||||
struct ppc_pci_io *ops,
|
struct ppc_pci_io *ops,
|
||||||
int (*initfunc)(struct iowa_bus *, void *), void *data)
|
int (*initfunc)(struct iowa_bus *, void *), void *data)
|
||||||
@ -152,6 +164,8 @@ void __devinit iowa_register_bus(struct pci_controller *phb,
|
|||||||
struct iowa_bus *bus;
|
struct iowa_bus *bus;
|
||||||
struct device_node *np = phb->dn;
|
struct device_node *np = phb->dn;
|
||||||
|
|
||||||
|
io_workaround_init();
|
||||||
|
|
||||||
if (iowa_bus_count >= IOWA_MAX_BUS) {
|
if (iowa_bus_count >= IOWA_MAX_BUS) {
|
||||||
pr_err("IOWA:Too many pci bridges, "
|
pr_err("IOWA:Too many pci bridges, "
|
||||||
"workarounds disabled for %s\n", np->full_name);
|
"workarounds disabled for %s\n", np->full_name);
|
||||||
@ -171,14 +185,3 @@ void __devinit iowa_register_bus(struct pci_controller *phb,
|
|||||||
pr_debug("IOWA:[%d]Add bus, %s.\n", iowa_bus_count-1, np->full_name);
|
pr_debug("IOWA:[%d]Add bus, %s.\n", iowa_bus_count-1, np->full_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enable IO workaround */
|
|
||||||
void __devinit io_workaround_init(void)
|
|
||||||
{
|
|
||||||
static int io_workaround_inited;
|
|
||||||
|
|
||||||
if (io_workaround_inited)
|
|
||||||
return;
|
|
||||||
ppc_pci_io = iowa_pci_io;
|
|
||||||
ppc_md.ioremap = iowa_ioremap;
|
|
||||||
io_workaround_inited = 1;
|
|
||||||
}
|
|
||||||
|
@ -468,18 +468,6 @@ static struct of_device_id celleb_phb_match[] __initdata = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init celleb_io_workaround_init(struct pci_controller *phb,
|
|
||||||
struct celleb_phb_spec *phb_spec)
|
|
||||||
{
|
|
||||||
if (phb_spec->ops) {
|
|
||||||
iowa_register_bus(phb, phb_spec->ops, phb_spec->iowa_init,
|
|
||||||
phb_spec->iowa_data);
|
|
||||||
io_workaround_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __init celleb_setup_phb(struct pci_controller *phb)
|
int __init celleb_setup_phb(struct pci_controller *phb)
|
||||||
{
|
{
|
||||||
struct device_node *dev = phb->dn;
|
struct device_node *dev = phb->dn;
|
||||||
@ -499,7 +487,11 @@ int __init celleb_setup_phb(struct pci_controller *phb)
|
|||||||
if (rc)
|
if (rc)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return celleb_io_workaround_init(phb, phb_spec);
|
if (phb_spec->ops)
|
||||||
|
iowa_register_bus(phb, phb_spec->ops,
|
||||||
|
phb_spec->iowa_init,
|
||||||
|
phb_spec->iowa_data);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int celleb_pci_probe_mode(struct pci_bus *bus)
|
int celleb_pci_probe_mode(struct pci_bus *bus)
|
||||||
|
@ -136,8 +136,6 @@ static int __devinit cell_setup_phb(struct pci_controller *phb)
|
|||||||
|
|
||||||
iowa_register_bus(phb, &spiderpci_ops, &spiderpci_iowa_init,
|
iowa_register_bus(phb, &spiderpci_ops, &spiderpci_iowa_init,
|
||||||
(void *)SPIDER_PCI_REG_BASE);
|
(void *)SPIDER_PCI_REG_BASE);
|
||||||
io_workaround_init();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user