162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * include/linux/rtc/m48t59.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Definitions for the platform data of m48t59 RTC chip driver. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright (c) 2007 Wind River Systems, Inc. 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Mark Zhan <rongkai.zhan@windriver.com> 1062306a36Sopenharmony_ci */ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#ifndef _LINUX_RTC_M48T59_H_ 1362306a36Sopenharmony_ci#define _LINUX_RTC_M48T59_H_ 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* 1662306a36Sopenharmony_ci * M48T59 Register Offset 1762306a36Sopenharmony_ci */ 1862306a36Sopenharmony_ci#define M48T59_YEAR 0xf 1962306a36Sopenharmony_ci#define M48T59_MONTH 0xe 2062306a36Sopenharmony_ci#define M48T59_MDAY 0xd /* Day of Month */ 2162306a36Sopenharmony_ci#define M48T59_WDAY 0xc /* Day of Week */ 2262306a36Sopenharmony_ci#define M48T59_WDAY_CB 0x20 /* Century Bit */ 2362306a36Sopenharmony_ci#define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */ 2462306a36Sopenharmony_ci#define M48T59_HOUR 0xb 2562306a36Sopenharmony_ci#define M48T59_MIN 0xa 2662306a36Sopenharmony_ci#define M48T59_SEC 0x9 2762306a36Sopenharmony_ci#define M48T59_CNTL 0x8 2862306a36Sopenharmony_ci#define M48T59_CNTL_READ 0x40 2962306a36Sopenharmony_ci#define M48T59_CNTL_WRITE 0x80 3062306a36Sopenharmony_ci#define M48T59_WATCHDOG 0x7 3162306a36Sopenharmony_ci#define M48T59_INTR 0x6 3262306a36Sopenharmony_ci#define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */ 3362306a36Sopenharmony_ci#define M48T59_INTR_ABE 0x20 3462306a36Sopenharmony_ci#define M48T59_ALARM_DATE 0x5 3562306a36Sopenharmony_ci#define M48T59_ALARM_HOUR 0x4 3662306a36Sopenharmony_ci#define M48T59_ALARM_MIN 0x3 3762306a36Sopenharmony_ci#define M48T59_ALARM_SEC 0x2 3862306a36Sopenharmony_ci#define M48T59_UNUSED 0x1 3962306a36Sopenharmony_ci#define M48T59_FLAGS 0x0 4062306a36Sopenharmony_ci#define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */ 4162306a36Sopenharmony_ci#define M48T59_FLAGS_AF 0x40 /* alarm */ 4262306a36Sopenharmony_ci#define M48T59_FLAGS_BF 0x10 /* low battery */ 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define M48T59RTC_TYPE_M48T59 0 /* to keep compatibility */ 4562306a36Sopenharmony_ci#define M48T59RTC_TYPE_M48T02 1 4662306a36Sopenharmony_ci#define M48T59RTC_TYPE_M48T08 2 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_cistruct m48t59_plat_data { 4962306a36Sopenharmony_ci /* The method to access M48T59 registers */ 5062306a36Sopenharmony_ci void (*write_byte)(struct device *dev, u32 ofs, u8 val); 5162306a36Sopenharmony_ci unsigned char (*read_byte)(struct device *dev, u32 ofs); 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci int type; /* RTC model */ 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci /* ioaddr mapped externally */ 5662306a36Sopenharmony_ci void __iomem *ioaddr; 5762306a36Sopenharmony_ci /* offset to RTC registers, automatically set according to the type */ 5862306a36Sopenharmony_ci unsigned int offset; 5962306a36Sopenharmony_ci}; 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#endif /* _LINUX_RTC_M48T59_H_ */ 62