1/* 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 4 * for more details. 5 * 6 * Machine dependent access functions for RTC registers. 7 * 8 * Copyright (C) 1996, 1997, 1998 Ralf Baechle 9 * Copyright (C) 2002 Maciej W. Rozycki 10 */ 11#ifndef _ASM_MC146818RTC_H 12#define _ASM_MC146818RTC_H 13 14#include <linux/config.h> 15 16#include <asm/io.h> 17 18 19/* 20 * This structure defines how to access various features of 21 * different machine types and how to access them. 22 */ 23struct rtc_ops { 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); 28}; 29 30extern struct rtc_ops *rtc_ops; 31 32/* 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. 38 */ 39#define CMOS_READ(addr) ({ \ 40rtc_ops->rtc_read_data(addr); \ 41}) 42#define CMOS_WRITE(val, addr) ({ \ 43rtc_ops->rtc_write_data(val, addr); \ 44}) 45#define RTC_ALWAYS_BCD \ 46rtc_ops->rtc_bcd_mode() 47 48 49#ifdef CONFIG_DECSTATION 50 51#include <asm/dec/rtc-dec.h> 52 53#else 54 55#define RTC_PORT(x) (0x70 + (x)) 56#define RTC_IRQ 8 57 58#endif 59 60#endif /* _ASM_MC146818RTC_H */ 61