aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/Kconfig1
-rw-r--r--arch/sh/include/asm/rtc.h11
-rw-r--r--arch/sh/kernel/time_32.c23
3 files changed, 35 insertions, 0 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 164748945f9..9db02ced57a 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -30,6 +30,7 @@ config SUPERH32
30 select HAVE_DYNAMIC_FTRACE 30 select HAVE_DYNAMIC_FTRACE
31 select HAVE_ARCH_KGDB 31 select HAVE_ARCH_KGDB
32 select ARCH_HIBERNATION_POSSIBLE if MMU 32 select ARCH_HIBERNATION_POSSIBLE if MMU
33 select RTC_LIB
33 34
34config SUPERH64 35config SUPERH64
35 def_bool ARCH = "sh64" 36 def_bool ARCH = "sh64"
diff --git a/arch/sh/include/asm/rtc.h b/arch/sh/include/asm/rtc.h
index f7b010d48af..52b0c2dba97 100644
--- a/arch/sh/include/asm/rtc.h
+++ b/arch/sh/include/asm/rtc.h
@@ -6,6 +6,17 @@ extern void (*board_time_init)(void);
6extern void (*rtc_sh_get_time)(struct timespec *); 6extern void (*rtc_sh_get_time)(struct timespec *);
7extern int (*rtc_sh_set_time)(const time_t); 7extern int (*rtc_sh_set_time)(const time_t);
8 8
9/* some dummy definitions */
10#define RTC_BATT_BAD 0x100 /* battery bad */
11#define RTC_SQWE 0x08 /* enable square-wave output */
12#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
13#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
14#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
15
16struct rtc_time;
17unsigned int get_rtc_time(struct rtc_time *);
18int set_rtc_time(struct rtc_time *);
19
9#define RTC_CAP_4_DIGIT_YEAR (1 << 0) 20#define RTC_CAP_4_DIGIT_YEAR (1 << 0)
10 21
11struct sh_rtc_platform_info { 22struct sh_rtc_platform_info {
diff --git a/arch/sh/kernel/time_32.c b/arch/sh/kernel/time_32.c
index c770413c321..109409f5ca5 100644
--- a/arch/sh/kernel/time_32.c
+++ b/arch/sh/kernel/time_32.c
@@ -19,6 +19,7 @@
19#include <linux/mc146818rtc.h> /* for rtc_lock */ 19#include <linux/mc146818rtc.h> /* for rtc_lock */
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/rtc.h>
22#include <asm/clock.h> 23#include <asm/clock.h>
23#include <asm/rtc.h> 24#include <asm/rtc.h>
24#include <asm/timer.h> 25#include <asm/timer.h>
@@ -45,6 +46,28 @@ static int null_rtc_set_time(const time_t secs)
45void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time; 46void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time;
46int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time; 47int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time;
47 48
49unsigned int get_rtc_time(struct rtc_time *tm)
50{
51 if (rtc_sh_get_time != null_rtc_get_time) {
52 struct timespec tv;
53
54 rtc_sh_get_time(&tv);
55 rtc_time_to_tm(tv.tv_sec, tm);
56 }
57
58 return RTC_24H;
59}
60EXPORT_SYMBOL(get_rtc_time);
61
62int set_rtc_time(struct rtc_time *tm)
63{
64 unsigned long secs;
65
66 rtc_tm_to_time(tm, &secs);
67 return rtc_sh_set_time(secs);
68}
69EXPORT_SYMBOL(set_rtc_time);
70
48#ifndef CONFIG_GENERIC_TIME 71#ifndef CONFIG_GENERIC_TIME
49void do_gettimeofday(struct timeval *tv) 72void do_gettimeofday(struct timeval *tv)
50{ 73{