Commit c7cff54d authored by Zhiwu Song's avatar Zhiwu Song Committed by Barry Song

clocksource:sirf: remove the hardcode for the clk of timers

Nobody want to know the connection between io clk and timer clk,
so exposing this information to timer module is not reasonable.
this patch moves to define the timers' clk in dt.
Signed-off-by: default avatarZhiwu Song <Zhiwu.Song@csr.com>
Signed-off-by: default avatarBarry Song <Baohua.Song@csr.com>
parent 7caf6852
...@@ -195,6 +195,7 @@ timer@b0020000 { ...@@ -195,6 +195,7 @@ timer@b0020000 {
compatible = "sirf,prima2-tick"; compatible = "sirf,prima2-tick";
reg = <0xb0020000 0x1000>; reg = <0xb0020000 0x1000>;
interrupts = <0>; interrupts = <0>;
clocks = <&clks 11>;
}; };
nand@b0030000 { nand@b0030000 {
......
...@@ -201,6 +201,7 @@ timer@b0020000 { ...@@ -201,6 +201,7 @@ timer@b0020000 {
compatible = "sirf,prima2-tick"; compatible = "sirf,prima2-tick";
reg = <0xb0020000 0x1000>; reg = <0xb0020000 0x1000>;
interrupts = <0>; interrupts = <0>;
clocks = <&clks 11>;
}; };
nand@b0030000 { nand@b0030000 {
......
...@@ -252,15 +252,13 @@ static void __init sirfsoc_clockevent_init(void) ...@@ -252,15 +252,13 @@ static void __init sirfsoc_clockevent_init(void)
} }
/* initialize the kernel jiffy timer source */ /* initialize the kernel jiffy timer source */
static void __init sirfsoc_marco_timer_init(void) static void __init sirfsoc_marco_timer_init(struct device_node *np)
{ {
unsigned long rate; unsigned long rate;
u32 timer_div; u32 timer_div;
struct clk *clk; struct clk *clk;
/* timer's input clock is io clock */ clk = of_clk_get(np, 0);
clk = clk_get_sys("io", NULL);
BUG_ON(IS_ERR(clk)); BUG_ON(IS_ERR(clk));
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
...@@ -303,6 +301,6 @@ static void __init sirfsoc_of_timer_init(struct device_node *np) ...@@ -303,6 +301,6 @@ static void __init sirfsoc_of_timer_init(struct device_node *np)
if (!sirfsoc_timer1_irq.irq) if (!sirfsoc_timer1_irq.irq)
panic("No irq passed for timer1 via DT\n"); panic("No irq passed for timer1 via DT\n");
sirfsoc_marco_timer_init(); sirfsoc_marco_timer_init(np);
} }
CLOCKSOURCE_OF_DECLARE(sirfsoc_marco_timer, "sirf,marco-tick", sirfsoc_of_timer_init ); CLOCKSOURCE_OF_DECLARE(sirfsoc_marco_timer, "sirf,marco-tick", sirfsoc_of_timer_init );
...@@ -198,11 +198,8 @@ static void __init sirfsoc_prima2_timer_init(struct device_node *np) ...@@ -198,11 +198,8 @@ static void __init sirfsoc_prima2_timer_init(struct device_node *np)
unsigned long rate; unsigned long rate;
struct clk *clk; struct clk *clk;
/* timer's input clock is io clock */ clk = of_clk_get(np, 0);
clk = clk_get_sys("io", NULL);
BUG_ON(IS_ERR(clk)); BUG_ON(IS_ERR(clk));
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
BUG_ON(rate < PRIMA2_CLOCK_FREQ); BUG_ON(rate < PRIMA2_CLOCK_FREQ);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment