Skip to content

Commit

Permalink
powerpc/mpc512x: move common code to shared.c file
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Gerhard Sittig authored and Anatolij Gustschin committed May 21, 2013
1 parent c778879 commit 2abbbb6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
1 change: 0 additions & 1 deletion arch/powerpc/include/asm/mpc5121.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
6 changes: 2 additions & 4 deletions arch/powerpc/platforms/512x/mpc5121_ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down
11 changes: 2 additions & 9 deletions arch/powerpc/platforms/512x/mpc512x.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,11 @@
#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__ */
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/512x/mpc512x_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 13 additions & 1 deletion arch/powerpc/platforms/512x/mpc512x_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -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! */
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/512x/pdm360ng.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2abbbb6

Please sign in to comment.