xref: /openbmc/linux/include/linux/rtc/m48t59.h (revision 384740dc)
1 /*
2  * include/linux/rtc/m48t59.h
3  *
4  * Definitions for the platform data of m48t59 RTC chip driver.
5  *
6  * Copyright (c) 2007 Wind River Systems, Inc.
7  *
8  * Mark Zhan <rongkai.zhan@windriver.com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  */
14 
15 #ifndef _LINUX_RTC_M48T59_H_
16 #define _LINUX_RTC_M48T59_H_
17 
18 /*
19  * M48T59 Register Offset
20  */
21 #define M48T59_YEAR		0x1fff
22 #define M48T59_MONTH		0x1ffe
23 #define M48T59_MDAY		0x1ffd	/* Day of Month */
24 #define M48T59_WDAY		0x1ffc	/* Day of Week */
25 #define M48T59_WDAY_CB			0x20	/* Century Bit */
26 #define M48T59_WDAY_CEB			0x10	/* Century Enable Bit */
27 #define M48T59_HOUR		0x1ffb
28 #define M48T59_MIN		0x1ffa
29 #define M48T59_SEC		0x1ff9
30 #define M48T59_CNTL		0x1ff8
31 #define M48T59_CNTL_READ		0x40
32 #define M48T59_CNTL_WRITE		0x80
33 #define M48T59_WATCHDOG		0x1ff7
34 #define M48T59_INTR		0x1ff6
35 #define M48T59_INTR_AFE			0x80	/* Alarm Interrupt Enable */
36 #define M48T59_INTR_ABE			0x20
37 #define M48T59_ALARM_DATE	0x1ff5
38 #define M48T59_ALARM_HOUR	0x1ff4
39 #define M48T59_ALARM_MIN	0x1ff3
40 #define M48T59_ALARM_SEC	0x1ff2
41 #define M48T59_UNUSED		0x1ff1
42 #define M48T59_FLAGS		0x1ff0
43 #define M48T59_FLAGS_WDT		0x80	/* watchdog timer expired */
44 #define M48T59_FLAGS_AF			0x40	/* alarm */
45 #define M48T59_FLAGS_BF			0x10	/* low battery */
46 
47 #define M48T59_NVRAM_SIZE	0x1ff0
48 
49 struct m48t59_plat_data {
50 	/* The method to access M48T59 registers,
51 	 * NOTE: The 'ofs' should be 0x00~0x1fff
52 	 */
53 	void (*write_byte)(struct device *dev, u32 ofs, u8 val);
54 	unsigned char (*read_byte)(struct device *dev, u32 ofs);
55 };
56 
57 #endif /* _LINUX_RTC_M48T59_H_ */
58