1 /*
2  * Copyright (C) 2005 Ivan Kokshaysky
3  * Copyright (C) SAN People
4  *
5  * Real Time Clock (RTC) - System peripheral registers.
6  * Based on AT91RM9200 datasheet revision E.
7  *
8  * SPDX-License-Identifier:	GPL-2.0+
9  */
10 
11 #ifndef AT91_RTC_H
12 #define AT91_RTC_H
13 
14 /* Control Register */
15 #define AT91_RTC_CR		(ATMEL_BASE_RTC + 0x00)
16 #define AT91_RTC_UPDTIM		(1 <<  0)	/* Update Request Time */
17 #define AT91_RTC_UPDCAL		(1 <<  1)	/* Update Request Calendar */
18 #define AT91_RTC_TIMEVSEL	(3 <<  8)	/* Time Event Selection */
19 #define AT91_RTC_TIMEVSEL_MINUTE (0 << 8)
20 #define AT91_RTC_TIMEVSEL_HOUR	(1 << 8)
21 #define AT91_RTC_TIMEVSEL_DAY24	(2 << 8)
22 #define AT91_RTC_TIMEVSEL_DAY12	(3 << 8)
23 #define AT91_RTC_CALEVSEL	(3 << 16)	/* Calendar Event Selection */
24 #define AT91_RTC_CALEVSEL_WEEK	(0 << 16)
25 #define AT91_RTC_CALEVSEL_MONTH	(1 << 16)
26 #define AT91_RTC_CALEVSEL_YEAR	(2 << 16)
27 
28 #define AT91_RTC_MR		(ATMEL_BASE_RTC + 0x04)	/* Mode Register */
29 #define AT91_RTC_HRMOD		(1 <<  0)		/* 12/24 Hour Mode */
30 
31 #define AT91_RTC_TIMR		(ATMEL_BASE_RTC + 0x08)	/* Time Register */
32 #define AT91_RTC_SEC		(0x7f <<  0)		/* Current Second */
33 #define AT91_RTC_MIN		(0x7f <<  8)		/* Current Minute */
34 #define AT91_RTC_HOUR		(0x3f << 16)		/* Current Hour */
35 #define AT91_RTC_AMPM		(1    << 22)		/* AM/PM */
36 
37 #define AT91_RTC_CALR		(ATMEL_BASE_RTC + 0x0c)	/* Calendar Register */
38 #define AT91_RTC_CENT		(0x7f <<  0)		/* Current Century */
39 #define AT91_RTC_YEAR		(0xff <<  8)		/* Current Year */
40 #define AT91_RTC_MONTH		(0x1f << 16)		/* Current Month */
41 #define AT91_RTC_DAY		(7    << 21)		/* Current Day */
42 #define AT91_RTC_DATE		(0x3f << 24)		/* Current Date */
43 
44 #define AT91_RTC_TIMALR		(ATMEL_BASE_RTC + 0x10)	/* Time Alarm */
45 #define AT91_RTC_SECEN		(1 <<  7)		/* Second Alarm Enab */
46 #define AT91_RTC_MINEN		(1 << 15)		/* Minute Alarm Enab */
47 #define AT91_RTC_HOUREN		(1 << 23)		/* Hour Alarm Enable */
48 
49 #define AT91_RTC_CALALR		(ATMEL_BASE_RTC + 0x14)	/* Calendar Alarm */
50 #define AT91_RTC_MTHEN		(1 << 23)		/* Month Alarm Enable */
51 #define AT91_RTC_DATEEN		(1 << 31)		/* Date Alarm Enable */
52 
53 #define AT91_RTC_SR		(ATMEL_BASE_RTC + 0x18)	/* Status Register */
54 #define AT91_RTC_ACKUPD		(1 <<  0)		/* Ack for Update */
55 #define AT91_RTC_ALARM		(1 <<  1)		/* Alarm Flag */
56 #define AT91_RTC_SECEV		(1 <<  2)		/* Second Event */
57 #define AT91_RTC_TIMEV		(1 <<  3)		/* Time Event */
58 #define AT91_RTC_CALEV		(1 <<  4)		/* Calendar Event */
59 
60 #define AT91_RTC_SCCR		(ATMEL_BASE_RTC + 0x1c)	/* Status Clear Cmd */
61 #define AT91_RTC_IER		(ATMEL_BASE_RTC + 0x20)	/* Interrupt Enable */
62 #define AT91_RTC_IDR		(ATMEL_BASE_RTC + 0x24)	/* Interrupt Disable */
63 #define AT91_RTC_IMR		(ATMEL_BASE_RTC + 0x28)	/* Interrupt Mask */
64 
65 #define AT91_RTC_VER		(ATMEL_BASE_RTC + 0x2c)	/* Valid Entry */
66 #define AT91_RTC_NVTIM		(1 <<  0)		/* Non-valid Time */
67 #define AT91_RTC_NVCAL		(1 <<  1)		/* Non-valid Calendar */
68 #define AT91_RTC_NVTIMALR	(1 <<  2)		/* .. Time Alarm */
69 #define AT91_RTC_NVCALALR	(1 <<  3)		/* .. Calendar Alarm */
70 
71 #endif
72