powerpc/83xx: merge PCI bridge additions
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Thu, 17 Nov 2011 14:48:48 +0000 (18:48 +0400)
committerKumar Gala <galak@kernel.crashing.org>
Thu, 24 Nov 2011 08:01:40 +0000 (02:01 -0600)
Nearly all mpc83xx-based boards have a common piece of code - one that
loops over all pci/pcie bridges and registers them. Merge that code into
a special function common to all boards.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 files changed:
arch/powerpc/platforms/83xx/km83xx.c
arch/powerpc/platforms/83xx/misc.c
arch/powerpc/platforms/83xx/mpc831x_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/83xx/mpc836x_rdk.c
arch/powerpc/platforms/83xx/mpc837x_mds.c
arch/powerpc/platforms/83xx/mpc837x_rdb.c
arch/powerpc/platforms/83xx/mpc83xx.h
arch/powerpc/platforms/83xx/sbc834x.c

index 7ef63549517000b7c11ce2b27b4b0e9f69bf090d..65eb792a0d001eabcdfefc04d0fc279ca7456051 100644 (file)
  */
 static void __init mpc83xx_km_setup_arch(void)
 {
+#ifdef CONFIG_QUICC_ENGINE
        struct device_node *np;
+#endif
 
        if (ppc_md.progress)
                ppc_md.progress("kmpbec83xx_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
 
 #ifdef CONFIG_QUICC_ENGINE
        qe_reset();
index ee4de779ac11b869456b4184f64d347f52b7dfbd..125336f750c6969273d70d09e0eeefc39cb5a0c5 100644 (file)
 #include <linux/stddef.h>
 #include <linux/kernel.h>
 #include <linux/of_platform.h>
+#include <linux/pci.h>
 
 #include <asm/io.h>
 #include <asm/hw_irq.h>
 #include <asm/ipic.h>
 #include <asm/qe_ic.h>
 #include <sysdev/fsl_soc.h>
+#include <sysdev/fsl_pci.h>
 
 #include "mpc83xx.h"
 
@@ -128,3 +130,15 @@ int __init mpc83xx_declare_of_platform_devices(void)
        of_platform_bus_probe(NULL, of_bus_ids, NULL);
        return 0;
 }
+
+#ifdef CONFIG_PCI
+void __init mpc83xx_setup_pci(void)
+{
+       struct device_node *np;
+
+       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
+               mpc83xx_add_bridge(np);
+       for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie")
+               mpc83xx_add_bridge(np);
+}
+#endif
index ce87406b053493edfc73fa3ddc1d13c3bfd1690f..fa25977c52de464e4043af6e59e9e3ae6f3a78d0 100644 (file)
  */
 static void __init mpc831x_rdb_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-       struct device_node *np;
-#endif
-
        if (ppc_md.progress)
                ppc_md.progress("mpc831x_rdb_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-       for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
        mpc831x_usb_cfg();
 }
 
index df80eccbbc6d93d189d1505e82030d91f436443d..e36bc611dd6e44a527c076959878c16d73228419 100644 (file)
@@ -72,10 +72,7 @@ static void __init mpc832x_sys_setup_arch(void)
                of_node_put(np);
        }
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
 
 #ifdef CONFIG_QUICC_ENGINE
        qe_reset();
index e4c7c6424a8ae9fb2dc012d22fa613670d90b96a..eff5baabc3fbf1600dec624782778fa68fbef448 100644 (file)
@@ -193,17 +193,14 @@ machine_device_initcall(mpc832x_rdb, mpc832x_spi_init);
  */
 static void __init mpc832x_rdb_setup_arch(void)
 {
-#if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE)
+#if defined(CONFIG_QUICC_ENGINE)
        struct device_node *np;
 #endif
 
        if (ppc_md.progress)
                ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
 
 #ifdef CONFIG_QUICC_ENGINE
        qe_reset();
index 87868c1c52f0165e9ff007e25a6ea494c9deeeea..39849dd1b5bbb7d827639ed1d0486bc814874ed2 100644 (file)
@@ -58,17 +58,10 @@ machine_device_initcall(mpc834x_itx, mpc834x_itx_declare_of_platform_devices);
  */
 static void __init mpc834x_itx_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-       struct device_node *np;
-#endif
-
        if (ppc_md.progress)
                ppc_md.progress("mpc834x_itx_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
 
        mpc834x_usb_cfg();
 }
index 4be95550d0c35212738d9309b0e88b30144176ee..5828d8e97c37447a3a0ab4fbb9f8b01e8638b4fd 100644 (file)
@@ -77,17 +77,10 @@ static int mpc834xemds_usb_cfg(void)
  */
 static void __init mpc834x_mds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-       struct device_node *np;
-#endif
-
        if (ppc_md.progress)
                ppc_md.progress("mpc834x_mds_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
 
        mpc834xemds_usb_cfg();
 }
index 3b202752ef5f75ea5287c84e986593d2009cd7d5..ad8e4bcd7d55b412b6ad4f65552490ae67ac7031 100644 (file)
@@ -80,10 +80,7 @@ static void __init mpc836x_mds_setup_arch(void)
                of_node_put(np);
        }
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
 
 #ifdef CONFIG_QUICC_ENGINE
        qe_reset();
index fd6f730ff2f956b31f951fbc59a26e9ca4a91f9c..f8769d713d6116b94d90c09f5f28aa2d0c72d7e5 100644 (file)
@@ -31,17 +31,10 @@ machine_device_initcall(mpc836x_rdk, mpc83xx_declare_of_platform_devices);
 
 static void __init mpc836x_rdk_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-       struct device_node *np;
-#endif
-
        if (ppc_md.progress)
                ppc_md.progress("mpc836x_rdk_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
 #ifdef CONFIG_QUICC_ENGINE
        qe_reset();
 #endif
index 74631832e1a34c350a1fc6980f27cf73fad13e30..e53a60b6c86364493bce952bd391e4893eb3659c 100644 (file)
@@ -79,19 +79,10 @@ out:
  */
 static void __init mpc837x_mds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-       struct device_node *np;
-#endif
-
        if (ppc_md.progress)
                ppc_md.progress("mpc837x_mds_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-       for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
        mpc837xmds_usb_cfg();
 }
 
index a4a5336d1143fcfe559d2f084b2cc7bbc4a155c5..16c9c9cbbb7fa48967219dcd3d4a0a7fe4a0c66d 100644 (file)
@@ -50,19 +50,10 @@ static void mpc837x_rdb_sd_cfg(void)
  */
 static void __init mpc837x_rdb_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-       struct device_node *np;
-#endif
-
        if (ppc_md.progress)
                ppc_md.progress("mpc837x_rdb_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-       for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie")
-               mpc83xx_add_bridge(np);
-#endif
+       mpc83xx_setup_pci();
        mpc837x_usb_cfg();
        mpc837x_rdb_sd_cfg();
 }
index a54f6baaae705091cd0eacddfc68f25a6fe77647..0cf74d7ea1c56cb26fea0096627949b20af4002e 100644 (file)
@@ -79,6 +79,12 @@ static inline void __init mpc83xx_qe_init_IRQ(void) {}
 #define mpc83xx_ipic_and_qe_init_IRQ mpc83xx_ipic_init_IRQ
 #endif /* CONFIG_QUICC_ENGINE */
 
+#ifdef CONFIG_PCI
+extern void mpc83xx_setup_pci(void);
+#else
+#define mpc83xx_setup_pci()    do {} while (0)
+#endif
+
 extern int mpc83xx_declare_of_platform_devices(void);
 
 #endif                         /* __MPC83XX_H__ */
index 22faaa1c107326197071ac19f944ba658bec048f..1c3dfc8556f07ee66a04037b16f6b8f9b5f3fc21 100644 (file)
  */
 static void __init sbc834x_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-       struct device_node *np;
-#endif
-
        if (ppc_md.progress)
                ppc_md.progress("sbc834x_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-       for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
-               mpc83xx_add_bridge(np);
-#endif
-
+       mpc83xx_setup_pci();
 }
 
 machine_device_initcall(sbc834x, mpc83xx_declare_of_platform_devices);