blob: 1fb492c76e1b99900763e995aa9bcfb8ee4c77ea [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
TsiChung Liewf6afe722007-06-18 13:50:13 -05002/*
3 * RealTime Clock
4 *
TsiChungLiewc7d0b9e2007-07-05 23:21:09 -05005 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
TsiChung Liewf6afe722007-06-18 13:50:13 -05006 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
TsiChung Liewf6afe722007-06-18 13:50:13 -05007 */
8
9#ifndef __MCFRTC_H__
10#define __MCFRTC_H__
11
12/* Real time Clock */
13typedef struct rtc_ctrl {
14 u32 hourmin; /* 0x00 Hours and Minutes Counter Register */
15 u32 seconds; /* 0x04 Seconds Counter Register */
16 u32 alrm_hm; /* 0x08 Hours and Minutes Alarm Register */
17 u32 alrm_sec; /* 0x0C Seconds Alarm Register */
18 u32 cr; /* 0x10 Control Register */
19 u32 isr; /* 0x14 Interrupt Status Register */
20 u32 ier; /* 0x18 Interrupt Enable Register */
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050021 u32 stpwatch; /* 0x1C Stopwatch Minutes Register */
TsiChung Liewf6afe722007-06-18 13:50:13 -050022 u32 days; /* 0x20 Days Counter Register */
23 u32 alrm_day; /* 0x24 Days Alarm Register */
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -050024 void *extended;
TsiChung Liewf6afe722007-06-18 13:50:13 -050025} rtc_t;
26
27/* Bit definitions and macros for HOURMIN */
28#define RTC_HOURMIN_MINUTES(x) (((x)&0x0000003F))
29#define RTC_HOURMIN_HOURS(x) (((x)&0x0000001F)<<8)
30
31/* Bit definitions and macros for SECONDS */
32#define RTC_SECONDS_SECONDS(x) (((x)&0x0000003F))
33
34/* Bit definitions and macros for ALRM_HM */
35#define RTC_ALRM_HM_MINUTES(x) (((x)&0x0000003F))
36#define RTC_ALRM_HM_HOURS(x) (((x)&0x0000001F)<<8)
37
38/* Bit definitions and macros for ALRM_SEC */
39#define RTC_ALRM_SEC_SECONDS(x) (((x)&0x0000003F))
40
41/* Bit definitions and macros for CR */
42#define RTC_CR_SWR (0x00000001)
43#define RTC_CR_XTL(x) (((x)&0x00000003)<<5)
44#define RTC_CR_EN (0x00000080)
45#define RTC_CR_32768 (0x0)
46#define RTC_CR_32000 (0x1)
47#define RTC_CR_38400 (0x2)
48
49/* Bit definitions and macros for ISR */
50#define RTC_ISR_SW (0x00000001)
51#define RTC_ISR_MIN (0x00000002)
52#define RTC_ISR_ALM (0x00000004)
53#define RTC_ISR_DAY (0x00000008)
54#define RTC_ISR_1HZ (0x00000010)
55#define RTC_ISR_HR (0x00000020)
56#define RTC_ISR_2HZ (0x00000080)
57#define RTC_ISR_SAM0 (0x00000100)
58#define RTC_ISR_SAM1 (0x00000200)
59#define RTC_ISR_SAM2 (0x00000400)
60#define RTC_ISR_SAM3 (0x00000800)
61#define RTC_ISR_SAM4 (0x00001000)
62#define RTC_ISR_SAM5 (0x00002000)
63#define RTC_ISR_SAM6 (0x00004000)
64#define RTC_ISR_SAM7 (0x00008000)
65
66/* Bit definitions and macros for IER */
67#define RTC_IER_SW (0x00000001)
68#define RTC_IER_MIN (0x00000002)
69#define RTC_IER_ALM (0x00000004)
70#define RTC_IER_DAY (0x00000008)
71#define RTC_IER_1HZ (0x00000010)
72#define RTC_IER_HR (0x00000020)
73#define RTC_IER_2HZ (0x00000080)
74#define RTC_IER_SAM0 (0x00000100)
75#define RTC_IER_SAM1 (0x00000200)
76#define RTC_IER_SAM2 (0x00000400)
77#define RTC_IER_SAM3 (0x00000800)
78#define RTC_IER_SAM4 (0x00001000)
79#define RTC_IER_SAM5 (0x00002000)
80#define RTC_IER_SAM6 (0x00004000)
81#define RTC_IER_SAM7 (0x00008000)
82
83/* Bit definitions and macros for STPWCH */
84#define RTC_STPWCH_CNT(x) (((x)&0x0000003F))
85
86/* Bit definitions and macros for DAYS */
87#define RTC_DAYS_DAYS(x) (((x)&0x0000FFFF))
88
89/* Bit definitions and macros for ALRM_DAY */
90#define RTC_ALRM_DAY_DAYS(x) (((x)&0x0000FFFF))
91
92#endif /* __MCFRTC_H__ */