2 * Device Tree support for Rockchip RK3036
4 * Copyright (C) 2014 ROCKCHIP, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <linux/clk-provider.h>
18 #include <linux/clocksource.h>
19 #include <linux/cpuidle.h>
20 #include <linux/delay.h>
21 #include <linux/init.h>
22 #include <linux/irqchip.h>
23 #include <linux/kernel.h>
24 #include <linux/of_address.h>
25 #include <linux/of_platform.h>
26 #include <linux/rockchip/common.h>
27 #include <linux/rockchip/cpu.h>
28 #include <linux/rockchip/cru.h>
29 #include <linux/rockchip/dvfs.h>
30 #include <linux/rockchip/grf.h>
31 #include <linux/rockchip/iomap.h>
32 #include <linux/rockchip/pmu.h>
33 #include <asm/cpuidle.h>
34 #include <asm/cputype.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
43 #define RK3036_DEVICE(name) \
45 .virtual = (unsigned long) RK_##name##_VIRT, \
46 .pfn = __phys_to_pfn(RK3036_##name##_PHYS), \
47 .length = RK3036_##name##_SIZE, \
52 #define RK3036_TIMER5_VIRT (RK_TIMER_VIRT + 0xa0)
54 static const char * const rk3036_dt_compat[] __initconst = {
59 static struct map_desc rk3036_io_desc[] __initdata = {
63 static void __init rk3036_dt_map_io(void)
65 rockchip_soc_id = ROCKCHIP_SOC_RK3036;
67 iotable_init(rk3036_io_desc, ARRAY_SIZE(rk3036_io_desc));
69 /* enable timer5 for core */
70 writel_relaxed(0, RK3036_TIMER5_VIRT + 0x10);
72 writel_relaxed(0xFFFFFFFF, RK3036_TIMER5_VIRT + 0x00);
73 writel_relaxed(0xFFFFFFFF, RK3036_TIMER5_VIRT + 0x04);
75 writel_relaxed(1, RK3036_TIMER5_VIRT + 0x10);
79 static void __init rk3036_dt_init_timer(void)
81 clocksource_of_init();
84 static void __init rk3036_reserve(void)
88 static void __init rk3036_init_late(void)
92 static void rk3036_restart(char mode, const char *cmd)
96 DT_MACHINE_START(RK3036_DT, "Rockchip RK3036")
97 .dt_compat = rk3036_dt_compat,
98 .smp = smp_ops(rockchip_smp_ops),
99 .reserve = rk3036_reserve,
100 .map_io = rk3036_dt_map_io,
101 .init_time = rk3036_dt_init_timer,
102 .init_late = rk3036_init_late,
103 .restart = rk3036_restart,