@@ -16,6 +16,7 @@
struct pci_sys_data;
struct pci_ops;
struct pci_bus;
+struct device;
struct hw_pci {
#ifdef CONFIG_PCI_DOMAINS
@@ -57,7 +58,7 @@ struct pci_sys_data {
/*
* Call this with your hw_pci struct to initialise the PCI system.
*/
-void pci_common_init(struct hw_pci *);
+void pci_common_init(struct device *, struct hw_pci *);
/*
* Setup early fixed I/O mapping.
@@ -445,7 +445,8 @@ static int pcibios_init_resources(int busnr, struct pci_sys_data *sys)
return 0;
}
-static void pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
+static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
+ struct list_head *head)
{
struct pci_sys_data *sys = NULL;
int ret;
@@ -479,7 +480,7 @@ static void pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
if (hw->scan)
sys->bus = hw->scan(nr, sys);
else
- sys->bus = pci_scan_root_bus(NULL, sys->busnr,
+ sys->bus = pci_scan_root_bus(parent, sys->busnr,
hw->ops, sys, &sys->resources);
if (!sys->bus)
@@ -496,7 +497,7 @@ static void pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
}
}
-void pci_common_init(struct hw_pci *hw)
+void pci_common_init(struct device *parent, struct hw_pci *hw)
{
struct pci_sys_data *sys;
LIST_HEAD(head);
@@ -504,7 +505,7 @@ void pci_common_init(struct hw_pci *hw)
pci_add_flags(PCI_REASSIGN_ALL_RSRC);
if (hw->preinit)
hw->preinit();
- pcibios_init_hw(hw, &head);
+ pcibios_init_hw(parent, hw, &head);
if (hw->postinit)
hw->postinit();
@@ -374,7 +374,7 @@ static int __init cns3xxx_pcie_init(void)
cns3xxx_pwr_soft_rst(0x1 << PM_SOFT_RST_REG_OFFST_PCIE(i));
cns3xxx_pcie_check_link(&cns3xxx_pcie[i]);
cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]);
- pci_common_init(&cns3xxx_pcie[i].hw_pci);
+ pci_common_init(NULL, &cns3xxx_pcie[i].hw_pci);
}
pci_assign_unassigned_resources();
@@ -216,5 +216,5 @@ void __init dove_pcie_init(int init_port0, int init_port1)
if (init_port1)
add_pcie_port(1, DOVE_PCIE1_VIRT_BASE);
- pci_common_init(&dove_pci);
+ pci_common_init(NULL, &dove_pci);
}
@@ -56,7 +56,7 @@ static struct hw_pci cats_pci __initdata = {
static int __init cats_pci_init(void)
{
if (machine_is_cats())
- pci_common_init(&cats_pci);
+ pci_common_init(NULL, &cats_pci);
return 0;
}
@@ -40,7 +40,7 @@ static struct hw_pci ebsa285_pci __initdata = {
static int __init ebsa285_init_pci(void)
{
if (machine_is_ebsa285())
- pci_common_init(&ebsa285_pci);
+ pci_common_init(NULL, &ebsa285_pci);
return 0;
}
@@ -54,7 +54,7 @@ static struct hw_pci netwinder_pci __initdata = {
static int __init netwinder_pci_init(void)
{
if (machine_is_netwinder())
- pci_common_init(&netwinder_pci);
+ pci_common_init(NULL, &netwinder_pci);
return 0;
}
@@ -50,7 +50,7 @@ static struct hw_pci personal_server_pci __initdata = {
static int __init personal_pci_init(void)
{
if (machine_is_personal_server())
- pci_common_init(&personal_server_pci);
+ pci_common_init(NULL, &personal_server_pci);
return 0;
}
@@ -106,7 +106,7 @@ static struct hw_pci integrator_pci __initdata = {
static int __init integrator_pci_init(void)
{
if (machine_is_integrator())
- pci_common_init(&integrator_pci);
+ pci_common_init(NULL, &integrator_pci);
return 0;
}
@@ -64,7 +64,7 @@ static struct hw_pci iq81340mc_pci __initdata = {
static int __init iq81340mc_pci_init(void)
{
iop13xx_atu_select(&iq81340mc_pci);
- pci_common_init(&iq81340mc_pci);
+ pci_common_init(NULL, &iq81340mc_pci);
iop13xx_map_pci_memory();
return 0;
@@ -66,7 +66,7 @@ static struct hw_pci iq81340sc_pci __initdata = {
static int __init iq81340sc_pci_init(void)
{
iop13xx_atu_select(&iq81340sc_pci);
- pci_common_init(&iq81340sc_pci);
+ pci_common_init(NULL, &iq81340sc_pci);
iop13xx_map_pci_memory();
return 0;
@@ -109,7 +109,7 @@ static struct hw_pci em7210_pci __initdata = {
static int __init em7210_pci_init(void)
{
if (machine_is_em7210())
- pci_common_init(&em7210_pci);
+ pci_common_init(NULL, &em7210_pci);
return 0;
}
@@ -102,7 +102,7 @@ static struct hw_pci glantank_pci __initdata = {
static int __init glantank_pci_init(void)
{
if (machine_is_glantank())
- pci_common_init(&glantank_pci);
+ pci_common_init(NULL, &glantank_pci);
return 0;
}
@@ -171,7 +171,7 @@ static struct hw_pci iq31244_pci __initdata = {
static int __init iq31244_pci_init(void)
{
if (is_ep80219())
- pci_common_init(&ep80219_pci);
+ pci_common_init(NULL, &ep80219_pci);
else if (machine_is_iq31244()) {
if (is_80219()) {
printk("note: iq31244 board type has been selected\n");
@@ -181,7 +181,7 @@ static int __init iq31244_pci_init(void)
printk("\t2/ update boot loader to pass"
" the ep80219 id: %d\n", MACH_TYPE_EP80219);
}
- pci_common_init(&iq31244_pci);
+ pci_common_init(NULL, &iq31244_pci);
}
return 0;
@@ -108,7 +108,7 @@ static int __init iq80321_pci_init(void)
{
if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) &&
machine_is_iq80321())
- pci_common_init(&iq80321_pci);
+ pci_common_init(NULL, &iq80321_pci);
return 0;
}
@@ -134,7 +134,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_REALTEK, PCI_ANY_ID, n2100_fixup_r8169);
static int __init n2100_pci_init(void)
{
if (machine_is_n2100())
- pci_common_init(&n2100_pci);
+ pci_common_init(NULL, &n2100_pci);
return 0;
}
@@ -91,7 +91,7 @@ static int __init iq80331_pci_init(void)
{
if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) &&
machine_is_iq80331())
- pci_common_init(&iq80331_pci);
+ pci_common_init(NULL, &iq80331_pci);
return 0;
}
@@ -91,7 +91,7 @@ static int __init iq80332_pci_init(void)
{
if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) &&
machine_is_iq80332())
- pci_common_init(&iq80332_pci);
+ pci_common_init(NULL, &iq80332_pci);
return 0;
}
@@ -74,7 +74,7 @@ struct hw_pci avila_pci __initdata = {
int __init avila_pci_init(void)
{
if (machine_is_avila() || machine_is_loft())
- pci_common_init(&avila_pci);
+ pci_common_init(NULL, &avila_pci);
return 0;
}
@@ -57,7 +57,7 @@ struct hw_pci coyote_pci __initdata = {
int __init coyote_pci_init(void)
{
if (machine_is_adi_coyote())
- pci_common_init(&coyote_pci);
+ pci_common_init(NULL, &coyote_pci);
return 0;
}
@@ -71,7 +71,7 @@ struct hw_pci __initdata dsmg600_pci = {
int __init dsmg600_pci_init(void)
{
if (machine_is_dsmg600())
- pci_common_init(&dsmg600_pci);
+ pci_common_init(NULL, &dsmg600_pci);
return 0;
}
@@ -68,7 +68,7 @@ struct hw_pci fsg_pci __initdata = {
int __init fsg_pci_init(void)
{
if (machine_is_fsg())
- pci_common_init(&fsg_pci);
+ pci_common_init(NULL, &fsg_pci);
return 0;
}
@@ -56,7 +56,7 @@ struct hw_pci gateway7001_pci __initdata = {
int __init gateway7001_pci_init(void)
{
if (machine_is_gateway7001())
- pci_common_init(&gateway7001_pci);
+ pci_common_init(NULL, &gateway7001_pci);
return 0;
}
@@ -485,7 +485,7 @@ static int __init gmlr_pci_init(void)
{
if (machine_is_goramo_mlr() &&
(hw_bits & (CFG_HW_USB_PORTS | CFG_HW_HAS_PCI_SLOT)))
- pci_common_init(&gmlr_hw_pci);
+ pci_common_init(NULL, &gmlr_hw_pci);
return 0;
}
@@ -76,7 +76,7 @@ struct hw_pci gtwx5715_pci __initdata = {
int __init gtwx5715_pci_init(void)
{
if (machine_is_gtwx5715())
- pci_common_init(>wx5715_pci);
+ pci_common_init(NULL, >wx5715_pci);
return 0;
}
@@ -70,7 +70,7 @@ int __init ixdp425_pci_init(void)
{
if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
machine_is_ixdp465() || machine_is_kixrp435())
- pci_common_init(&ixdp425_pci);
+ pci_common_init(NULL, &ixdp425_pci);
return 0;
}
@@ -51,7 +51,7 @@ struct hw_pci ixdpg425_pci __initdata = {
int __init ixdpg425_pci_init(void)
{
if (machine_is_ixdpg425())
- pci_common_init(&ixdpg425_pci);
+ pci_common_init(NULL, &ixdpg425_pci);
return 0;
}
@@ -70,7 +70,7 @@ struct hw_pci miccpt_pci __initdata = {
int __init miccpt_pci_init(void)
{
if (machine_is_miccpt())
- pci_common_init(&miccpt_pci);
+ pci_common_init(NULL, &miccpt_pci);
return 0;
}
@@ -67,7 +67,7 @@ struct hw_pci __initdata nas100d_pci = {
int __init nas100d_pci_init(void)
{
if (machine_is_nas100d())
- pci_common_init(&nas100d_pci);
+ pci_common_init(NULL, &nas100d_pci);
return 0;
}
@@ -63,7 +63,7 @@ struct hw_pci __initdata nslu2_pci = {
int __init nslu2_pci_init(void) /* monkey see, monkey do */
{
if (machine_is_nslu2())
- pci_common_init(&nslu2_pci);
+ pci_common_init(NULL, &nslu2_pci);
return 0;
}
@@ -65,7 +65,7 @@ struct hw_pci vulcan_pci __initdata = {
int __init vulcan_pci_init(void)
{
if (machine_is_arcom_vulcan())
- pci_common_init(&vulcan_pci);
+ pci_common_init(NULL, &vulcan_pci);
return 0;
}
@@ -55,7 +55,7 @@ struct hw_pci wg302v2_pci __initdata = {
int __init wg302v2_pci_init(void)
{
if (machine_is_wg302v2())
- pci_common_init(&wg302v2_pci);
+ pci_common_init(NULL, &wg302v2_pci);
return 0;
}
@@ -263,5 +263,5 @@ void __init kirkwood_pcie_init(unsigned int portmask)
add_pcie_port(1, PCIE1_VIRT_BASE);
kirkwood_pci.nr_controllers = num_pcie_ports;
- pci_common_init(&kirkwood_pci);
+ pci_common_init(NULL, &kirkwood_pci);
}
@@ -321,5 +321,5 @@ void __init ks8695_init_pci(struct ks8695_pci_cfg *cfg)
ks8695_pci.map_irq = cfg->map_irq; /* board-specific map_irq method */
- pci_common_init(&ks8695_pci);
+ pci_common_init(NULL, &ks8695_pci);
}
@@ -265,5 +265,5 @@ void __init mv78xx0_pcie_init(int init_port0, int init_port1)
}
}
- pci_common_init(&mv78xx0_pci);
+ pci_common_init(NULL, &mv78xx0_pci);
}
@@ -273,7 +273,7 @@ static struct hw_pci db88f5281_pci __initdata = {
static int __init db88f5281_pci_init(void)
{
if (machine_is_db88f5281())
- pci_common_init(&db88f5281_pci);
+ pci_common_init(NULL, &db88f5281_pci);
return 0;
}
@@ -98,7 +98,7 @@ static int __init dns323_pci_init(void)
* gets in the way of initialising the SATA controller.
*/
if (machine_is_dns323() && system_rev == DNS323_REV_A1)
- pci_common_init(&dns323_pci);
+ pci_common_init(NULL, &dns323_pci);
return 0;
}
@@ -147,7 +147,7 @@ static int __init kurobox_pro_pci_init(void)
{
if (machine_is_kurobox_pro()) {
orion5x_pci_disable();
- pci_common_init(&kurobox_pro_pci);
+ pci_common_init(NULL, &kurobox_pro_pci);
}
return 0;
@@ -97,7 +97,7 @@ static struct hw_pci mss2_pci __initdata = {
static int __init mss2_pci_init(void)
{
if (machine_is_mss2())
- pci_common_init(&mss2_pci);
+ pci_common_init(NULL, &mss2_pci);
return 0;
}
@@ -157,7 +157,7 @@ static int __init rd88f5181l_fxo_pci_init(void)
{
if (machine_is_rd88f5181l_fxo()) {
orion5x_pci_set_cardbus_mode();
- pci_common_init(&rd88f5181l_fxo_pci);
+ pci_common_init(NULL, &rd88f5181l_fxo_pci);
}
return 0;
@@ -169,7 +169,7 @@ static int __init rd88f5181l_ge_pci_init(void)
{
if (machine_is_rd88f5181l_ge()) {
orion5x_pci_set_cardbus_mode();
- pci_common_init(&rd88f5181l_ge_pci);
+ pci_common_init(NULL, &rd88f5181l_ge_pci);
}
return 0;
@@ -179,7 +179,7 @@ static struct hw_pci rd88f5182_pci __initdata = {
static int __init rd88f5182_pci_init(void)
{
if (machine_is_rd88f5182())
- pci_common_init(&rd88f5182_pci);
+ pci_common_init(NULL, &rd88f5182_pci);
return 0;
}
@@ -109,7 +109,7 @@ static int __init rd88f6183ap_ge_pci_init(void)
{
if (machine_is_rd88f6183ap_ge()) {
orion5x_pci_disable();
- pci_common_init(&rd88f6183ap_ge_pci);
+ pci_common_init(NULL, &rd88f6183ap_ge_pci);
}
return 0;
@@ -130,7 +130,7 @@ static struct hw_pci tsp2_pci __initdata = {
static int __init tsp2_pci_init(void)
{
if (machine_is_terastation_pro2())
- pci_common_init(&tsp2_pci);
+ pci_common_init(NULL, &tsp2_pci);
return 0;
}
@@ -178,7 +178,7 @@ static struct hw_pci qnap_ts209_pci __initdata = {
static int __init qnap_ts209_pci_init(void)
{
if (machine_is_ts209())
- pci_common_init(&qnap_ts209_pci);
+ pci_common_init(NULL, &qnap_ts209_pci);
return 0;
}
@@ -148,7 +148,7 @@ static struct hw_pci qnap_ts409_pci __initdata = {
static int __init qnap_ts409_pci_init(void)
{
if (machine_is_ts409())
- pci_common_init(&qnap_ts409_pci);
+ pci_common_init(NULL, &qnap_ts409_pci);
return 0;
}
@@ -163,7 +163,7 @@ static struct hw_pci wnr854t_pci __initdata = {
static int __init wnr854t_pci_init(void)
{
if (machine_is_wnr854t())
- pci_common_init(&wnr854t_pci);
+ pci_common_init(NULL, &wnr854t_pci);
return 0;
}
@@ -251,7 +251,7 @@ static struct hw_pci wrt350n_v2_pci __initdata = {
static int __init wrt350n_v2_pci_init(void)
{
if (machine_is_wrt350n_v2())
- pci_common_init(&wrt350n_v2_pci);
+ pci_common_init(NULL, &wrt350n_v2_pci);
return 0;
}
@@ -191,7 +191,7 @@ static struct hw_pci cmx2xx_pci __initdata = {
static int __init cmx2xx_init_pci(void)
{
if (machine_is_armcore())
- pci_common_init(&cmx2xx_pci);
+ pci_common_init(NULL, &cmx2xx_pci);
return 0;
}
@@ -275,7 +275,7 @@ static struct hw_pci nanoengine_pci __initdata = {
static int __init nanoengine_pci_init(void)
{
if (machine_is_nanoengine())
- pci_common_init(&nanoengine_pci);
+ pci_common_init(NULL, &nanoengine_pci);
return 0;
}
@@ -49,7 +49,7 @@ static int __init shark_pci_init(void)
pci_ioremap_io(0, IO_START);
- pci_common_init(&shark_pci);
+ pci_common_init(NULL, &shark_pci);
return 0;
}
@@ -881,7 +881,7 @@ int __init tegra_pcie_init(bool init_port0, bool init_port1)
if (init_port1)
tegra_pcie_add_port(1, RP1_OFFSET, AFI_PEX1_CTRL);
- pci_common_init(&tegra_pcie_hw);
+ pci_common_init(NULL, &tegra_pcie_hw);
return 0;
}
@@ -348,7 +348,7 @@ static struct hw_pci versatile_pci __initdata = {
static int __init versatile_pci_init(void)
{
- pci_common_init(&versatile_pci);
+ pci_common_init(NULL, &versatile_pci);
return 0;
}
When working with device tree support for PCI on ARM you run into a problem when mapping IRQs from the device tree irqmaps: doing this the code in drivers/of/of_pci_irq.c will try to find the OF node on the root bridge and this fails, because bus->dev.of_node is NULL, and that in turn boils down to the fact that pci_set_bus_of_node() has called pcibios_get_phb_of_node() from drivers/pci/of.c to obtain the OF node of the bridge or its parent and none is set and thus NULL is returned. Fix this by adding an additional parent argument when registering PCI bridges on the ARM architecture using the pci_common_init() call, and pass along this parent to pci_scan_root_bus() called from pcibios_init_hw() in bios32.c and voila: the IRQ mappings start working: the OF node can be retrieved from the parent. Currently all users are set to use NULL as argument to this call, but subsequent patches to the Integrator/AP make use of this facility to pass a parent. Cc: Mike Rapoport <mike@compulab.co.il> Cc: Russell King <linux@arm.linux.org.uk> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Thierry Reding <thierry.reding@avionic-design.de> Cc: Andrew Murray <andrew.murray@arm.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Benjamin Herrenschmitt <benh@kernel.crashing.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/include/asm/mach/pci.h | 3 ++- arch/arm/kernel/bios32.c | 9 +++++---- arch/arm/mach-cns3xxx/pcie.c | 2 +- arch/arm/mach-dove/pcie.c | 2 +- arch/arm/mach-footbridge/cats-pci.c | 2 +- arch/arm/mach-footbridge/ebsa285-pci.c | 2 +- arch/arm/mach-footbridge/netwinder-pci.c | 2 +- arch/arm/mach-footbridge/personal-pci.c | 2 +- arch/arm/mach-integrator/pci.c | 2 +- arch/arm/mach-iop13xx/iq81340mc.c | 2 +- arch/arm/mach-iop13xx/iq81340sc.c | 2 +- arch/arm/mach-iop32x/em7210.c | 2 +- arch/arm/mach-iop32x/glantank.c | 2 +- arch/arm/mach-iop32x/iq31244.c | 4 ++-- arch/arm/mach-iop32x/iq80321.c | 2 +- arch/arm/mach-iop32x/n2100.c | 2 +- arch/arm/mach-iop33x/iq80331.c | 2 +- arch/arm/mach-iop33x/iq80332.c | 2 +- arch/arm/mach-ixp4xx/avila-pci.c | 2 +- arch/arm/mach-ixp4xx/coyote-pci.c | 2 +- arch/arm/mach-ixp4xx/dsmg600-pci.c | 2 +- arch/arm/mach-ixp4xx/fsg-pci.c | 2 +- arch/arm/mach-ixp4xx/gateway7001-pci.c | 2 +- arch/arm/mach-ixp4xx/goramo_mlr.c | 2 +- arch/arm/mach-ixp4xx/gtwx5715-pci.c | 2 +- arch/arm/mach-ixp4xx/ixdp425-pci.c | 2 +- arch/arm/mach-ixp4xx/ixdpg425-pci.c | 2 +- arch/arm/mach-ixp4xx/miccpt-pci.c | 2 +- arch/arm/mach-ixp4xx/nas100d-pci.c | 2 +- arch/arm/mach-ixp4xx/nslu2-pci.c | 2 +- arch/arm/mach-ixp4xx/vulcan-pci.c | 2 +- arch/arm/mach-ixp4xx/wg302v2-pci.c | 2 +- arch/arm/mach-kirkwood/pcie.c | 2 +- arch/arm/mach-ks8695/pci.c | 2 +- arch/arm/mach-mv78xx0/pcie.c | 2 +- arch/arm/mach-orion5x/db88f5281-setup.c | 2 +- arch/arm/mach-orion5x/dns323-setup.c | 2 +- arch/arm/mach-orion5x/kurobox_pro-setup.c | 2 +- arch/arm/mach-orion5x/mss2-setup.c | 2 +- arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c | 2 +- arch/arm/mach-orion5x/rd88f5181l-ge-setup.c | 2 +- arch/arm/mach-orion5x/rd88f5182-setup.c | 2 +- arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c | 2 +- arch/arm/mach-orion5x/terastation_pro2-setup.c | 2 +- arch/arm/mach-orion5x/ts209-setup.c | 2 +- arch/arm/mach-orion5x/ts409-setup.c | 2 +- arch/arm/mach-orion5x/wnr854t-setup.c | 2 +- arch/arm/mach-orion5x/wrt350n-v2-setup.c | 2 +- arch/arm/mach-pxa/cm-x2xx-pci.c | 2 +- arch/arm/mach-sa1100/pci-nanoengine.c | 2 +- arch/arm/mach-shark/pci.c | 2 +- arch/arm/mach-tegra/pcie.c | 2 +- arch/arm/mach-versatile/pci.c | 2 +- 53 files changed, 59 insertions(+), 57 deletions(-)