From: 黄涛 Date: Mon, 30 Aug 2010 07:20:41 +0000 (+0800) Subject: clock: set arm_clk rate to 576MHz early X-Git-Tag: firefly_0821_release~11214 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9cf2322b967610340cbd8b309c496f1ca6d08b41;p=firefly-linux-kernel-4.4.55.git clock: set arm_clk rate to 576MHz early --- diff --git a/arch/arm/mach-rk2818/clock.c b/arch/arm/mach-rk2818/clock.c index e55c3e5b03d6..052590f69f93 100644 --- a/arch/arm/mach-rk2818/clock.c +++ b/arch/arm/mach-rk2818/clock.c @@ -1601,13 +1601,12 @@ static void clk_enable_init_clocks(void) } } -static unsigned int __initdata armclk; +static unsigned int __initdata armclk = 576000000; /* - * By default we use the rate set by the bootloader. - * You can override this with armclk= cmdline option. + * You can override arm_clk rate with armclk= cmdline option. */ -static int __init clk_setup(char *str) +static int __init armclk_setup(char *str) { get_option(&str, &armclk); @@ -1619,7 +1618,9 @@ static int __init clk_setup(char *str) return 1; } -__setup("armclk=", clk_setup); +__setup("armclk=", armclk_setup); + +extern void rk2818_timer_update_mult(void); /* * Switch the arm_clk rate if specified on cmdline. @@ -1638,6 +1639,8 @@ static int __init rk2818_clk_arch_init(void) arm_pll_clk.rate / 1000000, arm_clk.rate / 1000000, arm_hclk.rate / 1000000, arm_pclk.rate / 1000000); + /* cpufreq is not active now, so change timer_mult and loops_per_jiffy manually */ + rk2818_timer_update_mult(); calibrate_delay(); printk(KERN_INFO "%lu.%02lu BogoMIPS (lpj=%lu)\n", loops_per_jiffy/(500000/HZ), (loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy); diff --git a/arch/arm/mach-rk2818/include/mach/timex.h b/arch/arm/mach-rk2818/include/mach/timex.h index c54088022102..b6027f0682de 100644 --- a/arch/arm/mach-rk2818/include/mach/timex.h +++ b/arch/arm/mach-rk2818/include/mach/timex.h @@ -16,6 +16,6 @@ #ifndef __ASM_ARCH_RK2818_TIMEX_H #define __ASM_ARCH_RK2818_TIMEX_H -#define CLOCK_TICK_RATE 50000000 +#define CLOCK_TICK_RATE 1000000 #endif diff --git a/arch/arm/mach-rk2818/timer.c b/arch/arm/mach-rk2818/timer.c index c54db294b2ad..4664a12409bd 100644 --- a/arch/arm/mach-rk2818/timer.c +++ b/arch/arm/mach-rk2818/timer.c @@ -58,6 +58,12 @@ static struct clk *timer_clk; static volatile unsigned long timer_mult; /* timer count = cycle * timer_mult */ +void rk2818_timer_update_mult(void) +{ + if (timer_clk) + timer_mult = clk_get_rate(timer_clk) / 1000000; +} + static int rk2818_timer_set_next_event(unsigned long cycles, struct clock_event_device *evt) { RK_TIMER_DISABLE(TIMER_CLKEVT); @@ -113,7 +119,7 @@ static struct irqaction rk2818_timer_clockevent_irq = { static int rk2818_timer_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data) { if (val == CPUFREQ_POSTCHANGE) { - timer_mult = clk_get_rate(timer_clk) / 1000000; + rk2818_timer_update_mult(); } return 0; @@ -137,7 +143,7 @@ static __init int rk2818_timer_init_clockevent(void) struct clock_event_device *ce = &rk2818_timer_clockevent; timer_clk = clk_get(NULL, "timer"); - timer_mult = clk_get_rate(timer_clk) / 1000000; + rk2818_timer_update_mult(); RK_TIMER_DISABLE(TIMER_CLKEVT);