http://downloads.netgear.com/files/GPL/GPL_Source_V361j_DM111PSP_series_consumer_rele...
[bcm963xx.git] / kernel / linux / arch / arm / mach-integrator / time.c
1 /*
2  *  linux/arch/arm/mach-integrator/time.c
3  *
4  *  Copyright (C) 2000-2001 Deep Blue Solutions
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 #include <linux/kernel.h>
11 #include <linux/time.h>
12 #include <linux/init.h>
13
14 #include <asm/hardware.h>
15 #include <asm/io.h>
16
17 #define RTC_DR          (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 0)
18 #define RTC_MR          (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 4)
19 #define RTC_STAT        (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 8)
20 #define RTC_EOI         (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 8)
21 #define RTC_LR          (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 12)
22 #define RTC_CR          (IO_ADDRESS(INTEGRATOR_RTC_BASE) + 16)
23
24 #define RTC_CR_MIE      0x00000001
25
26 extern int (*set_rtc)(void);
27
28 static int integrator_set_rtc(void)
29 {
30         __raw_writel(xtime.tv_sec, RTC_LR);
31         return 1;
32 }
33
34 static int integrator_rtc_init(void)
35 {
36         __raw_writel(0, RTC_CR);
37         __raw_writel(0, RTC_EOI);
38
39         xtime.tv_sec = __raw_readl(RTC_DR);
40
41         set_rtc = integrator_set_rtc;
42
43         return 0;
44 }
45
46 __initcall(integrator_rtc_init);