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, 2000 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#elif defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR) 54 55#include <asm/it8172/it8172_int.h> 56 57#define RTC_PORT(x) (0x14014800 + (x)) 58#define RTC_IOMAPPED 0 59#define RTC_IRQ IT8172_RTC_IRQ 60 61#elif defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1100) 62 63#define RTC_PORT(x) (0x0c000000 + (x)) 64#define RTC_IOMAPPED 0 65#define RTC_IRQ 0 66 67#else 68 69#define RTC_PORT(x) (0x70 + (x)) 70#define RTC_IRQ 8 71 72#endif 73 74#endif /* _ASM_MC146818RTC_H */ 75