1 // See LICENSE for license details.
2 
3 #ifndef _SIFIVE_AON_H
4 #define _SIFIVE_AON_H
5 
6 /* Register offsets */
7 
8 #define AON_WDOGCFG     0x000
9 #define AON_WDOGCOUNT   0x008
10 #define AON_WDOGS       0x010
11 #define AON_WDOGFEED    0x018
12 #define AON_WDOGKEY     0x01C
13 #define AON_WDOGCMP     0x020
14 
15 #define AON_RTCCFG      0x040
16 #define AON_RTCLO       0x048
17 #define AON_RTCHI       0x04C
18 #define AON_RTCS        0x050
19 #define AON_RTCCMP      0x060
20 
21 #define AON_BACKUP0     0x080
22 #define AON_BACKUP1     0x084
23 #define AON_BACKUP2     0x088
24 #define AON_BACKUP3     0x08C
25 #define AON_BACKUP4     0x090
26 #define AON_BACKUP5     0x094
27 #define AON_BACKUP6     0x098
28 #define AON_BACKUP7     0x09C
29 #define AON_BACKUP8     0x0A0
30 #define AON_BACKUP9     0x0A4
31 #define AON_BACKUP10    0x0A8
32 #define AON_BACKUP11    0x0AC
33 #define AON_BACKUP12    0x0B0
34 #define AON_BACKUP13    0x0B4
35 #define AON_BACKUP14    0x0B8
36 #define AON_BACKUP15    0x0BC
37 
38 #define AON_PMUWAKEUPI0 0x100
39 #define AON_PMUWAKEUPI1 0x104
40 #define AON_PMUWAKEUPI2 0x108
41 #define AON_PMUWAKEUPI3 0x10C
42 #define AON_PMUWAKEUPI4 0x110
43 #define AON_PMUWAKEUPI5 0x114
44 #define AON_PMUWAKEUPI6 0x118
45 #define AON_PMUWAKEUPI7 0x11C
46 #define AON_PMUSLEEPI0  0x120
47 #define AON_PMUSLEEPI1  0x124
48 #define AON_PMUSLEEPI2  0x128
49 #define AON_PMUSLEEPI3  0x12C
50 #define AON_PMUSLEEPI4  0x130
51 #define AON_PMUSLEEPI5  0x134
52 #define AON_PMUSLEEPI6  0x138
53 #define AON_PMUSLEEPI7  0x13C
54 #define AON_PMUIE       0x140
55 #define AON_PMUCAUSE    0x144
56 #define AON_PMUSLEEP    0x148
57 #define AON_PMUKEY      0x14C
58 
59 #define AON_LFROSC      0x070
60 /* Constants */
61 
62 #define AON_WDOGKEY_VALUE  0x51F15E
63 #define AON_WDOGFEED_VALUE 0xD09F00D
64 
65 #define AON_WDOGCFG_SCALE       0x0000000F
66 #define AON_WDOGCFG_RSTEN       0x00000100
67 #define AON_WDOGCFG_ZEROCMP     0x00000200
68 #define AON_WDOGCFG_ENALWAYS    0x00001000
69 #define AON_WDOGCFG_ENCOREAWAKE 0x00002000
70 #define AON_WDOGCFG_CMPIP       0x10000000
71 
72 #define AON_RTCCFG_SCALE     0x0000000F
73 #define AON_RTCCFG_ENALWAYS  0x00001000
74 #define AON_RTCCFG_CMPIP     0x10000000
75 
76 #define AON_WAKEUPCAUSE_RESET   0x00
77 #define AON_WAKEUPCAUSE_RTC     0x01
78 #define AON_WAKEUPCAUSE_DWAKEUP 0x02
79 #define AON_WAKEUPCAUSE_AWAKEUP 0x03
80 
81 #define AON_RESETCAUSE_POWERON  0x0000
82 #define AON_RESETCAUSE_EXTERNAL 0x0100
83 #define AON_RESETCAUSE_WATCHDOG 0x0200
84 
85 #define AON_PMUCAUSE_WAKEUPCAUSE 0x00FF
86 #define AON_PMUCAUSE_RESETCAUSE  0xFF00
87 
88 #endif /* _SIFIVE_AON_H */
89