Commit bede480d authored by Dmitry Eremin-Solenikov's avatar Dmitry Eremin-Solenikov Committed by Kumar Gala

powerpc/83xx: merge PCI bridge additions

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: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 7669d58c
...@@ -51,15 +51,14 @@ ...@@ -51,15 +51,14 @@
*/ */
static void __init mpc83xx_km_setup_arch(void) static void __init mpc83xx_km_setup_arch(void)
{ {
#ifdef CONFIG_QUICC_ENGINE
struct device_node *np; struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("kmpbec83xx_setup_arch()", 0); ppc_md.progress("kmpbec83xx_setup_arch()", 0);
#ifdef CONFIG_PCI mpc83xx_setup_pci();
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
#ifdef CONFIG_QUICC_ENGINE #ifdef CONFIG_QUICC_ENGINE
qe_reset(); qe_reset();
......
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/pci.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/hw_irq.h> #include <asm/hw_irq.h>
#include <asm/ipic.h> #include <asm/ipic.h>
#include <asm/qe_ic.h> #include <asm/qe_ic.h>
#include <sysdev/fsl_soc.h> #include <sysdev/fsl_soc.h>
#include <sysdev/fsl_pci.h>
#include "mpc83xx.h" #include "mpc83xx.h"
...@@ -128,3 +130,15 @@ int __init mpc83xx_declare_of_platform_devices(void) ...@@ -128,3 +130,15 @@ int __init mpc83xx_declare_of_platform_devices(void)
of_platform_bus_probe(NULL, of_bus_ids, NULL); of_platform_bus_probe(NULL, of_bus_ids, NULL);
return 0; 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
...@@ -28,19 +28,10 @@ ...@@ -28,19 +28,10 @@
*/ */
static void __init mpc831x_rdb_setup_arch(void) static void __init mpc831x_rdb_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc831x_rdb_setup_arch()", 0); ppc_md.progress("mpc831x_rdb_setup_arch()", 0);
#ifdef CONFIG_PCI mpc83xx_setup_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
mpc831x_usb_cfg(); mpc831x_usb_cfg();
} }
......
...@@ -72,10 +72,7 @@ static void __init mpc832x_sys_setup_arch(void) ...@@ -72,10 +72,7 @@ static void __init mpc832x_sys_setup_arch(void)
of_node_put(np); of_node_put(np);
} }
#ifdef CONFIG_PCI mpc83xx_setup_pci();
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
#ifdef CONFIG_QUICC_ENGINE #ifdef CONFIG_QUICC_ENGINE
qe_reset(); qe_reset();
......
...@@ -193,17 +193,14 @@ machine_device_initcall(mpc832x_rdb, mpc832x_spi_init); ...@@ -193,17 +193,14 @@ machine_device_initcall(mpc832x_rdb, mpc832x_spi_init);
*/ */
static void __init mpc832x_rdb_setup_arch(void) 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; struct device_node *np;
#endif #endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc832x_rdb_setup_arch()", 0); ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
#ifdef CONFIG_PCI mpc83xx_setup_pci();
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
#ifdef CONFIG_QUICC_ENGINE #ifdef CONFIG_QUICC_ENGINE
qe_reset(); qe_reset();
......
...@@ -58,17 +58,10 @@ machine_device_initcall(mpc834x_itx, mpc834x_itx_declare_of_platform_devices); ...@@ -58,17 +58,10 @@ machine_device_initcall(mpc834x_itx, mpc834x_itx_declare_of_platform_devices);
*/ */
static void __init mpc834x_itx_setup_arch(void) static void __init mpc834x_itx_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc834x_itx_setup_arch()", 0); ppc_md.progress("mpc834x_itx_setup_arch()", 0);
#ifdef CONFIG_PCI mpc83xx_setup_pci();
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
mpc834x_usb_cfg(); mpc834x_usb_cfg();
} }
......
...@@ -77,17 +77,10 @@ static int mpc834xemds_usb_cfg(void) ...@@ -77,17 +77,10 @@ static int mpc834xemds_usb_cfg(void)
*/ */
static void __init mpc834x_mds_setup_arch(void) static void __init mpc834x_mds_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc834x_mds_setup_arch()", 0); ppc_md.progress("mpc834x_mds_setup_arch()", 0);
#ifdef CONFIG_PCI mpc83xx_setup_pci();
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
mpc834xemds_usb_cfg(); mpc834xemds_usb_cfg();
} }
......
...@@ -80,10 +80,7 @@ static void __init mpc836x_mds_setup_arch(void) ...@@ -80,10 +80,7 @@ static void __init mpc836x_mds_setup_arch(void)
of_node_put(np); of_node_put(np);
} }
#ifdef CONFIG_PCI mpc83xx_setup_pci();
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
#ifdef CONFIG_QUICC_ENGINE #ifdef CONFIG_QUICC_ENGINE
qe_reset(); qe_reset();
......
...@@ -31,17 +31,10 @@ machine_device_initcall(mpc836x_rdk, mpc83xx_declare_of_platform_devices); ...@@ -31,17 +31,10 @@ machine_device_initcall(mpc836x_rdk, mpc83xx_declare_of_platform_devices);
static void __init mpc836x_rdk_setup_arch(void) static void __init mpc836x_rdk_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc836x_rdk_setup_arch()", 0); ppc_md.progress("mpc836x_rdk_setup_arch()", 0);
#ifdef CONFIG_PCI mpc83xx_setup_pci();
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
#ifdef CONFIG_QUICC_ENGINE #ifdef CONFIG_QUICC_ENGINE
qe_reset(); qe_reset();
#endif #endif
......
...@@ -79,19 +79,10 @@ static int mpc837xmds_usb_cfg(void) ...@@ -79,19 +79,10 @@ static int mpc837xmds_usb_cfg(void)
*/ */
static void __init mpc837x_mds_setup_arch(void) static void __init mpc837x_mds_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc837x_mds_setup_arch()", 0); ppc_md.progress("mpc837x_mds_setup_arch()", 0);
#ifdef CONFIG_PCI mpc83xx_setup_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
mpc837xmds_usb_cfg(); mpc837xmds_usb_cfg();
} }
......
...@@ -50,19 +50,10 @@ static void mpc837x_rdb_sd_cfg(void) ...@@ -50,19 +50,10 @@ static void mpc837x_rdb_sd_cfg(void)
*/ */
static void __init mpc837x_rdb_setup_arch(void) static void __init mpc837x_rdb_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc837x_rdb_setup_arch()", 0); ppc_md.progress("mpc837x_rdb_setup_arch()", 0);
#ifdef CONFIG_PCI mpc83xx_setup_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
mpc837x_usb_cfg(); mpc837x_usb_cfg();
mpc837x_rdb_sd_cfg(); mpc837x_rdb_sd_cfg();
} }
......
...@@ -79,6 +79,12 @@ static inline void __init mpc83xx_qe_init_IRQ(void) {} ...@@ -79,6 +79,12 @@ static inline void __init mpc83xx_qe_init_IRQ(void) {}
#define mpc83xx_ipic_and_qe_init_IRQ mpc83xx_ipic_init_IRQ #define mpc83xx_ipic_and_qe_init_IRQ mpc83xx_ipic_init_IRQ
#endif /* CONFIG_QUICC_ENGINE */ #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); extern int mpc83xx_declare_of_platform_devices(void);
#endif /* __MPC83XX_H__ */ #endif /* __MPC83XX_H__ */
...@@ -48,18 +48,10 @@ ...@@ -48,18 +48,10 @@
*/ */
static void __init sbc834x_setup_arch(void) static void __init sbc834x_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("sbc834x_setup_arch()", 0); ppc_md.progress("sbc834x_setup_arch()", 0);
#ifdef CONFIG_PCI mpc83xx_setup_pci();
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
} }
machine_device_initcall(sbc834x, mpc83xx_declare_of_platform_devices); machine_device_initcall(sbc834x, mpc83xx_declare_of_platform_devices);
......
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