mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-07-12 06:06:15 +09:00
85xx: Speed up get_ddr_freq() and get_bus_freq()
get_ddr_freq() and get_bus_freq() used get_sys_info() each time they were called. However, get_sys_info() recalculates extraneous information when called each time. Have get_ddr_freq() and get_bus_freq() return memoized values from global_data instead. Signed-off-by: James Yang <James.Yang@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
This commit is contained in:
parent
e9ea679918
commit
a3e77fa535
|
@ -48,6 +48,8 @@ void get_sys_info (sys_info_t * sysInfo)
|
||||||
* overflow for processor speeds above 2GHz */
|
* overflow for processor speeds above 2GHz */
|
||||||
half_freqSystemBus = sysInfo->freqSystemBus/2;
|
half_freqSystemBus = sysInfo->freqSystemBus/2;
|
||||||
sysInfo->freqProcessor = e500_ratio*half_freqSystemBus;
|
sysInfo->freqProcessor = e500_ratio*half_freqSystemBus;
|
||||||
|
|
||||||
|
/* Note: freqDDRBus is the MCLK frequency, not the data rate. */
|
||||||
sysInfo->freqDDRBus = sysInfo->freqSystemBus;
|
sysInfo->freqDDRBus = sysInfo->freqSystemBus;
|
||||||
|
|
||||||
#ifdef CONFIG_DDR_CLK_FREQ
|
#ifdef CONFIG_DDR_CLK_FREQ
|
||||||
|
@ -75,6 +77,7 @@ int get_clocks (void)
|
||||||
get_sys_info (&sys_info);
|
get_sys_info (&sys_info);
|
||||||
gd->cpu_clk = sys_info.freqProcessor;
|
gd->cpu_clk = sys_info.freqProcessor;
|
||||||
gd->bus_clk = sys_info.freqSystemBus;
|
gd->bus_clk = sys_info.freqSystemBus;
|
||||||
|
gd->mem_clk = sys_info.freqDDRBus;
|
||||||
gd->i2c1_clk = sys_info.freqSystemBus;
|
gd->i2c1_clk = sys_info.freqSystemBus;
|
||||||
gd->i2c2_clk = sys_info.freqSystemBus;
|
gd->i2c2_clk = sys_info.freqSystemBus;
|
||||||
|
|
||||||
|
@ -96,14 +99,7 @@ int get_clocks (void)
|
||||||
*********************************************/
|
*********************************************/
|
||||||
ulong get_bus_freq (ulong dummy)
|
ulong get_bus_freq (ulong dummy)
|
||||||
{
|
{
|
||||||
ulong val;
|
return gd->bus_clk;
|
||||||
|
|
||||||
sys_info_t sys_info;
|
|
||||||
|
|
||||||
get_sys_info (&sys_info);
|
|
||||||
val = sys_info.freqSystemBus;
|
|
||||||
|
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************
|
/********************************************
|
||||||
|
@ -112,12 +108,5 @@ ulong get_bus_freq (ulong dummy)
|
||||||
*********************************************/
|
*********************************************/
|
||||||
ulong get_ddr_freq (ulong dummy)
|
ulong get_ddr_freq (ulong dummy)
|
||||||
{
|
{
|
||||||
ulong val;
|
return gd->mem_clk;
|
||||||
|
|
||||||
sys_info_t sys_info;
|
|
||||||
|
|
||||||
get_sys_info (&sys_info);
|
|
||||||
val = sys_info.freqDDRBus;
|
|
||||||
|
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,7 @@ typedef struct global_data {
|
||||||
unsigned long scc_clk;
|
unsigned long scc_clk;
|
||||||
unsigned long brg_clk;
|
unsigned long brg_clk;
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_MPC7448HPC2)
|
|
||||||
unsigned long mem_clk;
|
unsigned long mem_clk;
|
||||||
#endif
|
|
||||||
#if defined(CONFIG_MPC83XX)
|
#if defined(CONFIG_MPC83XX)
|
||||||
/* There are other clocks in the MPC83XX */
|
/* There are other clocks in the MPC83XX */
|
||||||
u32 csb_clk;
|
u32 csb_clk;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user