diff options
author | Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> | 2009-02-19 10:50:46 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@mcmartin.ca> | 2009-04-01 21:05:31 -0400 |
commit | 2ceb3ad705aa1abe6656b038bb9f4a6b1201cc35 (patch) | |
tree | 2ba21ba2d78d98cc442958a429bd602319e650c8 | |
parent | 3afe6d04626f8de87b15150a30b78df492ab68ee (diff) |
m68k: Hook up rtc-generic
m68k has been a long time user of the generic RTC abstraction, so hook up
rtc-generic:
- Create the "rtc-generic" platform device if mach_hwclk is set,
- Add checks for mach_hwclk, in anticipation of RTC chip drivers being moved
to drivers/rtc/.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
-rw-r--r-- | arch/m68k/include/asm/rtc.h | 7 | ||||
-rw-r--r-- | arch/m68k/kernel/time.c | 18 | ||||
-rw-r--r-- | drivers/rtc/Kconfig | 2 |
3 files changed, 24 insertions, 3 deletions
diff --git a/arch/m68k/include/asm/rtc.h b/arch/m68k/include/asm/rtc.h index 5d3e03859844..a4d08ea122ee 100644 --- a/arch/m68k/include/asm/rtc.h +++ b/arch/m68k/include/asm/rtc.h | |||
@@ -36,13 +36,16 @@ static inline unsigned int get_rtc_time(struct rtc_time *time) | |||
36 | * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated | 36 | * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated |
37 | * by the RTC when initially set to a non-zero value. | 37 | * by the RTC when initially set to a non-zero value. |
38 | */ | 38 | */ |
39 | mach_hwclk(0, time); | 39 | if (mach_hwclk) |
40 | mach_hwclk(0, time); | ||
40 | return RTC_24H; | 41 | return RTC_24H; |
41 | } | 42 | } |
42 | 43 | ||
43 | static inline int set_rtc_time(struct rtc_time *time) | 44 | static inline int set_rtc_time(struct rtc_time *time) |
44 | { | 45 | { |
45 | return mach_hwclk(1, time); | 46 | if (mach_hwclk) |
47 | return mach_hwclk(1, time); | ||
48 | return -EINVAL; | ||
46 | } | 49 | } |
47 | 50 | ||
48 | static inline unsigned int get_rtc_ss(void) | 51 | static inline unsigned int get_rtc_ss(void) |
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index 7db41594d7b6..54d980795fc4 100644 --- a/arch/m68k/kernel/time.c +++ b/arch/m68k/kernel/time.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <linux/rtc.h> | 20 | #include <linux/rtc.h> |
21 | #include <linux/platform_device.h> | ||
21 | 22 | ||
22 | #include <asm/machdep.h> | 23 | #include <asm/machdep.h> |
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
@@ -159,3 +160,20 @@ int do_settimeofday(struct timespec *tv) | |||
159 | } | 160 | } |
160 | 161 | ||
161 | EXPORT_SYMBOL(do_settimeofday); | 162 | EXPORT_SYMBOL(do_settimeofday); |
163 | |||
164 | |||
165 | static int __init rtc_init(void) | ||
166 | { | ||
167 | struct platform_device *pdev; | ||
168 | |||
169 | if (!mach_hwclk) | ||
170 | return -ENODEV; | ||
171 | |||
172 | pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); | ||
173 | if (IS_ERR(pdev)) | ||
174 | return PTR_ERR(pdev); | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
179 | module_init(rtc_init); | ||
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 13df5133020a..5aab5b917c8b 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -692,7 +692,7 @@ config RTC_DRV_GENERIC | |||
692 | tristate "Generic RTC support" | 692 | tristate "Generic RTC support" |
693 | # Please consider writing a new RTC driver instead of using the generic | 693 | # Please consider writing a new RTC driver instead of using the generic |
694 | # RTC abstraction | 694 | # RTC abstraction |
695 | depends on PARISC | 695 | depends on PARISC || M68K |
696 | help | 696 | help |
697 | Say Y or M here to enable RTC support on systems using the generic | 697 | Say Y or M here to enable RTC support on systems using the generic |
698 | RTC abstraction. If you do not know what you are doing, you should | 698 | RTC abstraction. If you do not know what you are doing, you should |