Commit c9438aff authored by Kumar Gala's avatar Kumar Gala

[POWERPC] Use for_each_ matching routinues for pci PHBs

On the Freescale embedded (83xx, 85xx, 86xx) and a few of the discrete
bridges (mpc10x, tsi108) use the new for_each_compatible_node() or
for_each_node_by_type() to provide more exact matching when looking for
PHBs in the device tree.

With the previous code it was possible to match on pci bridges since
we were only matching on device_type.
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 2fce1225
...@@ -43,7 +43,7 @@ static void __init mpc8313_rdb_setup_arch(void) ...@@ -43,7 +43,7 @@ static void __init mpc8313_rdb_setup_arch(void)
ppc_md.progress("mpc8313_rdb_setup_arch()", 0); ppc_md.progress("mpc8313_rdb_setup_arch()", 0);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np); mpc83xx_add_bridge(np);
#endif #endif
mpc831x_usb_cfg(); mpc831x_usb_cfg();
......
...@@ -73,7 +73,7 @@ static void __init mpc832x_sys_setup_arch(void) ...@@ -73,7 +73,7 @@ static void __init mpc832x_sys_setup_arch(void)
} }
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np); mpc83xx_add_bridge(np);
#endif #endif
......
...@@ -93,7 +93,7 @@ static void __init mpc832x_rdb_setup_arch(void) ...@@ -93,7 +93,7 @@ static void __init mpc832x_rdb_setup_arch(void)
ppc_md.progress("mpc832x_rdb_setup_arch()", 0); ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np); mpc83xx_add_bridge(np);
#endif #endif
......
...@@ -52,7 +52,7 @@ static void __init mpc834x_itx_setup_arch(void) ...@@ -52,7 +52,7 @@ static void __init mpc834x_itx_setup_arch(void)
ppc_md.progress("mpc834x_itx_setup_arch()", 0); ppc_md.progress("mpc834x_itx_setup_arch()", 0);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np); mpc83xx_add_bridge(np);
#endif #endif
......
...@@ -83,7 +83,7 @@ static void __init mpc834x_mds_setup_arch(void) ...@@ -83,7 +83,7 @@ static void __init mpc834x_mds_setup_arch(void)
ppc_md.progress("mpc834x_mds_setup_arch()", 0); ppc_md.progress("mpc834x_mds_setup_arch()", 0);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np); mpc83xx_add_bridge(np);
#endif #endif
......
...@@ -79,7 +79,7 @@ static void __init mpc836x_mds_setup_arch(void) ...@@ -79,7 +79,7 @@ static void __init mpc836x_mds_setup_arch(void)
} }
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np); mpc83xx_add_bridge(np);
#endif #endif
......
...@@ -204,8 +204,9 @@ static void __init mpc85xx_ads_setup_arch(void) ...@@ -204,8 +204,9 @@ static void __init mpc85xx_ads_setup_arch(void)
#endif #endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
fsl_add_bridge(np, 1); fsl_add_bridge(np, 1);
ppc_md.pci_exclude_device = mpc85xx_exclude_device; ppc_md.pci_exclude_device = mpc85xx_exclude_device;
#endif #endif
} }
......
...@@ -283,14 +283,18 @@ static void __init mpc85xx_cds_setup_arch(void) ...@@ -283,14 +283,18 @@ static void __init mpc85xx_cds_setup_arch(void)
} }
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) { for_each_node_by_type(np, "pci") {
struct resource rsrc; if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_address_to_resource(np, 0, &rsrc); of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
if ((rsrc.start & 0xfffff) == 0x8000) struct resource rsrc;
fsl_add_bridge(np, 1); of_address_to_resource(np, 0, &rsrc);
else if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 0); fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
}
} }
ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup; ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup;
ppc_md.pci_exclude_device = mpc85xx_exclude_device; ppc_md.pci_exclude_device = mpc85xx_exclude_device;
#endif #endif
......
...@@ -149,14 +149,18 @@ static void __init mpc85xx_ds_setup_arch(void) ...@@ -149,14 +149,18 @@ static void __init mpc85xx_ds_setup_arch(void)
ppc_md.progress("mpc85xx_ds_setup_arch()", 0); ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) { for_each_node_by_type(np, "pci") {
struct resource rsrc; if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_address_to_resource(np, 0, &rsrc); of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
if ((rsrc.start & 0xfffff) == primary_phb_addr) struct resource rsrc;
fsl_add_bridge(np, 1); of_address_to_resource(np, 0, &rsrc);
else if ((rsrc.start & 0xfffff) == primary_phb_addr)
fsl_add_bridge(np, 0); fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
}
} }
uses_fsl_uli_m1575 = 1; uses_fsl_uli_m1575 = 1;
ppc_md.pci_exclude_device = mpc85xx_exclude_device; ppc_md.pci_exclude_device = mpc85xx_exclude_device;
#endif #endif
......
...@@ -83,9 +83,17 @@ static void __init mpc85xx_mds_setup_arch(void) ...@@ -83,9 +83,17 @@ static void __init mpc85xx_mds_setup_arch(void)
} }
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_node_by_type(np, "pci") {
fsl_add_bridge(np, 1); if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_node_put(np); of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
}
}
#endif #endif
#ifdef CONFIG_QUICC_ENGINE #ifdef CONFIG_QUICC_ENGINE
......
...@@ -140,7 +140,7 @@ mpc86xx_hpcn_setup_arch(void) ...@@ -140,7 +140,7 @@ mpc86xx_hpcn_setup_arch(void)
ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) { for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
struct resource rsrc; struct resource rsrc;
of_address_to_resource(np, 0, &rsrc); of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000) if ((rsrc.start & 0xfffff) == 0x8000)
...@@ -148,6 +148,7 @@ mpc86xx_hpcn_setup_arch(void) ...@@ -148,6 +148,7 @@ mpc86xx_hpcn_setup_arch(void)
else else
fsl_add_bridge(np, 0); fsl_add_bridge(np, 0);
} }
uses_fsl_uli_m1575 = 1; uses_fsl_uli_m1575 = 1;
ppc_md.pci_exclude_device = mpc86xx_exclude_device; ppc_md.pci_exclude_device = mpc86xx_exclude_device;
......
...@@ -91,7 +91,7 @@ static void __init linkstation_setup_arch(void) ...@@ -91,7 +91,7 @@ static void __init linkstation_setup_arch(void)
#endif #endif
/* Lookup PCI host bridges */ /* Lookup PCI host bridges */
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_compatible_node(np, "pci", "mpc10x-pci")
linkstation_add_bridge(np); linkstation_add_bridge(np);
printk(KERN_INFO "BUFFALO Network Attached Storage Series\n"); printk(KERN_INFO "BUFFALO Network Attached Storage Series\n");
......
...@@ -74,7 +74,7 @@ static void __init mpc7448_hpc2_setup_arch(void) ...@@ -74,7 +74,7 @@ static void __init mpc7448_hpc2_setup_arch(void)
/* setup PCI host bridge */ /* setup PCI host bridge */
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for_each_compatible_node(np, "pci", "tsi108-pci")
tsi108_setup_pci(np, MPC7448HPC2_PCI_CFG_PHYS, 0); tsi108_setup_pci(np, MPC7448HPC2_PCI_CFG_PHYS, 0);
ppc_md.pci_exclude_device = mpc7448_hpc2_exclude_device; ppc_md.pci_exclude_device = mpc7448_hpc2_exclude_device;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment