1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * (C) Copyright 2007-2011
4  * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
5  * Tom Cubie <tangliang@allwinnertech.com>
6  *
7  * Configuration settings for the Allwinner A10-evb board.
8  */
9 
10 #ifndef _SUNXI_TIMER_H_
11 #define _SUNXI_TIMER_H_
12 
13 #ifndef __ASSEMBLY__
14 
15 #include <linux/types.h>
16 #include <asm/arch/watchdog.h>
17 
18 /* General purpose timer */
19 struct sunxi_timer {
20 	u32 ctl;
21 	u32 inter;
22 	u32 val;
23 	u8 res[4];
24 };
25 
26 /* Audio video sync*/
27 struct sunxi_avs {
28 	u32 ctl;		/* 0x80 */
29 	u32 cnt0;		/* 0x84 */
30 	u32 cnt1;		/* 0x88 */
31 	u32 div;		/* 0x8c */
32 };
33 
34 /* 64 bit counter */
35 struct sunxi_64cnt {
36 	u32 ctl;		/* 0xa0 */
37 	u32 lo;			/* 0xa4 */
38 	u32 hi;			/* 0xa8 */
39 };
40 
41 /* Rtc */
42 struct sunxi_rtc {
43 	u32 ctl;		/* 0x100 */
44 	u32 yymmdd;		/* 0x104 */
45 	u32 hhmmss;		/* 0x108 */
46 };
47 
48 /* Alarm */
49 struct sunxi_alarm {
50 	u32 ddhhmmss;		/* 0x10c */
51 	u32 hhmmss;		/* 0x110 */
52 	u32 en;			/* 0x114 */
53 	u32 irqen;		/* 0x118 */
54 	u32 irqsta;		/* 0x11c */
55 };
56 
57 /* Timer general purpose register */
58 struct sunxi_tgp {
59 	u32 tgpd;
60 };
61 
62 struct sunxi_timer_reg {
63 	u32 tirqen;		/* 0x00 */
64 	u32 tirqsta;		/* 0x04 */
65 	u8 res1[8];
66 	struct sunxi_timer timer[6];	/* We have 6 timers */
67 	u8 res2[16];
68 	struct sunxi_avs avs;
69 #if defined(CONFIG_SUNXI_GEN_SUN4I) || defined(CONFIG_MACH_SUN8I_R40)
70 	struct sunxi_wdog wdog;	/* 0x90 */
71 	/* XXX the following is not accurate for sun5i/sun7i */
72 	struct sunxi_64cnt cnt64;	/* 0xa0 */
73 	u8 res4[0x58];
74 	struct sunxi_rtc rtc;
75 	struct sunxi_alarm alarm;
76 	struct sunxi_tgp tgp[4];
77 	u8 res5[8];
78 	u32 cpu_cfg;
79 #elif defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_MACH_SUN50I_H6)
80 	u8 res3[16];
81 	struct sunxi_wdog wdog[5];	/* We have 5 watchdogs */
82 #endif
83 };
84 
85 #endif /* __ASSEMBLY__ */
86 
87 #endif
88