Merge tag 'sunxi-dt64-for-4.14-2' of https://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6/btrfs-unstable.git] / arch / arm / mach-mediatek / mediatek.c
blobc3cf215773b2de6228abbd27cc89ca234512f7f8
1 /*
2 * Device Tree support for Mediatek SoCs
4 * Copyright (c) 2014 MundoReader S.L.
5 * Author: Matthias Brugger <matthias.bgg@gmail.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 #include <linux/init.h>
18 #include <asm/mach/arch.h>
19 #include <linux/of.h>
20 #include <linux/clk-provider.h>
21 #include <linux/clocksource.h>
24 #define GPT6_CON_MT65xx 0x10008060
25 #define GPT_ENABLE 0x31
27 static void __init mediatek_timer_init(void)
29 void __iomem *gpt_base;
31 if (of_machine_is_compatible("mediatek,mt6589") ||
32 of_machine_is_compatible("mediatek,mt7623") ||
33 of_machine_is_compatible("mediatek,mt8135") ||
34 of_machine_is_compatible("mediatek,mt8127")) {
35 /* turn on GPT6 which ungates arch timer clocks */
36 gpt_base = ioremap(GPT6_CON_MT65xx, 0x04);
38 /* enable clock and set to free-run */
39 writel(GPT_ENABLE, gpt_base);
40 iounmap(gpt_base);
43 of_clk_init(NULL);
44 timer_probe();
47 static const char * const mediatek_board_dt_compat[] = {
48 "mediatek,mt2701",
49 "mediatek,mt6589",
50 "mediatek,mt6592",
51 "mediatek,mt7623",
52 "mediatek,mt8127",
53 "mediatek,mt8135",
54 NULL,
57 DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
58 .dt_compat = mediatek_board_dt_compat,
59 .init_time = mediatek_timer_init,
60 MACHINE_END