Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * include/linux/rtc/m48t59.h
0004  *
0005  * Definitions for the platform data of m48t59 RTC chip driver.
0006  *
0007  * Copyright (c) 2007 Wind River Systems, Inc.
0008  *
0009  * Mark Zhan <rongkai.zhan@windriver.com>
0010  */
0011 
0012 #ifndef _LINUX_RTC_M48T59_H_
0013 #define _LINUX_RTC_M48T59_H_
0014 
0015 /*
0016  * M48T59 Register Offset
0017  */
0018 #define M48T59_YEAR     0xf
0019 #define M48T59_MONTH        0xe
0020 #define M48T59_MDAY     0xd /* Day of Month */
0021 #define M48T59_WDAY     0xc /* Day of Week */
0022 #define M48T59_WDAY_CB          0x20    /* Century Bit */
0023 #define M48T59_WDAY_CEB         0x10    /* Century Enable Bit */
0024 #define M48T59_HOUR     0xb
0025 #define M48T59_MIN      0xa
0026 #define M48T59_SEC      0x9
0027 #define M48T59_CNTL     0x8
0028 #define M48T59_CNTL_READ        0x40
0029 #define M48T59_CNTL_WRITE       0x80
0030 #define M48T59_WATCHDOG     0x7
0031 #define M48T59_INTR     0x6
0032 #define M48T59_INTR_AFE         0x80    /* Alarm Interrupt Enable */
0033 #define M48T59_INTR_ABE         0x20
0034 #define M48T59_ALARM_DATE   0x5
0035 #define M48T59_ALARM_HOUR   0x4
0036 #define M48T59_ALARM_MIN    0x3
0037 #define M48T59_ALARM_SEC    0x2
0038 #define M48T59_UNUSED       0x1
0039 #define M48T59_FLAGS        0x0
0040 #define M48T59_FLAGS_WDT        0x80    /* watchdog timer expired */
0041 #define M48T59_FLAGS_AF         0x40    /* alarm */
0042 #define M48T59_FLAGS_BF         0x10    /* low battery */
0043 
0044 #define M48T59RTC_TYPE_M48T59   0 /* to keep compatibility */
0045 #define M48T59RTC_TYPE_M48T02   1
0046 #define M48T59RTC_TYPE_M48T08   2
0047 
0048 struct m48t59_plat_data {
0049     /* The method to access M48T59 registers */
0050     void (*write_byte)(struct device *dev, u32 ofs, u8 val);
0051     unsigned char (*read_byte)(struct device *dev, u32 ofs);
0052 
0053     int type; /* RTC model */
0054 
0055     /* ioaddr mapped externally */
0056     void __iomem *ioaddr;
0057     /* offset to RTC registers, automatically set according to the type */
0058     unsigned int offset;
0059 };
0060 
0061 #endif /* _LINUX_RTC_M48T59_H_ */