1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Device Tree support for Mediatek SoCs
5 * Copyright (c) 2014 MundoReader S.L.
6 * Author: Matthias Brugger <matthias.bgg@gmail.com>
8 #include <linux/init.h>
10 #include <asm/mach/arch.h>
12 #include <linux/of_clk.h>
13 #include <linux/clocksource.h>
16 #define GPT6_CON_MT65xx 0x10008060
17 #define GPT_ENABLE 0x31
19 static void __init
mediatek_timer_init(void)
21 void __iomem
*gpt_base
;
23 if (of_machine_is_compatible("mediatek,mt6589") ||
24 of_machine_is_compatible("mediatek,mt7623") ||
25 of_machine_is_compatible("mediatek,mt8135") ||
26 of_machine_is_compatible("mediatek,mt8127")) {
27 /* turn on GPT6 which ungates arch timer clocks */
28 gpt_base
= ioremap(GPT6_CON_MT65xx
, 0x04);
30 /* enable clock and set to free-run */
31 writel(GPT_ENABLE
, gpt_base
);
39 static const char * const mediatek_board_dt_compat
[] = {
50 DT_MACHINE_START(MEDIATEK_DT
, "Mediatek Cortex-A7 (Device Tree)")
51 .dt_compat
= mediatek_board_dt_compat
,
52 .init_time
= mediatek_timer_init
,