xref: /rk3399_rockchip-uboot/drivers/rtc/mvrtc.h (revision b608b95753873a5073f550cca002c4bebf1a18f5)
1*b608b957SJason Cooper /*
2*b608b957SJason Cooper  * Copyright (C) 2011
3*b608b957SJason Cooper  * Jason Cooper <u-boot@lakedaemon.net>
4*b608b957SJason Cooper  *
5*b608b957SJason Cooper  * See file CREDITS for list of people who contributed to this
6*b608b957SJason Cooper  * project.
7*b608b957SJason Cooper  *
8*b608b957SJason Cooper  * This program is free software; you can redistribute it and/or
9*b608b957SJason Cooper  * modify it under the terms of the GNU General Public License as
10*b608b957SJason Cooper  * published by the Free Software Foundation; either version 2 of
11*b608b957SJason Cooper  * the License, or (at your option) any later version.
12*b608b957SJason Cooper  *
13*b608b957SJason Cooper  * This program is distributed in the hope that it will be useful,
14*b608b957SJason Cooper  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15*b608b957SJason Cooper  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*b608b957SJason Cooper  * GNU General Public License for more details.
17*b608b957SJason Cooper  *
18*b608b957SJason Cooper  * You should have received a copy of the GNU General Public License
19*b608b957SJason Cooper  * along with this program; if not, write to the Free Software
20*b608b957SJason Cooper  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21*b608b957SJason Cooper  * MA 02111-1307 USA
22*b608b957SJason Cooper  */
23*b608b957SJason Cooper 
24*b608b957SJason Cooper /*
25*b608b957SJason Cooper  * Date & Time support for Marvell Integrated RTC
26*b608b957SJason Cooper  */
27*b608b957SJason Cooper 
28*b608b957SJason Cooper #ifndef _MVRTC_H_
29*b608b957SJason Cooper #define _MVRTC_H_
30*b608b957SJason Cooper 
31*b608b957SJason Cooper #include <asm/arch/kirkwood.h>
32*b608b957SJason Cooper #include <compiler.h>
33*b608b957SJason Cooper 
34*b608b957SJason Cooper /* RTC registers */
35*b608b957SJason Cooper struct mvrtc_registers {
36*b608b957SJason Cooper 	u32 time;
37*b608b957SJason Cooper 	u32 date;
38*b608b957SJason Cooper };
39*b608b957SJason Cooper 
40*b608b957SJason Cooper /* time register */
41*b608b957SJason Cooper #define MVRTC_SEC_SFT		0
42*b608b957SJason Cooper #define MVRTC_SEC_MSK		0x7f
43*b608b957SJason Cooper #define MVRTC_MIN_SFT		8
44*b608b957SJason Cooper #define MVRTC_MIN_MSK		0x7f
45*b608b957SJason Cooper #define MVRTC_HOUR_SFT		16
46*b608b957SJason Cooper #define MVRTC_HOUR_MSK		0x3f
47*b608b957SJason Cooper #define MVRTC_DAY_SFT		24
48*b608b957SJason Cooper #define MVRTC_DAY_MSK		0x7
49*b608b957SJason Cooper 
50*b608b957SJason Cooper /*
51*b608b957SJason Cooper  * Hour format bit
52*b608b957SJason Cooper  *   1 = 12 hour clock
53*b608b957SJason Cooper  *   0 = 24 hour clock
54*b608b957SJason Cooper  */
55*b608b957SJason Cooper #define MVRTC_HRFMT_MSK		0x00400000
56*b608b957SJason Cooper 
57*b608b957SJason Cooper /* date register */
58*b608b957SJason Cooper #define MVRTC_DATE_SFT		0
59*b608b957SJason Cooper #define MVRTC_DATE_MSK		0x3f
60*b608b957SJason Cooper #define MVRTC_MON_SFT		8
61*b608b957SJason Cooper #define MVRTC_MON_MSK		0x1f
62*b608b957SJason Cooper #define MVRTC_YEAR_SFT		16
63*b608b957SJason Cooper #define MVRTC_YEAR_MSK		0xff
64*b608b957SJason Cooper 
65*b608b957SJason Cooper #endif
66