import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / mips / au1000 / common / rtc.c
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  * RTC routines for PC style attached Dallas chip.
7  *
8  * Copyright (C) 1998, 2001 by Ralf Baechle
9  */
10 #include <linux/mc146818rtc.h>
11 #include <asm/io.h>
12 #include <asm/au1000.h>
13
14 #define PB1500_RTC_ADDR 0xAC000000
15
16 unsigned char std_rtc_read_data(unsigned long offset)
17 {
18         offset <<= 2;
19         return (u8)(au_readl(offset + PB1500_RTC_ADDR) & 0xff);
20 }
21
22 static void std_rtc_write_data(unsigned char data, unsigned long offset)
23 {
24         offset <<= 2;
25         au_writel(data, offset + PB1500_RTC_ADDR);
26 }
27
28 static int std_rtc_bcd_mode(void)
29 {
30         return 1;
31 }
32
33 struct rtc_ops pb1500_rtc_ops = {
34         &std_rtc_read_data,
35         &std_rtc_write_data,
36         &std_rtc_bcd_mode
37 };