1384740dcSRalf Baechle /* 2384740dcSRalf Baechle * This file is subject to the terms and conditions of the GNU General Public 3384740dcSRalf Baechle * License. See the file "COPYING" in the main directory of this archive 4384740dcSRalf Baechle * for more details. 5384740dcSRalf Baechle * 6384740dcSRalf Baechle * Copyright (C) 1998, 2001, 03 by Ralf Baechle 7384740dcSRalf Baechle * 8384740dcSRalf Baechle * RTC routines for PC style attached Dallas chip. 9384740dcSRalf Baechle */ 10384740dcSRalf Baechle #ifndef __ASM_MACH_GENERIC_MC146818RTC_H 11384740dcSRalf Baechle #define __ASM_MACH_GENERIC_MC146818RTC_H 12384740dcSRalf Baechle 13384740dcSRalf Baechle #include <asm/io.h> 14384740dcSRalf Baechle 15384740dcSRalf Baechle #define RTC_PORT(x) (0x70 + (x)) 16384740dcSRalf Baechle #define RTC_IRQ 8 17384740dcSRalf Baechle CMOS_READ(unsigned long addr)18384740dcSRalf Baechlestatic inline unsigned char CMOS_READ(unsigned long addr) 19384740dcSRalf Baechle { 20384740dcSRalf Baechle outb_p(addr, RTC_PORT(0)); 21384740dcSRalf Baechle return inb_p(RTC_PORT(1)); 22384740dcSRalf Baechle } 23384740dcSRalf Baechle CMOS_WRITE(unsigned char data,unsigned long addr)24384740dcSRalf Baechlestatic inline void CMOS_WRITE(unsigned char data, unsigned long addr) 25384740dcSRalf Baechle { 26384740dcSRalf Baechle outb_p(addr, RTC_PORT(0)); 27384740dcSRalf Baechle outb_p(data, RTC_PORT(1)); 28384740dcSRalf Baechle } 29384740dcSRalf Baechle 30*ae7ce6b1SPaul Burton #define RTC_ALWAYS_BCD 0 31384740dcSRalf Baechle 32384740dcSRalf Baechle #ifndef mc146818_decode_year 33384740dcSRalf Baechle #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900) 34384740dcSRalf Baechle #endif 35384740dcSRalf Baechle 36384740dcSRalf Baechle #endif /* __ASM_MACH_GENERIC_MC146818RTC_H */ 37