Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michael Ellerman and committed by
Benjamin Herrenschmidt
d1109b75 3cc30d07

+20 -28
-1
arch/powerpc/include/asm/io-workarounds.h
··· 31 31 void *private; 32 32 }; 33 33 34 - void __devinit io_workaround_init(void); 35 34 void __devinit iowa_register_bus(struct pci_controller *, struct ppc_pci_io *, 36 35 int (*)(struct iowa_bus *, void *), void *); 37 36 struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR);
+15 -12
arch/powerpc/kernel/io-workarounds.c
··· 144 144 return res; 145 145 } 146 146 147 - /* Regist new bus to support workaround */ 147 + /* Enable IO workaround */ 148 + static void __devinit io_workaround_init(void) 149 + { 150 + static int io_workaround_inited; 151 + 152 + if (io_workaround_inited) 153 + return; 154 + ppc_pci_io = iowa_pci_io; 155 + ppc_md.ioremap = iowa_ioremap; 156 + io_workaround_inited = 1; 157 + } 158 + 159 + /* Register new bus to support workaround */ 148 160 void __devinit iowa_register_bus(struct pci_controller *phb, 149 161 struct ppc_pci_io *ops, 150 162 int (*initfunc)(struct iowa_bus *, void *), void *data) 151 163 { 152 164 struct iowa_bus *bus; 153 165 struct device_node *np = phb->dn; 166 + 167 + io_workaround_init(); 154 168 155 169 if (iowa_bus_count >= IOWA_MAX_BUS) { 156 170 pr_err("IOWA:Too many pci bridges, " ··· 185 171 pr_debug("IOWA:[%d]Add bus, %s.\n", iowa_bus_count-1, np->full_name); 186 172 } 187 173 188 - /* enable IO workaround */ 189 - void __devinit io_workaround_init(void) 190 - { 191 - static int io_workaround_inited; 192 - 193 - if (io_workaround_inited) 194 - return; 195 - ppc_pci_io = iowa_pci_io; 196 - ppc_md.ioremap = iowa_ioremap; 197 - io_workaround_inited = 1; 198 - }
+5 -13
arch/powerpc/platforms/cell/celleb_pci.c
··· 468 468 }, 469 469 }; 470 470 471 - static int __init celleb_io_workaround_init(struct pci_controller *phb, 472 - struct celleb_phb_spec *phb_spec) 473 - { 474 - if (phb_spec->ops) { 475 - iowa_register_bus(phb, phb_spec->ops, phb_spec->iowa_init, 476 - phb_spec->iowa_data); 477 - io_workaround_init(); 478 - } 479 - 480 - return 0; 481 - } 482 - 483 471 int __init celleb_setup_phb(struct pci_controller *phb) 484 472 { 485 473 struct device_node *dev = phb->dn; ··· 487 499 if (rc) 488 500 return 1; 489 501 490 - return celleb_io_workaround_init(phb, phb_spec); 502 + if (phb_spec->ops) 503 + iowa_register_bus(phb, phb_spec->ops, 504 + phb_spec->iowa_init, 505 + phb_spec->iowa_data); 506 + return 0; 491 507 } 492 508 493 509 int celleb_pci_probe_mode(struct pci_bus *bus)
-2
arch/powerpc/platforms/cell/setup.c
··· 136 136 137 137 iowa_register_bus(phb, &spiderpci_ops, &spiderpci_iowa_init, 138 138 (void *)SPIDER_PCI_REG_BASE); 139 - io_workaround_init(); 140 - 141 139 return 0; 142 140 } 143 141