1/* 2 * Machine dependent access functions for RTC registers. 3 */ 4#ifndef _ASM_MC146818RTC_H 5#define _ASM_MC146818RTC_H 6 7#include <linux/config.h> 8#include <asm/atarihw.h> 9 10#ifdef CONFIG_ATARI 11/* RTC in Atari machines */ 12 13#include <asm/atarihw.h> 14#include <asm/atariints.h> 15#include <asm/io.h> 16#define RTC_HAS_IRQ (ATARIHW_PRESENT(TT_MFP)) 17#define RTC_IRQ IRQ_TT_MFP_RTC 18#define RTC_IRQ_FLAGS IRQ_TYPE_FAST 19#define RTC_PORT(x) (TT_RTC_BAS + 2*(x)) 20#define RTC_ALWAYS_BCD 0 /* TOS uses binary mode, Linux should be able 21 * to deal with both modes */ 22 23#define RTC_CHECK_DRIVER_INIT() (MACH_IS_ATARI && ATARIHW_PRESENT(TT_CLK)) 24#define RTC_MACH_INIT() \ 25 do { \ 26 epoch = atari_rtc_year_offset + 1900; \ 27 if (RTC_HAS_IRQ) \ 28 /* select RTC int on H->L edge */ \ 29 tt_mfp.active_edge &= ~0x40; \ 30 } while(0) 31#define RTC_MACH_EXIT() 32 33/* On Atari, the year was stored with base 1970 in old TOS versions (before 34 * 3.06). Later, Atari recognized that this broke leap year recognition, and 35 * changed the base to 1968. Medusa and Hades always use the new version. */ 36#define RTC_CENTURY_SWITCH -1 /* no century switch */ 37#define RTC_MINYEAR epoch 38 39#define CMOS_READ(addr) ({ \ 40atari_outb_p((addr),RTC_PORT(0)); \ 41atari_inb_p(RTC_PORT(1)); \ 42}) 43#define CMOS_WRITE(val, addr) ({ \ 44atari_outb_p((addr),RTC_PORT(0)); \ 45atari_outb_p((val),RTC_PORT(1)); \ 46}) 47#endif /* CONFIG_ATARI */ 48 49#endif /* _ASM_MC146818RTC_H */ 50