2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Machine dependent access functions for RTC registers.
8 * Copyright (C) 1996, 1997, 1998, 2000 Ralf Baechle
9 * Copyright (C) 2002 Maciej W. Rozycki
11 #ifndef _ASM_MC146818RTC_H
12 #define _ASM_MC146818RTC_H
14 #include <linux/config.h>
20 * This structure defines how to access various features of
21 * different machine types and how to access them.
24 /* How to access the RTC register in a DS1287. */
25 unsigned char (*rtc_read_data)(unsigned long addr);
26 void (*rtc_write_data)(unsigned char data, unsigned long addr);
27 int (*rtc_bcd_mode)(void);
30 extern struct rtc_ops *rtc_ops;
33 * Most supported machines access the RTC index register via an ISA
34 * port access but the way to access the date register differs ...
35 * The DECstation directly maps the RTC memory in the CPU's address
36 * space with the chipset generating necessary index write/data access
37 * cycles automagically.
39 #define CMOS_READ(addr) ({ \
40 rtc_ops->rtc_read_data(addr); \
42 #define CMOS_WRITE(val, addr) ({ \
43 rtc_ops->rtc_write_data(val, addr); \
45 #define RTC_ALWAYS_BCD \
46 rtc_ops->rtc_bcd_mode()
49 #ifdef CONFIG_DECSTATION
51 #include <asm/dec/rtc-dec.h>
53 #elif defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1100)
55 #define RTC_PORT(x) (0x0c000000 + (x))
56 #define RTC_IOMAPPED 0
61 #define RTC_PORT(x) (0x70 + (x))
66 #endif /* _ASM_MC146818RTC_H */