diff options
author | Matthias Brugger <matthias.bgg@gmail.com> | 2015-10-02 11:19:37 -0400 |
---|---|---|
committer | Matthias Brugger <matthias.bgg@gmail.com> | 2015-10-14 09:34:44 -0400 |
commit | 9821e545c5e02ac28af7c595ce71d037a1f74dc9 (patch) | |
tree | 987f838e8baaeb2ea808b630f87dde5ba9db481b | |
parent | 41b3e0f067c26dd17837aa49fba13fcb5c6319e1 (diff) |
ARM: mediatek: enable gpt6 on boot up to make arch timer working
We enable GTP6 which ungates the arch timer clock.
In the future this should be done in the bootloader.
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
-rw-r--r-- | arch/arm/mach-mediatek/mediatek.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c index a9549005097e..19dc738c1abc 100644 --- a/arch/arm/mach-mediatek/mediatek.c +++ b/arch/arm/mach-mediatek/mediatek.c | |||
@@ -16,6 +16,32 @@ | |||
16 | */ | 16 | */ |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
19 | #include <linux/of.h> | ||
20 | #include <linux/clk-provider.h> | ||
21 | #include <linux/clocksource.h> | ||
22 | |||
23 | |||
24 | #define GPT6_CON_MT65xx 0x10008060 | ||
25 | #define GPT_ENABLE 0x31 | ||
26 | |||
27 | static void __init mediatek_timer_init(void) | ||
28 | { | ||
29 | void __iomem *gpt_base; | ||
30 | |||
31 | if (of_machine_is_compatible("mediatek,mt6589") || | ||
32 | of_machine_is_compatible("mediatek,mt8135") || | ||
33 | of_machine_is_compatible("mediatek,mt8127")) { | ||
34 | /* turn on GPT6 which ungates arch timer clocks */ | ||
35 | gpt_base = ioremap(GPT6_CON_MT65xx, 0x04); | ||
36 | |||
37 | /* enable clock and set to free-run */ | ||
38 | writel(GPT_ENABLE, gpt_base); | ||
39 | iounmap(gpt_base); | ||
40 | } | ||
41 | |||
42 | of_clk_init(NULL); | ||
43 | clocksource_of_init(); | ||
44 | }; | ||
19 | 45 | ||
20 | static const char * const mediatek_board_dt_compat[] = { | 46 | static const char * const mediatek_board_dt_compat[] = { |
21 | "mediatek,mt6589", | 47 | "mediatek,mt6589", |
@@ -27,4 +53,5 @@ static const char * const mediatek_board_dt_compat[] = { | |||
27 | 53 | ||
28 | DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)") | 54 | DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)") |
29 | .dt_compat = mediatek_board_dt_compat, | 55 | .dt_compat = mediatek_board_dt_compat, |
56 | .init_time = mediatek_timer_init, | ||
30 | MACHINE_END | 57 | MACHINE_END |