From f584bc65ca9b9a4c21cc17bb01883874e2e6df0a Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Sat, 10 Nov 2007 04:11:56 +1100 Subject: [PATCH] [POWERPC] mpc5200: Add common mpc52xx_setup_pci() routine This patch moves a generic pci init code from lite5200 platform file to a common mpc52xx_setup_pci() routine and adds additional compatibility property verification. Signed-off-by: Marian Balakowicz Signed-off-by: Grant Likely --- arch/powerpc/platforms/52xx/lite5200.c | 12 +----------- arch/powerpc/platforms/52xx/mpc52xx_pci.c | 14 ++++++++++++++ include/asm-powerpc/mpc52xx.h | 5 +++++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c index 25d2bfa3d9..ce903bef00 100644 --- a/arch/powerpc/platforms/52xx/lite5200.c +++ b/arch/powerpc/platforms/52xx/lite5200.c @@ -131,10 +131,6 @@ static void lite5200_resume_finish(void __iomem *mbar) static void __init lite5200_setup_arch(void) { -#ifdef CONFIG_PCI - struct device_node *np; -#endif - if (ppc_md.progress) ppc_md.progress("lite5200_setup_arch()", 0); @@ -154,13 +150,7 @@ static void __init lite5200_setup_arch(void) lite5200_pm_init(); #endif -#ifdef CONFIG_PCI - np = of_find_node_by_type(NULL, "pci"); - if (np) { - mpc52xx_add_bridge(np); - of_node_put(np); - } -#endif + mpc52xx_setup_pci(); } /* diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c index 262eda8659..4b79398b2e 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c @@ -406,3 +406,17 @@ mpc52xx_add_bridge(struct device_node *node) return 0; } + +void __init mpc52xx_setup_pci(void) +{ + struct device_node *pci; + + pci = of_find_compatible_node(NULL, NULL, "fsl,mpc5200-pci"); + if (!pci) + pci = of_find_compatible_node(NULL, NULL, "mpc5200-pci"); + if (!pci) + return; + + mpc52xx_add_bridge(pci); + of_node_put(pci); +} diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h index fcb2ebbfdd..d7efbe09f9 100644 --- a/include/asm-powerpc/mpc52xx.h +++ b/include/asm-powerpc/mpc52xx.h @@ -257,7 +257,12 @@ extern void mpc52xx_declare_of_platform_devices(void); extern void mpc52xx_init_irq(void); extern unsigned int mpc52xx_get_irq(void); +#ifdef CONFIG_PCI extern int __init mpc52xx_add_bridge(struct device_node *node); +extern void __init mpc52xx_setup_pci(void); +#else +static inline void mpc52xx_setup_pci(void) { } +#endif extern void __init mpc52xx_map_wdt(void); extern void mpc52xx_restart(char *cmd); -- 2.39.5