clock: set arm_clk rate to 576MHz early
author黄涛 <huangtao@rock-chips.com>
Mon, 30 Aug 2010 07:20:41 +0000 (15:20 +0800)
committer黄涛 <huangtao@rock-chips.com>
Mon, 30 Aug 2010 07:20:41 +0000 (15:20 +0800)
arch/arm/mach-rk2818/clock.c
arch/arm/mach-rk2818/include/mach/timex.h
arch/arm/mach-rk2818/timer.c

index e55c3e5b03d6c2a5aa1e8222ab17dde161784b1b..052590f69f93b8df57ea6463a6f72b15f822036c 100644 (file)
@@ -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);
 
index c5408802210261aca96b3d3281a2c5e0a14baf4d..b6027f0682de320499dc202860b1e0c06e7f22c1 100644 (file)
@@ -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
index c54db294b2adfd4ca029d502e31f1f0b0b012eec..4664a12409bd7e2b40d75bda91ff95eb9dc07cda 100644 (file)
 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);