@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR;
/* --------------------------------------------------------------- */
void get_sys_info ( sys_info_t * sysI nfo )
void get_sys_info ( sys_info_t * sys_i nfo)
{
volatile ccsr_gur_t * gur = ( void * ) ( CONFIG_SYS_MPC85xx_GUTS_ADDR ) ;
# ifdef CONFIG_FSL_IFC
@ -46,7 +46,7 @@ void get_sys_info (sys_info_t * sysInfo)
[ 14 ] = 3 , /* CC4 PPL / 4 */
} ;
const u8 core_cplx_PLL _div [ 16 ] = {
const u8 core_cplx_pll _div [ 16 ] = {
[ 0 ] = 1 , /* CC1 PPL / 1 */
[ 1 ] = 2 , /* CC1 PPL / 2 */
[ 2 ] = 4 , /* CC1 PPL / 4 */
@ -60,26 +60,26 @@ void get_sys_info (sys_info_t * sysInfo)
[ 13 ] = 2 , /* CC4 PPL / 2 */
[ 14 ] = 4 , /* CC4 PPL / 4 */
} ;
uint i , freqCC_PLL [ 6 ] , rcw_tmp ;
uint i , freq_cc_pll [ 6 ] , rcw_tmp ;
uint ratio [ 6 ] ;
unsigned long sysclk = CONFIG_SYS_CLK_FREQ ;
uint mem_pll_rat ;
sysInfo - > freqSystemB us = sysclk ;
sys_info - > freq_systemb us = sysclk ;
# ifdef CONFIG_DDR_CLK_FREQ
sysInfo - > freqDDRB us = CONFIG_DDR_CLK_FREQ ;
sys_info - > freq_ddrb us = CONFIG_DDR_CLK_FREQ ;
# else
sysInfo - > freqDDRB us = sysclk ;
sys_info - > freq_ddrb us = sysclk ;
# endif
sysInfo - > freqSystemB us * = ( in_be32 ( & gur - > rcwsr [ 0 ] ) > > 25 ) & 0x1f ;
sys_info - > freq_systemb us * = ( in_be32 ( & gur - > rcwsr [ 0 ] ) > > 25 ) & 0x1f ;
mem_pll_rat = ( in_be32 ( & gur - > rcwsr [ 0 ] ) > >
FSL_CORENET_RCWSR0_MEM_PLL_RAT_SHIFT )
& FSL_CORENET_RCWSR0_MEM_PLL_RAT_MASK ;
if ( mem_pll_rat > 2 )
sysInfo - > freqDDRB us * = mem_pll_rat ;
sys_info - > freq_ddrb us * = mem_pll_rat ;
else
sysInfo - > freqDDRBus = sysInfo - > freqSystemB us * mem_pll_rat ;
sys_info - > freq_ddrbus = sys_info - > freq_systemb us * mem_pll_rat ;
ratio [ 0 ] = ( in_be32 ( & clk - > pllc1gsr ) > > 1 ) & 0x3f ;
ratio [ 1 ] = ( in_be32 ( & clk - > pllc2gsr ) > > 1 ) & 0x3f ;
@ -89,9 +89,9 @@ void get_sys_info (sys_info_t * sysInfo)
ratio [ 5 ] = ( in_be32 ( & clk - > pllc6gsr ) > > 1 ) & 0x3f ;
for ( i = 0 ; i < 6 ; i + + ) {
if ( ratio [ i ] > 4 )
freqCC_PLL [ i ] = sysclk * ratio [ i ] ;
freq_cc_pll [ i ] = sysclk * ratio [ i ] ;
else
freqCC_PLL [ i ] = sysInfo - > freqSystemB us * ratio [ i ] ;
freq_cc_pll [ i ] = sys_info - > freq_systemb us * ratio [ i ] ;
}
# ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2
/*
@ -110,8 +110,8 @@ void get_sys_info (sys_info_t * sysInfo)
printf ( " Unsupported architecture configuration "
" in function %s \n " , __func__ ) ;
cplx_pll + = ( cluster / 2 ) * 3 ;
sysInfo - > freqP rocessor [ cpu ] =
freqCC_PLL [ cplx_pll ] / core_cplx_PLL _div [ c_pll_sel ] ;
sys_info - > freq_p rocessor [ cpu ] =
freq_cc_pll [ cplx_pll ] / core_cplx_pll _div [ c_pll_sel ] ;
}
# ifdef CONFIG_PPC_B4860
# define FM1_CLK_SEL 0xe0000000
@ -127,63 +127,63 @@ void get_sys_info (sys_info_t * sysInfo)
# ifdef CONFIG_SYS_DPAA_PME
switch ( ( rcw_tmp & PME_CLK_SEL ) > > PME_CLK_SHIFT ) {
case 1 :
sysInfo - > freqPME = freqCC_PLL [ 0 ] ;
sys_info - > freq_pme = freq_cc_pll [ 0 ] ;
break ;
case 2 :
sysInfo - > freqPME = freqCC_PLL [ 0 ] / 2 ;
sys_info - > freq_pme = freq_cc_pll [ 0 ] / 2 ;
break ;
case 3 :
sysInfo - > freqPME = freqCC_PLL [ 0 ] / 3 ;
sys_info - > freq_pme = freq_cc_pll [ 0 ] / 3 ;
break ;
case 4 :
sysInfo - > freqPME = freqCC_PLL [ 0 ] / 4 ;
sys_info - > freq_pme = freq_cc_pll [ 0 ] / 4 ;
break ;
case 6 :
sysInfo - > freqPME = freqCC_PLL [ 1 ] / 2 ;
sys_info - > freq_pme = freq_cc_pll [ 1 ] / 2 ;
break ;
case 7 :
sysInfo - > freqPME = freqCC_PLL [ 1 ] / 3 ;
sys_info - > freq_pme = freq_cc_pll [ 1 ] / 3 ;
break ;
default :
printf ( " Error: Unknown PME clock select! \n " ) ;
case 0 :
sysInfo - > freqPME = sysInfo - > freqSystemB us / 2 ;
sys_info - > freq_pme = sys_info - > freq_systemb us / 2 ;
break ;
}
# endif
# ifdef CONFIG_SYS_DPAA_QBMAN
sysInfo - > freqQMAN = sysInfo - > freqSystemB us / 2 ;
sys_info - > freq_qman = sys_info - > freq_systemb us / 2 ;
# endif
# ifdef CONFIG_SYS_DPAA_FMAN
switch ( ( rcw_tmp & FM1_CLK_SEL ) > > FM1_CLK_SHIFT ) {
case 1 :
sysInfo - > freqFM an [ 0 ] = freqCC_PLL [ 3 ] ;
sys_info - > freq_fm an [ 0 ] = freq_cc_pll [ 3 ] ;
break ;
case 2 :
sysInfo - > freqFM an [ 0 ] = freqCC_PLL [ 3 ] / 2 ;
sys_info - > freq_fm an [ 0 ] = freq_cc_pll [ 3 ] / 2 ;
break ;
case 3 :
sysInfo - > freqFM an [ 0 ] = freqCC_PLL [ 3 ] / 3 ;
sys_info - > freq_fm an [ 0 ] = freq_cc_pll [ 3 ] / 3 ;
break ;
case 4 :
sysInfo - > freqFM an [ 0 ] = freqCC_PLL [ 3 ] / 4 ;
sys_info - > freq_fm an [ 0 ] = freq_cc_pll [ 3 ] / 4 ;
break ;
case 5 :
sysInfo - > freqFM an [ 0 ] = sysInfo - > freqSystemB us ;
sys_info - > freq_fm an [ 0 ] = sys_info - > freq_systemb us ;
break ;
case 6 :
sysInfo - > freqFM an [ 0 ] = freqCC_PLL [ 4 ] / 2 ;
sys_info - > freq_fm an [ 0 ] = freq_cc_pll [ 4 ] / 2 ;
break ;
case 7 :
sysInfo - > freqFM an [ 0 ] = freqCC_PLL [ 4 ] / 3 ;
sys_info - > freq_fm an [ 0 ] = freq_cc_pll [ 4 ] / 3 ;
break ;
default :
printf ( " Error: Unknown FMan1 clock select! \n " ) ;
case 0 :
sysInfo - > freqFM an [ 0 ] = sysInfo - > freqSystemB us / 2 ;
sys_info - > freq_fm an [ 0 ] = sys_info - > freq_systemb us / 2 ;
break ;
}
# if (CONFIG_SYS_NUM_FMAN) == 2
@ -192,27 +192,27 @@ void get_sys_info (sys_info_t * sysInfo)
rcw_tmp = in_be32 ( & gur - > rcwsr [ 15 ] ) ;
switch ( ( rcw_tmp & FM2_CLK_SEL ) > > FM2_CLK_SHIFT ) {
case 1 :
sysInfo - > freqFM an [ 1 ] = freqCC_PLL [ 4 ] ;
sys_info - > freq_fm an [ 1 ] = freq_cc_pll [ 4 ] ;
break ;
case 2 :
sysInfo - > freqFM an [ 1 ] = freqCC_PLL [ 4 ] / 2 ;
sys_info - > freq_fm an [ 1 ] = freq_cc_pll [ 4 ] / 2 ;
break ;
case 3 :
sysInfo - > freqFM an [ 1 ] = freqCC_PLL [ 4 ] / 3 ;
sys_info - > freq_fm an [ 1 ] = freq_cc_pll [ 4 ] / 3 ;
break ;
case 4 :
sysInfo - > freqFM an [ 1 ] = freqCC_PLL [ 4 ] / 4 ;
sys_info - > freq_fm an [ 1 ] = freq_cc_pll [ 4 ] / 4 ;
break ;
case 6 :
sysInfo - > freqFM an [ 1 ] = freqCC_PLL [ 3 ] / 2 ;
sys_info - > freq_fm an [ 1 ] = freq_cc_pll [ 3 ] / 2 ;
break ;
case 7 :
sysInfo - > freqFM an [ 1 ] = freqCC_PLL [ 3 ] / 3 ;
sys_info - > freq_fm an [ 1 ] = freq_cc_pll [ 3 ] / 3 ;
break ;
default :
printf ( " Error: Unknown FMan2 clock select! \n " ) ;
case 0 :
sysInfo - > freqFM an [ 1 ] = sysInfo - > freqSystemB us / 2 ;
sys_info - > freq_fm an [ 1 ] = sys_info - > freq_systemb us / 2 ;
break ;
}
# endif /* CONFIG_SYS_NUM_FMAN == 2 */
@ -225,8 +225,8 @@ void get_sys_info (sys_info_t * sysInfo)
& 0xf ;
u32 cplx_pll = core_cplx_PLL [ c_pll_sel ] ;
sysInfo - > freqP rocessor [ cpu ] =
freqCC_PLL [ cplx_pll ] / core_cplx_PLL _div [ c_pll_sel ] ;
sys_info - > freq_p rocessor [ cpu ] =
freq_cc_pll [ cplx_pll ] / core_cplx_pll _div [ c_pll_sel ] ;
}
# define PME_CLK_SEL 0x80000000
# define FM1_CLK_SEL 0x40000000
@ -246,43 +246,43 @@ void get_sys_info (sys_info_t * sysInfo)
# ifdef CONFIG_SYS_DPAA_PME
if ( rcw_tmp & PME_CLK_SEL ) {
if ( rcw_tmp & HWA_ASYNC_DIV )
sysInfo - > freqPME = freqCC_PLL [ HWA_CC_PLL ] / 4 ;
sys_info - > freq_pme = freq_cc_pll [ HWA_CC_PLL ] / 4 ;
else
sysInfo - > freqPME = freqCC_PLL [ HWA_CC_PLL ] / 2 ;
sys_info - > freq_pme = freq_cc_pll [ HWA_CC_PLL ] / 2 ;
} else {
sysInfo - > freqPME = sysInfo - > freqSystemB us / 2 ;
sys_info - > freq_pme = sys_info - > freq_systemb us / 2 ;
}
# endif
# ifdef CONFIG_SYS_DPAA_FMAN
if ( rcw_tmp & FM1_CLK_SEL ) {
if ( rcw_tmp & HWA_ASYNC_DIV )
sysInfo - > freqFM an [ 0 ] = freqCC_PLL [ HWA_CC_PLL ] / 4 ;
sys_info - > freq_fm an [ 0 ] = freq_cc_pll [ HWA_CC_PLL ] / 4 ;
else
sysInfo - > freqFM an [ 0 ] = freqCC_PLL [ HWA_CC_PLL ] / 2 ;
sys_info - > freq_fm an [ 0 ] = freq_cc_pll [ HWA_CC_PLL ] / 2 ;
} else {
sysInfo - > freqFM an [ 0 ] = sysInfo - > freqSystemB us / 2 ;
sys_info - > freq_fm an [ 0 ] = sys_info - > freq_systemb us / 2 ;
}
# if (CONFIG_SYS_NUM_FMAN) == 2
if ( rcw_tmp & FM2_CLK_SEL ) {
if ( rcw_tmp & HWA_ASYNC_DIV )
sysInfo - > freqFM an [ 1 ] = freqCC_PLL [ HWA_CC_PLL ] / 4 ;
sys_info - > freq_fm an [ 1 ] = freq_cc_pll [ HWA_CC_PLL ] / 4 ;
else
sysInfo - > freqFM an [ 1 ] = freqCC_PLL [ HWA_CC_PLL ] / 2 ;
sys_info - > freq_fm an [ 1 ] = freq_cc_pll [ HWA_CC_PLL ] / 2 ;
} else {
sysInfo - > freqFM an [ 1 ] = sysInfo - > freqSystemB us / 2 ;
sys_info - > freq_fm an [ 1 ] = sys_info - > freq_systemb us / 2 ;
}
# endif
# endif
# ifdef CONFIG_SYS_DPAA_QBMAN
sysInfo - > freqQMAN = sysInfo - > freqSystemB us / 2 ;
sys_info - > freq_qman = sys_info - > freq_systemb us / 2 ;
# endif
# endif /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */
# else /* CONFIG_FSL_CORENET */
uint plat_ratio , e500_ratio , half_freqSystemB us ;
uint plat_ratio , e500_ratio , half_freq_systemb us ;
int i ;
# ifdef CONFIG_QE
__maybe_unused u32 qe_ratio ;
@ -290,40 +290,40 @@ void get_sys_info (sys_info_t * sysInfo)
plat_ratio = ( gur - > porpllsr ) & 0x0000003e ;
plat_ratio > > = 1 ;
sysInfo - > freqSystemB us = plat_ratio * CONFIG_SYS_CLK_FREQ ;
sys_info - > freq_systemb us = plat_ratio * CONFIG_SYS_CLK_FREQ ;
/* Divide before multiply to avoid integer
* overflow for processor speeds above 2 GHz */
half_freqSystemBus = sysInfo - > freqSystemB us / 2 ;
half_freq_systembus = sys_info - > freq_systemb us / 2 ;
for ( i = 0 ; i < cpu_numcores ( ) ; i + + ) {
e500_ratio = ( ( gur - > porpllsr ) > > ( i * 8 + 16 ) ) & 0x3f ;
sysInfo - > freqP rocessor [ i ] = e500_ratio * half_freqSystemB us ;
sys_info - > freq_p rocessor [ i ] = e500_ratio * half_freq_systemb us ;
}
/* Note: freqDDRB us is the MCLK frequency, not the data rate. */
sysInfo - > freqDDRBus = sysInfo - > freqSystemB us ;
/* Note: freq_ddrb us is the MCLK frequency, not the data rate. */
sys_info - > freq_ddrbus = sys_info - > freq_systemb us ;
# ifdef CONFIG_DDR_CLK_FREQ
{
u32 ddr_ratio = ( ( gur - > porpllsr ) & MPC85xx_PORPLLSR_DDR_RATIO )
> > MPC85xx_PORPLLSR_DDR_RATIO_SHIFT ;
if ( ddr_ratio ! = 0x7 )
sysInfo - > freqDDRB us = ddr_ratio * CONFIG_DDR_CLK_FREQ ;
sys_info - > freq_ddrb us = ddr_ratio * CONFIG_DDR_CLK_FREQ ;
}
# endif
# ifdef CONFIG_QE
# if defined(CONFIG_P1012) || defined(CONFIG_P1021) || defined(CONFIG_P1025)
sysInfo - > freqQE = sysInfo - > freqSystemB us ;
sys_info - > freq_qe = sys_info - > freq_systemb us ;
# else
qe_ratio = ( ( gur - > porpllsr ) & MPC85xx_PORPLLSR_QE_RATIO )
> > MPC85xx_PORPLLSR_QE_RATIO_SHIFT ;
sysInfo - > freqQE = qe_ratio * CONFIG_SYS_CLK_FREQ ;
sys_info - > freq_qe = qe_ratio * CONFIG_SYS_CLK_FREQ ;
# endif
# endif
# ifdef CONFIG_SYS_DPAA_FMAN
sysInfo - > freqFM an [ 0 ] = sysInfo - > freqSystemB us ;
sys_info - > freq_fm an [ 0 ] = sys_info - > freq_systemb us ;
# endif
# endif /* CONFIG_FSL_CORENET */
@ -350,10 +350,10 @@ void get_sys_info (sys_info_t * sysInfo)
*/
lcrr_div * = 2 ;
# endif
sysInfo - > freqLocalBus = sysInfo - > freqSystemB us / lcrr_div ;
sys_info - > freq_localbus = sys_info - > freq_systemb us / lcrr_div ;
} else {
/* In case anyone cares what the unknown value is */
sysInfo - > freqLocalB us = lcrr_div ;
sys_info - > freq_localb us = lcrr_div ;
}
# endif
@ -361,7 +361,7 @@ void get_sys_info (sys_info_t * sysInfo)
ccr = in_be32 ( & ifc_regs - > ifc_ccr ) ;
ccr = ( ( ccr & IFC_CCR_CLK_DIV_MASK ) > > IFC_CCR_CLK_DIV_SHIFT ) + 1 ;
sysInfo - > freqLocalBus = sysInfo - > freqSystemB us / ccr ;
sys_info - > freq_localbus = sys_info - > freq_systemb us / ccr ;
# endif
}
@ -382,13 +382,13 @@ int get_clocks (void)
dfbrg = ( sccr & SCCR_DFBRG_MSK ) > > SCCR_DFBRG_SHIFT ;
# endif
get_sys_info ( & sys_info ) ;
gd - > cpu_clk = sys_info . freqP rocessor [ 0 ] ;
gd - > bus_clk = sys_info . freqSystemB us ;
gd - > mem_clk = sys_info . freqDDRB us ;
gd - > arch . lbc_clk = sys_info . freqLocalB us ;
gd - > cpu_clk = sys_info . freq_p rocessor [ 0 ] ;
gd - > bus_clk = sys_info . freq_systemb us ;
gd - > mem_clk = sys_info . freq_ddrb us ;
gd - > arch . lbc_clk = sys_info . freq_localb us ;
# ifdef CONFIG_QE
gd - > arch . qe_clk = sys_info . freqQE ;
gd - > arch . qe_clk = sys_info . freq_qe ;
gd - > arch . brg_clk = gd - > arch . qe_clk / 2 ;
# endif
/*
@ -400,7 +400,7 @@ int get_clocks (void)
*/
# if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
defined ( CONFIG_MPC8560 ) | | defined ( CONFIG_MPC8555 )
gd - > arch . i2c1_clk = sys_info . freqSystemB us ;
gd - > arch . i2c1_clk = sys_info . freq_systemb us ;
# elif defined(CONFIG_MPC8544)
/*
* On the 8544 , the I2C clock is the same as the SEC clock . This can be
@ -410,12 +410,12 @@ int get_clocks (void)
* PORDEVSR2_SEC_CFG bit is 0 on all 85 xx boards that are not an 8544.
*/
if ( gur - > pordevsr2 & MPC85xx_PORDEVSR2_SEC_CFG )
gd - > arch . i2c1_clk = sys_info . freqSystemB us / 3 ;
gd - > arch . i2c1_clk = sys_info . freq_systemb us / 3 ;
else
gd - > arch . i2c1_clk = sys_info . freqSystemB us / 2 ;
gd - > arch . i2c1_clk = sys_info . freq_systemb us / 2 ;
# else
/* Most 85xx SOCs use CCB/2, so this is the default behavior. */
gd - > arch . i2c1_clk = sys_info . freqSystemB us / 2 ;
gd - > arch . i2c1_clk = sys_info . freq_systemb us / 2 ;
# endif
gd - > arch . i2c2_clk = gd - > arch . i2c1_clk ;
@ -429,7 +429,7 @@ int get_clocks (void)
# endif /* defined(CONFIG_FSL_ESDHC) */
# if defined(CONFIG_CPM2)
gd - > arch . vco_out = 2 * sys_info . freqSystemB us ;
gd - > arch . vco_out = 2 * sys_info . freq_systemb us ;
gd - > arch . cpm_clk = gd - > arch . vco_out / 2 ;
gd - > arch . scc_clk = gd - > arch . vco_out / 4 ;
gd - > arch . brg_clk = gd - > arch . vco_out / ( 1 < < ( 2 * ( dfbrg + 1 ) ) ) ;