xref: /OK3568_Linux_fs/u-boot/include/rk_timer_irq.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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_RV1106)
64 #define TIMER_BASE		(0xFF660000 + 0x20)	/* TIMER 1 */
65 #define TIMER_IRQ		IRQ_TIMER1
66 #elif defined(CONFIG_ROCKCHIP_RV1126)
67 #define TIMER_BASE		(0xFF660000 + 0x20)	/* TIMER 1 */
68 #define TIMER_IRQ		IRQ_TIMER1
69 #elif defined(CONFIG_ROCKCHIP_RK3528)
70 #define TIMER_BASE		(0xFFAB0000 + 0x00)	/* TIMER 0 */
71 #define TIMER_IRQ		IRQ_TIMER0
72 #elif defined(CONFIG_ROCKCHIP_RK3562)
73 #define TIMER_BASE		(0xFFA50000 + 0x00)	/* TIMER 0 */
74 #define TIMER_IRQ		IRQ_TIMER0
75 #elif defined(CONFIG_ROCKCHIP_RK3568)
76 /* Only timer0 can wakeup system suspend */
77 #define TIMER_BASE		(0xFE5F0000 + 0x00)	/* TIMER 1 */
78 #define TIMER_IRQ		IRQ_TIMER0
79 #elif defined(CONFIG_ROCKCHIP_RK3588)
80 /* Only timer0 can wakeup system suspend */
81 #define TIMER_BASE		(0xFEAE0000 + 0x00)	/* TIMER 0 */
82 #define TIMER_IRQ		IRQ_TIMER0
83 #else
84 "Missing definitions of timer module test"
85 #endif
86 
87 #endif
88