xref: /rk3399_rockchip-uboot/include/rk_timer_irq.h (revision f30e68c4094a5a05c60fec11119a1b6f7cdaec26)
1 /*
2  * (C) Copyright 2022 Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6 
7 #ifndef _RK_TIMER_IRQ_H
8 #define _RK_TIMER_IRQ_H
9 
10 #include <irq-platform.h>
11 
12 #ifdef CONFIG_ROCKCHIP_RK3399
13 #define TIMER_CTRL		0x1c
14 #else
15 #define TIMER_CTRL		0x10
16 #endif
17 
18 #define TIMER_LOAD_COUNT0	0x00
19 #define TIMER_LOAD_COUNT1	0x04
20 #define TIMER_INTSTATUS		0x18
21 
22 #define TIMER_EN		BIT(0)
23 #define TIMER_INT_EN		BIT(2)
24 #define TIMER_CLR_INT		BIT(0)
25 
26 #if defined(CONFIG_ROCKCHIP_RK3128)
27 #define TIMER_BASE		(0x20044000 + 0x20)	/* TIMER 1 */
28 #define TIMER_IRQ		IRQ_TIMER1
29 #elif defined(CONFIG_ROCKCHIP_RK322X)
30 #define TIMER_BASE		(0x110C0000 + 0x20)	/* TIMER 1 */
31 #define TIMER_IRQ		IRQ_TIMER1
32 #elif defined(CONFIG_ROCKCHIP_RK3288)
33 #define TIMER_BASE		(0xFF6B0000 + 0x20)	/* TIMER 1 */
34 #define TIMER_IRQ		IRQ_TIMER1
35 #elif defined(CONFIG_ROCKCHIP_RK3328)
36 #define TIMER_BASE		(0xFF1C0000 + 0x20)	/* TIMER 1 */
37 #define TIMER_IRQ		IRQ_TIMER1
38 #elif defined(CONFIG_ROCKCHIP_RK3368)
39 /*
40  * Use timer0 and never change, because timer0 will be used in charge animation
41  * driver to support auto wakeup when system suspend. If core poweroff, PMU only
42  * support timer0(not all timer) as wakeup source.
43  */
44 #define TIMER_BASE		(0xFF810000 + 0x00)	/* TIMER 0 */
45 #define TIMER_IRQ		IRQ_TIMER0
46 #elif defined(CONFIG_ROCKCHIP_RK3399)
47 #define TIMER_BASE		(0xFF850000 + 0x20)	/* TIMER 1 */
48 #define TIMER_IRQ		IRQ_TIMER1
49 #elif defined(CONFIG_ROCKCHIP_RK3308)
50 #define TIMER_BASE		(0xFF1a0000 + 0x20)	/* TIMER 1 */
51 #define TIMER_IRQ		IRQ_TIMER1
52 #elif defined(CONFIG_ROCKCHIP_PX30)
53 /*
54  * Use timer0 and never change, because timer0 will be used in charge animation
55  * driver to support auto wakeup when system suspend. If core poweroff, PMU only
56  * support timer0(not all timer) as wakeup source.
57  */
58 #define TIMER_BASE		(0xFF210000 + 0x00)	/* TIMER 0 */
59 #define TIMER_IRQ		IRQ_TIMER0
60 #elif defined(CONFIG_ROCKCHIP_RK1808)
61 #define TIMER_BASE		(0xFF700000 + 0x20)	/* TIMER 1 */
62 #define TIMER_IRQ		IRQ_TIMER1
63 #elif defined(CONFIG_ROCKCHIP_RV1103B)
64 #define TIMER_BASE		(0x20830000 + 0x10000)	/* TIMER 1 */
65 #define TIMER_IRQ		IRQ_TIMER1
66 #elif defined(CONFIG_ROCKCHIP_RV1106)
67 #define TIMER_BASE		(0xFF660000 + 0x20)	/* TIMER 1 */
68 #define TIMER_IRQ		IRQ_TIMER1
69 #elif defined(CONFIG_ROCKCHIP_RV1126)
70 #define TIMER_BASE		(0xFF660000 + 0x20)	/* TIMER 1 */
71 #define TIMER_IRQ		IRQ_TIMER1
72 #elif defined(CONFIG_ROCKCHIP_RV1126B)
73 #define TIMER_BASE		(0x20c00000 + 0x10000)	/* TIMER 1 */
74 #define TIMER_IRQ		IRQ_TIMER1
75 #elif defined(CONFIG_ROCKCHIP_RK3506)
76 #define TIMER_BASE		(0xFF250000 + 0x00)	/* TIMER 0 */
77 #define TIMER_IRQ		IRQ_TIMER0
78 #elif defined(CONFIG_ROCKCHIP_RK3528)
79 #define TIMER_BASE		(0xFFAB0000 + 0x00)	/* TIMER 0 */
80 #define TIMER_IRQ		IRQ_TIMER0
81 #elif defined(CONFIG_ROCKCHIP_RK3562)
82 #define TIMER_BASE		(0xFFA50000 + 0x00)	/* TIMER 0 */
83 #define TIMER_IRQ		IRQ_TIMER0
84 #elif defined(CONFIG_ROCKCHIP_RK3568)
85 /* Only timer0 can wakeup system suspend */
86 #define TIMER_BASE		(0xFE5F0000 + 0x00)	/* TIMER 0 */
87 #define TIMER_IRQ		IRQ_TIMER0
88 #elif defined(CONFIG_ROCKCHIP_RK3576)
89 #define TIMER_BASE		(0x2acc0000 + 0x00)	/* TIMER 0 */
90 #define TIMER_IRQ		IRQ_TIMER0
91 #elif defined(CONFIG_ROCKCHIP_RK3588)
92 /* Only timer0 can wakeup system suspend */
93 #define TIMER_BASE		(0xFEAE0000 + 0x00)	/* TIMER 0 */
94 #define TIMER_IRQ		IRQ_TIMER0
95 #else
96 "Missing definitions of timer module test"
97 #endif
98 
99 #endif
100