clocksource: convert time-armada-370-xp to clk framework
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Tested-by Gregory CLEMENT <gregory.clement@free-electrons.com>
This commit is contained in:
Родитель
9d2027830c
Коммит
307c2bf467
|
@ -5,6 +5,7 @@ Required properties:
|
||||||
- compatible: Should be "marvell,armada-370-xp-timer"
|
- compatible: Should be "marvell,armada-370-xp-timer"
|
||||||
- interrupts: Should contain the list of Global Timer interrupts
|
- interrupts: Should contain the list of Global Timer interrupts
|
||||||
- reg: Should contain the base address of the Global Timer registers
|
- reg: Should contain the base address of the Global Timer registers
|
||||||
|
- clocks: clock driving the timer hardware
|
||||||
|
|
||||||
Optional properties:
|
Optional properties:
|
||||||
- marvell,timer-25Mhz: Tells whether the Global timer supports the 25
|
- marvell,timer-25Mhz: Tells whether the Global timer supports the 25
|
||||||
|
|
|
@ -34,9 +34,5 @@
|
||||||
clock-frequency = <200000000>;
|
clock-frequency = <200000000>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
timer@d0020300 {
|
|
||||||
clock-frequency = <600000000>;
|
|
||||||
status = "okay";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
compatible = "marvell,armada-370-xp-timer";
|
compatible = "marvell,armada-370-xp-timer";
|
||||||
reg = <0xd0020300 0x30>;
|
reg = <0xd0020300 0x30>;
|
||||||
interrupts = <37>, <38>, <39>, <40>;
|
interrupts = <37>, <38>, <39>, <40>;
|
||||||
|
clocks = <&coreclk 2>;
|
||||||
};
|
};
|
||||||
|
|
||||||
addr-decoding@d0020000 {
|
addr-decoding@d0020000 {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/clk.h>
|
||||||
#include <linux/timer.h>
|
#include <linux/timer.h>
|
||||||
#include <linux/clockchips.h>
|
#include <linux/clockchips.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
@ -167,7 +168,6 @@ void __init armada_370_xp_timer_init(void)
|
||||||
u32 u;
|
u32 u;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
unsigned int timer_clk;
|
unsigned int timer_clk;
|
||||||
int ret;
|
|
||||||
np = of_find_compatible_node(NULL, NULL, "marvell,armada-370-xp-timer");
|
np = of_find_compatible_node(NULL, NULL, "marvell,armada-370-xp-timer");
|
||||||
timer_base = of_iomap(np, 0);
|
timer_base = of_iomap(np, 0);
|
||||||
WARN_ON(!timer_base);
|
WARN_ON(!timer_base);
|
||||||
|
@ -179,13 +179,14 @@ void __init armada_370_xp_timer_init(void)
|
||||||
timer_base + TIMER_CTRL_OFF);
|
timer_base + TIMER_CTRL_OFF);
|
||||||
timer_clk = 25000000;
|
timer_clk = 25000000;
|
||||||
} else {
|
} else {
|
||||||
u32 clk = 0;
|
unsigned long rate = 0;
|
||||||
ret = of_property_read_u32(np, "clock-frequency", &clk);
|
struct clk *clk = of_clk_get(np, 0);
|
||||||
WARN_ON(!clk || ret < 0);
|
WARN_ON(IS_ERR(clk));
|
||||||
|
rate = clk_get_rate(clk);
|
||||||
u = readl(timer_base + TIMER_CTRL_OFF);
|
u = readl(timer_base + TIMER_CTRL_OFF);
|
||||||
writel(u & ~(TIMER0_25MHZ | TIMER1_25MHZ),
|
writel(u & ~(TIMER0_25MHZ | TIMER1_25MHZ),
|
||||||
timer_base + TIMER_CTRL_OFF);
|
timer_base + TIMER_CTRL_OFF);
|
||||||
timer_clk = clk / TIMER_DIVIDER;
|
timer_clk = rate / TIMER_DIVIDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We use timer 0 as clocksource, and timer 1 for
|
/* We use timer 0 as clocksource, and timer 1 for
|
||||||
|
|
Загрузка…
Ссылка в новой задаче