sunxi: add sun7i clocks and timer support.
[karo-tx-uboot.git] / arch / arm / include / asm / arch-sunxi / timer.h
1 /*
2  * (C) Copyright 2007-2011
3  * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
4  * Tom Cubie <tangliang@allwinnertech.com>
5  *
6  * Configuration settings for the Allwinner A10-evb board.
7  *
8  * SPDX-License-Identifier:     GPL-2.0+
9  */
10
11 #ifndef _SUNXI_TIMER_H_
12 #define _SUNXI_TIMER_H_
13
14 #ifndef __ASSEMBLY__
15
16 #include <linux/types.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 /* Watchdog */
42 struct sunxi_wdog {
43         u32 ctl;                /* 0x90 */
44         u32 mode;               /* 0x94 */
45 };
46
47 /* Rtc */
48 struct sunxi_rtc {
49         u32 ctl;                /* 0x100 */
50         u32 yymmdd;             /* 0x104 */
51         u32 hhmmss;             /* 0x108 */
52 };
53
54 /* Alarm */
55 struct sunxi_alarm {
56         u32 ddhhmmss;           /* 0x10c */
57         u32 hhmmss;             /* 0x110 */
58         u32 en;                 /* 0x114 */
59         u32 irqen;              /* 0x118 */
60         u32 irqsta;             /* 0x11c */
61 };
62
63 /* Timer general purpose register */
64 struct sunxi_tgp {
65         u32 tgpd;
66 };
67
68 struct sunxi_timer_reg {
69         u32 tirqen;             /* 0x00 */
70         u32 tirqsta;            /* 0x04 */
71         u8 res1[8];
72         struct sunxi_timer timer[6];    /* We have 6 timers */
73         u8 res2[16];
74         struct sunxi_avs avs;
75         struct sunxi_wdog wdog;
76         u8 res3[8];
77         struct sunxi_64cnt cnt64;
78         u8 res4[0x58];
79         struct sunxi_rtc rtc;
80         struct sunxi_alarm alarm;
81         struct sunxi_tgp tgp[4];
82         u8 res5[8];
83         u32 cpu_cfg;
84 };
85
86 #endif /* __ASSEMBLY__ */
87
88 #endif