Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mpc512x: move common code to shared.c file

- 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>

authored by

Gerhard Sittig and committed by
Anatolij Gustschin
2abbbb63 c7788792

+21 -19
-1
arch/powerpc/include/asm/mpc5121.h
··· 68 68 }; 69 69 70 70 int mpc512x_cs_config(unsigned int cs, u32 val); 71 - int __init mpc5121_clk_init(void); 72 71 73 72 #endif /* __ASM_POWERPC_MPC5121_H__ */
+2 -4
arch/powerpc/platforms/512x/mpc5121_ads.c
··· 43 43 mpc83xx_add_bridge(np); 44 44 #endif 45 45 46 - #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 47 - mpc512x_setup_diu(); 48 - #endif 46 + mpc512x_setup_arch(); 49 47 } 50 48 51 49 static void __init mpc5121_ads_init_IRQ(void) ··· 67 69 .probe = mpc5121_ads_probe, 68 70 .setup_arch = mpc5121_ads_setup_arch, 69 71 .init = mpc512x_init, 70 - .init_early = mpc512x_init_diu, 72 + .init_early = mpc512x_init_early, 71 73 .init_IRQ = mpc5121_ads_init_IRQ, 72 74 .get_irq = ipic_get_irq, 73 75 .calibrate_decr = generic_calibrate_decr,
+2 -9
arch/powerpc/platforms/512x/mpc512x.h
··· 12 12 #ifndef __MPC512X_H__ 13 13 #define __MPC512X_H__ 14 14 extern void __init mpc512x_init_IRQ(void); 15 + extern void __init mpc512x_init_early(void); 15 16 extern void __init mpc512x_init(void); 17 + extern void __init mpc512x_setup_arch(void); 16 18 extern int __init mpc5121_clk_init(void); 17 - void __init mpc512x_declare_of_platform_devices(void); 18 19 extern const char *mpc512x_select_psc_compat(void); 19 20 extern void mpc512x_restart(char *cmd); 20 - 21 - #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 22 - void mpc512x_init_diu(void); 23 - void mpc512x_setup_diu(void); 24 - #else 25 - #define mpc512x_init_diu NULL 26 - #define mpc512x_setup_diu NULL 27 - #endif 28 21 29 22 #endif /* __MPC512X_H__ */
+2 -2
arch/powerpc/platforms/512x/mpc512x_generic.c
··· 45 45 .name = "MPC512x generic", 46 46 .probe = mpc512x_generic_probe, 47 47 .init = mpc512x_init, 48 - .init_early = mpc512x_init_diu, 49 - .setup_arch = mpc512x_setup_diu, 48 + .init_early = mpc512x_init_early, 49 + .setup_arch = mpc512x_setup_arch, 50 50 .init_IRQ = mpc512x_init_IRQ, 51 51 .get_irq = ipic_get_irq, 52 52 .calibrate_decr = generic_calibrate_decr,
+13 -1
arch/powerpc/platforms/512x/mpc512x_shared.c
··· 58 58 ; 59 59 } 60 60 61 - #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 61 + #if IS_ENABLED(CONFIG_FB_FSL_DIU) 62 62 63 63 struct fsl_diu_shared_fb { 64 64 u8 gamma[0x300]; /* 32-bit aligned! */ ··· 436 436 } 437 437 } 438 438 439 + void __init mpc512x_init_early(void) 440 + { 441 + if (IS_ENABLED(CONFIG_FB_FSL_DIU)) 442 + mpc512x_init_diu(); 443 + } 444 + 439 445 void __init mpc512x_init(void) 440 446 { 441 447 mpc5121_clk_init(); 442 448 mpc512x_declare_of_platform_devices(); 443 449 mpc512x_restart_init(); 444 450 mpc512x_psc_fifo_init(); 451 + } 452 + 453 + void __init mpc512x_setup_arch(void) 454 + { 455 + if (IS_ENABLED(CONFIG_FB_FSL_DIU)) 456 + mpc512x_setup_diu(); 445 457 } 446 458 447 459 /**
+2 -2
arch/powerpc/platforms/512x/pdm360ng.c
··· 119 119 define_machine(pdm360ng) { 120 120 .name = "PDM360NG", 121 121 .probe = pdm360ng_probe, 122 - .setup_arch = mpc512x_setup_diu, 122 + .setup_arch = mpc512x_setup_arch, 123 123 .init = pdm360ng_init, 124 - .init_early = mpc512x_init_diu, 124 + .init_early = mpc512x_init_early, 125 125 .init_IRQ = mpc512x_init_IRQ, 126 126 .get_irq = ipic_get_irq, 127 127 .calibrate_decr = generic_calibrate_decr,