xref: /rk3399_rockchip-uboot/include/rk_timer_irq.h (revision e7b5bb3cc9527752c2c01acb4325fc0721fb75aa)
1 /*
2  * (C) Copyright 2018 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 #define TIMER_BASE		(0xFF810000 + 0x20)	/* TIMER 1 */
40 #define TIMER_IRQ		IRQ_TIMER1
41 #elif defined(CONFIG_ROCKCHIP_RK3399)
42 #define TIMER_BASE		(0xFF850000 + 0x20)	/* TIMER 1 */
43 #define TIMER_IRQ		IRQ_TIMER1
44 #elif defined(CONFIG_ROCKCHIP_PX30)
45 /*
46  * Use timer0 and never change, because timer0 will be used in charge animation
47  * driver to support auto wakeup when system suspend. If core poweroff, PMU only
48  * support timer0(not all timer) as wakeup source.
49  */
50 #define TIMER_BASE		(0xFF210000 + 0x00)	/* TIMER 0 */
51 #define TIMER_IRQ		IRQ_TIMER0
52 #else
53 "Missing definitions of timer module test"
54 #endif
55 
56 #endif
57