1 From eec99287ace37015ed313b4fc27ba205a158b66c Mon Sep 17 00:00:00 2001
2 From: Matthias Brugger <matthias.bgg@gmail.com>
3 Date: Fri, 1 May 2015 15:43:26 +0800
4 Subject: [PATCH 41/76] arm: mediatek: enable gpt6 on boot up to make arch
7 We enable GTP6 which ungates the arch timer clock.
8 In the future this should be done in the bootloader.
10 Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
11 Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
13 arch/arm/mach-mediatek/mediatek.c | 29 +++++++++++++++++++++++++++++
14 1 file changed, 29 insertions(+)
16 --- a/arch/arm/mach-mediatek/mediatek.c
17 +++ b/arch/arm/mach-mediatek/mediatek.c
20 #include <linux/init.h>
21 #include <asm/mach/arch.h>
22 +#include <linux/of.h>
23 +#include <linux/clk-provider.h>
24 +#include <linux/clocksource.h>
27 +#define GPT6_CON_MT65xx 0x10008060
28 +#define GPT_ENABLE 0x31
30 +static void __init mediatek_timer_init(void)
32 + void __iomem *gpt_base = 0;
34 + if (of_machine_is_compatible("mediatek,mt6589") ||
35 + of_machine_is_compatible("mediatek,mt8135") ||
36 + of_machine_is_compatible("mediatek,mt8127")) {
37 + /* turn on GPT6 which ungates arch timer clocks */
38 + gpt_base = ioremap(GPT6_CON_MT65xx, 0x04);
41 + /* enabel clock and set to free-run */
43 + writel(GPT_ENABLE, gpt_base);
48 + clocksource_of_init();
51 static const char * const mediatek_board_dt_compat[] = {
53 @@ -27,4 +55,5 @@ static const char * const mediatek_board
55 DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
56 .dt_compat = mediatek_board_dt_compat,
57 + .init_time = mediatek_timer_init,