]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] Use for_each_ matching routinues for pci PHBs
authorKumar Gala <galak@kernel.crashing.org>
Thu, 4 Oct 2007 05:28:43 +0000 (00:28 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Mon, 8 Oct 2007 13:38:40 +0000 (08:38 -0500)
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: Kumar Gala <galak@kernel.crashing.org>
13 files changed:
arch/powerpc/platforms/83xx/mpc8313_rdb.c
arch/powerpc/platforms/83xx/mpc832x_mds.c
arch/powerpc/platforms/83xx/mpc832x_rdb.c
arch/powerpc/platforms/83xx/mpc834x_itx.c
arch/powerpc/platforms/83xx/mpc834x_mds.c
arch/powerpc/platforms/83xx/mpc836x_mds.c
arch/powerpc/platforms/85xx/mpc85xx_ads.c
arch/powerpc/platforms/85xx/mpc85xx_cds.c
arch/powerpc/platforms/85xx/mpc85xx_ds.c
arch/powerpc/platforms/85xx/mpc85xx_mds.c
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
arch/powerpc/platforms/embedded6xx/linkstation.c
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c

index 140b46ffdb19e29ae9ea0090768ab77f377b4632..33766b8f259445ff36682cb9b2061e6a15ce87a2 100644 (file)
@@ -43,7 +43,7 @@ static void __init mpc8313_rdb_setup_arch(void)
                ppc_md.progress("mpc8313_rdb_setup_arch()", 0);
 
 #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);
 #endif
        mpc831x_usb_cfg();
index d494bc45645888c79f9f1543603392b302f42ff0..b8d8c914569bef720625cffc1000e01ccbc1f692 100644 (file)
@@ -73,7 +73,7 @@ static void __init mpc832x_sys_setup_arch(void)
        }
 
 #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);
 #endif
 
index 24a790c79ec085a04e7afe36795babad592420d7..4da0698487c04b443c55bcd9b0f609d39885509b 100644 (file)
@@ -93,7 +93,7 @@ static void __init mpc832x_rdb_setup_arch(void)
                ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
 
 #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);
 #endif
 
index 870fd20461ce131a1cbac1ce6d5481e3b798376c..aa768199432ddb1019e99963d3e59d1d264da9fd 100644 (file)
@@ -52,7 +52,7 @@ static void __init mpc834x_itx_setup_arch(void)
                ppc_md.progress("mpc834x_itx_setup_arch()", 0);
 
 #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);
 #endif
 
index a9140b64b98a968a7a67da8bfa036aabc0e9559b..00aed7c2269ea4e56cc74950cb3ccf92736d04a8 100644 (file)
@@ -83,7 +83,7 @@ static void __init mpc834x_mds_setup_arch(void)
                ppc_md.progress("mpc834x_mds_setup_arch()", 0);
 
 #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);
 #endif
 
index db6957611585aa4def0062bb4bb13947fbe300dc..0b18a75e92008b1d3bf627e7169f7adcd158580c 100644 (file)
@@ -79,7 +79,7 @@ static void __init mpc836x_mds_setup_arch(void)
        }
 
 #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);
 #endif
 
index c22bc1c4f5911a60ad8f44b2e4203076cc35c63b..acb1ef93224065a39e7058e29329d5010e421fae 100644 (file)
@@ -204,8 +204,9 @@ static void __init mpc85xx_ads_setup_arch(void)
 #endif
 
 #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);
+
        ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 }
index 665e8df05dc59cf6df01d3df739f6ce8435da1e2..abc85b8d9f8a443b95985e1e9cb19451af0bd07c 100644 (file)
@@ -283,14 +283,18 @@ static void __init mpc85xx_cds_setup_arch(void)
        }
 
 #ifdef CONFIG_PCI
-       for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) {
-               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);
+       for_each_node_by_type(np, "pci") {
+               if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
+                   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);
+               }
        }
+
        ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup;
        ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
index 4d449022ac9b6040e44b8bf6915827376b8af541..d60bb2beeb55106e7313f5eafbe21529cfc70098 100644 (file)
@@ -149,14 +149,18 @@ static void __init mpc85xx_ds_setup_arch(void)
                ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
 #ifdef CONFIG_PCI
-       for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) {
-               struct resource rsrc;
-               of_address_to_resource(np, 0, &rsrc);
-               if ((rsrc.start & 0xfffff) == primary_phb_addr)
-                       fsl_add_bridge(np, 1);
-               else
-                       fsl_add_bridge(np, 0);
+       for_each_node_by_type(np, "pci") {
+               if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
+                   of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
+                       struct resource rsrc;
+                       of_address_to_resource(np, 0, &rsrc);
+                       if ((rsrc.start & 0xfffff) == primary_phb_addr)
+                               fsl_add_bridge(np, 1);
+                       else
+                               fsl_add_bridge(np, 0);
+               }
        }
+
        uses_fsl_uli_m1575 = 1;
        ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
index c379286c37303c05db29a9e4b0ff5147301d0150..f8b6b08af84855120bc36fa66b9b631d70ca3eea 100644 (file)
@@ -83,9 +83,17 @@ static void __init mpc85xx_mds_setup_arch(void)
        }
 
 #ifdef CONFIG_PCI
-       for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
-               fsl_add_bridge(np, 1);
-       of_node_put(np);
+       for_each_node_by_type(np, "pci") {
+               if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
+                   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
 
 #ifdef CONFIG_QUICC_ENGINE
index 3ec9d5a25750d3e0b368d9dc00bbcde35e4de80e..6879b83ef95a0f53623da8b82815039a4ca4022a 100644 (file)
@@ -140,7 +140,7 @@ mpc86xx_hpcn_setup_arch(void)
                ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
 
 #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;
                of_address_to_resource(np, 0, &rsrc);
                if ((rsrc.start & 0xfffff) == 0x8000)
@@ -148,6 +148,7 @@ mpc86xx_hpcn_setup_arch(void)
                else
                        fsl_add_bridge(np, 0);
        }
+
        uses_fsl_uli_m1575 = 1;
        ppc_md.pci_exclude_device = mpc86xx_exclude_device;
 
index f392374309b342f937d13a626dddf10f23b66abc..eb5d74e26fe9d3731fad5fa7b5fad7d5bec35678 100644 (file)
@@ -91,7 +91,7 @@ static void __init linkstation_setup_arch(void)
 #endif
 
        /* 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);
 
        printk(KERN_INFO "BUFFALO Network Attached Storage Series\n");
index 96737e5608d3e90670f6d3565dde3fc85cc082d8..a2c04b9d42b1642726a4abb2ea1cc72a85e69ecb 100644 (file)
@@ -74,7 +74,7 @@ static void __init mpc7448_hpc2_setup_arch(void)
 
        /* setup PCI host bridge */
 #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);
 
        ppc_md.pci_exclude_device = mpc7448_hpc2_exclude_device;