powerpc/mpc512x: move common code to shared.c file
authorGerhard Sittig <gsi@denx.de>
Tue, 14 May 2013 04:40:53 +0000 (04:40 +0000)
committerAnatolij Gustschin <agust@denx.de>
Tue, 21 May 2013 08:58:39 +0000 (10:58 +0200)
- implement all of the init, init early, and setup arch routines in the
  shared source file for the MPC512x PowerPC platform, and make all
  MPC512x based boards (ADS, PDM, generic) use those common routines
- remove declarations from header files for routines which aren't
  referenced from external callers any longer

this modification concentrates knowledge about the optional FSL DIU
support in one spot within the shared code, and makes all boards benefit
transparently from future improvements in the shared platform code

the change does not modify any behaviour but preserves all code paths

Signed-off-by: Gerhard Sittig <gsi@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
arch/powerpc/include/asm/mpc5121.h
arch/powerpc/platforms/512x/mpc5121_ads.c
arch/powerpc/platforms/512x/mpc512x.h
arch/powerpc/platforms/512x/mpc512x_generic.c
arch/powerpc/platforms/512x/mpc512x_shared.c
arch/powerpc/platforms/512x/pdm360ng.c

index 885c040d619431be02be2961393f4b7e783d6228..8ae133eaf9faedfaac826491c3f2254f6fa5565f 100644 (file)
@@ -68,6 +68,5 @@ struct mpc512x_lpc {
 };
 
 int mpc512x_cs_config(unsigned int cs, u32 val);
-int __init mpc5121_clk_init(void);
 
 #endif /* __ASM_POWERPC_MPC5121_H__ */
index 0a134e0469ef637b479c5c12d2178d88f8821f81..3e90ece10ae9ddad7f45b12803b2015775eee9ad 100644 (file)
@@ -43,9 +43,7 @@ static void __init mpc5121_ads_setup_arch(void)
                mpc83xx_add_bridge(np);
 #endif
 
-#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
-       mpc512x_setup_diu();
-#endif
+       mpc512x_setup_arch();
 }
 
 static void __init mpc5121_ads_init_IRQ(void)
@@ -69,7 +67,7 @@ define_machine(mpc5121_ads) {
        .probe                  = mpc5121_ads_probe,
        .setup_arch             = mpc5121_ads_setup_arch,
        .init                   = mpc512x_init,
-       .init_early             = mpc512x_init_diu,
+       .init_early             = mpc512x_init_early,
        .init_IRQ               = mpc5121_ads_init_IRQ,
        .get_irq                = ipic_get_irq,
        .calibrate_decr         = generic_calibrate_decr,
index 0a8e6002394409a4f8f179cbdc3960b6897fce98..fdb4303246a0e6186d8ee2cc4f3a4b8e721669ea 100644 (file)
 #ifndef __MPC512X_H__
 #define __MPC512X_H__
 extern void __init mpc512x_init_IRQ(void);
+extern void __init mpc512x_init_early(void);
 extern void __init mpc512x_init(void);
+extern void __init mpc512x_setup_arch(void);
 extern int __init mpc5121_clk_init(void);
-void __init mpc512x_declare_of_platform_devices(void);
 extern const char *mpc512x_select_psc_compat(void);
 extern void mpc512x_restart(char *cmd);
 
-#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
-void mpc512x_init_diu(void);
-void mpc512x_setup_diu(void);
-#else
-#define mpc512x_init_diu NULL
-#define mpc512x_setup_diu NULL
-#endif
-
 #endif                         /* __MPC512X_H__ */
index 5fb919b309246501e88713d580831125d478ceea..ce71408781a0d2d98b099bea3f507fe4345c546c 100644 (file)
@@ -45,8 +45,8 @@ define_machine(mpc512x_generic) {
        .name                   = "MPC512x generic",
        .probe                  = mpc512x_generic_probe,
        .init                   = mpc512x_init,
-       .init_early             = mpc512x_init_diu,
-       .setup_arch             = mpc512x_setup_diu,
+       .init_early             = mpc512x_init_early,
+       .setup_arch             = mpc512x_setup_arch,
        .init_IRQ               = mpc512x_init_IRQ,
        .get_irq                = ipic_get_irq,
        .calibrate_decr         = generic_calibrate_decr,
index 6eb94ab99d3943990e1000b90c44e081d2931e9a..09622d3323d7b1d0a256b259be2ae82eee108687 100644 (file)
@@ -58,7 +58,7 @@ void mpc512x_restart(char *cmd)
                ;
 }
 
-#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
+#if IS_ENABLED(CONFIG_FB_FSL_DIU)
 
 struct fsl_diu_shared_fb {
        u8              gamma[0x300];   /* 32-bit aligned! */
@@ -436,6 +436,12 @@ void __init mpc512x_psc_fifo_init(void)
        }
 }
 
+void __init mpc512x_init_early(void)
+{
+       if (IS_ENABLED(CONFIG_FB_FSL_DIU))
+               mpc512x_init_diu();
+}
+
 void __init mpc512x_init(void)
 {
        mpc5121_clk_init();
@@ -444,6 +450,12 @@ void __init mpc512x_init(void)
        mpc512x_psc_fifo_init();
 }
 
+void __init mpc512x_setup_arch(void)
+{
+       if (IS_ENABLED(CONFIG_FB_FSL_DIU))
+               mpc512x_setup_diu();
+}
+
 /**
  * mpc512x_cs_config - Setup chip select configuration
  * @cs: chip select number
index 0575e858291ce153e7fead2265a5c81b20e6799c..24b314d7bd5f127d8c36da9ada186d69e3e0440c 100644 (file)
@@ -119,9 +119,9 @@ static int __init pdm360ng_probe(void)
 define_machine(pdm360ng) {
        .name                   = "PDM360NG",
        .probe                  = pdm360ng_probe,
-       .setup_arch             = mpc512x_setup_diu,
+       .setup_arch             = mpc512x_setup_arch,
        .init                   = pdm360ng_init,
-       .init_early             = mpc512x_init_diu,
+       .init_early             = mpc512x_init_early,
        .init_IRQ               = mpc512x_init_IRQ,
        .get_irq                = ipic_get_irq,
        .calibrate_decr         = generic_calibrate_decr,