aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/boards/dreamcast/rtc.c4
-rw-r--r--arch/sh/boards/landisk/rtc.c17
-rw-r--r--arch/sh/boards/mpc1211/rtc.c4
-rw-r--r--arch/sh/boards/sh03/rtc.c9
-rw-r--r--arch/sh/boards/snapgear/rtc.c8
-rw-r--r--arch/sh/kernel/time.c14
-rw-r--r--arch/sh/kernel/timers/timer-tmu.c6
-rw-r--r--include/asm-sh/rtc.h4
8 files changed, 28 insertions, 38 deletions
diff --git a/arch/sh/boards/dreamcast/rtc.c b/arch/sh/boards/dreamcast/rtc.c
index 44420494dc22..b3a876a3b859 100644
--- a/arch/sh/boards/dreamcast/rtc.c
+++ b/arch/sh/boards/dreamcast/rtc.c
@@ -75,7 +75,7 @@ int aica_rtc_settimeofday(const time_t secs)
75 75
76void aica_time_init(void) 76void aica_time_init(void)
77{ 77{
78 rtc_get_time = aica_rtc_gettimeofday; 78 rtc_sh_get_time = aica_rtc_gettimeofday;
79 rtc_set_time = aica_rtc_settimeofday; 79 rtc_sh_set_time = aica_rtc_settimeofday;
80} 80}
81 81
diff --git a/arch/sh/boards/landisk/rtc.c b/arch/sh/boards/landisk/rtc.c
index d666aa63303f..35ba726a0979 100644
--- a/arch/sh/boards/landisk/rtc.c
+++ b/arch/sh/boards/landisk/rtc.c
@@ -16,17 +16,9 @@
16#include <linux/time.h> 16#include <linux/time.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/bcd.h>
20#include <asm/rtc.h>
19 21
20#ifndef BCD_TO_BIN
21#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
22#endif
23
24#ifndef BIN_TO_BCD
25#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
26#endif
27
28extern void (*rtc_get_time) (struct timespec *);
29extern int (*rtc_set_time) (const time_t);
30extern spinlock_t rtc_lock; 22extern spinlock_t rtc_lock;
31 23
32extern void 24extern void
@@ -94,9 +86,8 @@ int landisk_rtc_settimeofday(const time_t secs)
94 return retval; 86 return retval;
95} 87}
96 88
97
98void landisk_time_init(void) 89void landisk_time_init(void)
99{ 90{
100 rtc_get_time = landisk_rtc_gettimeofday; 91 rtc_sh_get_time = landisk_rtc_gettimeofday;
101 rtc_set_time = landisk_rtc_settimeofday; 92 rtc_sh_set_time = landisk_rtc_settimeofday;
102} 93}
diff --git a/arch/sh/boards/mpc1211/rtc.c b/arch/sh/boards/mpc1211/rtc.c
index a76c655dceee..03b123a4bba4 100644
--- a/arch/sh/boards/mpc1211/rtc.c
+++ b/arch/sh/boards/mpc1211/rtc.c
@@ -130,7 +130,7 @@ int mpc1211_rtc_settimeofday(const struct timeval *tv)
130 130
131void mpc1211_time_init(void) 131void mpc1211_time_init(void)
132{ 132{
133 rtc_get_time = mpc1211_rtc_gettimeofday; 133 rtc_sh_get_time = mpc1211_rtc_gettimeofday;
134 rtc_set_time = mpc1211_rtc_settimeofday; 134 rtc_sh_set_time = mpc1211_rtc_settimeofday;
135} 135}
136 136
diff --git a/arch/sh/boards/sh03/rtc.c b/arch/sh/boards/sh03/rtc.c
index d609863cfe53..0a9266bb51c5 100644
--- a/arch/sh/boards/sh03/rtc.c
+++ b/arch/sh/boards/sh03/rtc.c
@@ -10,9 +10,10 @@
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12#include <linux/bcd.h> 12#include <linux/bcd.h>
13#include <asm/io.h>
14#include <linux/rtc.h> 13#include <linux/rtc.h>
15#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <asm/io.h>
16#include <asm/rtc.h>
16 17
17#define RTC_BASE 0xb0000000 18#define RTC_BASE 0xb0000000
18#define RTC_SEC1 (RTC_BASE + 0) 19#define RTC_SEC1 (RTC_BASE + 0)
@@ -34,8 +35,6 @@
34#define RTC_BUSY 1 35#define RTC_BUSY 1
35#define RTC_STOP 2 36#define RTC_STOP 2
36 37
37extern void (*rtc_get_time)(struct timespec *);
38extern int (*rtc_set_time)(const time_t);
39extern spinlock_t rtc_lock; 38extern spinlock_t rtc_lock;
40 39
41unsigned long get_cmos_time(void) 40unsigned long get_cmos_time(void)
@@ -128,6 +127,6 @@ int sh03_rtc_settimeofday(const time_t secs)
128 127
129void sh03_time_init(void) 128void sh03_time_init(void)
130{ 129{
131 rtc_get_time = sh03_rtc_gettimeofday; 130 rtc_sh_get_time = sh03_rtc_gettimeofday;
132 rtc_set_time = sh03_rtc_settimeofday; 131 rtc_sh_set_time = sh03_rtc_settimeofday;
133} 132}
diff --git a/arch/sh/boards/snapgear/rtc.c b/arch/sh/boards/snapgear/rtc.c
index 287bc4ed3ac7..722479deb55a 100644
--- a/arch/sh/boards/snapgear/rtc.c
+++ b/arch/sh/boards/snapgear/rtc.c
@@ -165,11 +165,11 @@ void __init secureedge5410_rtc_init(void)
165 } 165 }
166 166
167 if (use_ds1302) { 167 if (use_ds1302) {
168 rtc_get_time = snapgear_rtc_gettimeofday; 168 rtc_sh_get_time = snapgear_rtc_gettimeofday;
169 rtc_set_time = snapgear_rtc_settimeofday; 169 rtc_sh_set_time = snapgear_rtc_settimeofday;
170 } else { 170 } else {
171 rtc_get_time = sh_rtc_gettimeofday; 171 rtc_sh_get_time = sh_rtc_gettimeofday;
172 rtc_set_time = sh_rtc_settimeofday; 172 rtc_sh_set_time = sh_rtc_settimeofday;
173 } 173 }
174 174
175 printk("SnapGear RTC: using %s rtc.\n", use_ds1302 ? "ds1302" : "internal"); 175 printk("SnapGear RTC: using %s rtc.\n", use_ds1302 ? "ds1302" : "internal");
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index c8db6ca4f9d1..8acd70bffe76 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -29,11 +29,11 @@ EXPORT_SYMBOL(rtc_lock);
29/* XXX: Can we initialize this in a routine somewhere? Dreamcast doesn't want 29/* XXX: Can we initialize this in a routine somewhere? Dreamcast doesn't want
30 * these routines anywhere... */ 30 * these routines anywhere... */
31#ifdef CONFIG_SH_RTC 31#ifdef CONFIG_SH_RTC
32void (*rtc_get_time)(struct timespec *) = sh_rtc_gettimeofday; 32void (*rtc_sh_get_time)(struct timespec *) = sh_rtc_gettimeofday;
33int (*rtc_set_time)(const time_t) = sh_rtc_settimeofday; 33int (*rtc_sh_set_time)(const time_t) = sh_rtc_settimeofday;
34#else 34#else
35void (*rtc_get_time)(struct timespec *); 35void (*rtc_sh_get_time)(struct timespec *);
36int (*rtc_set_time)(const time_t); 36int (*rtc_sh_set_time)(const time_t);
37#endif 37#endif
38 38
39/* 39/*
@@ -135,7 +135,7 @@ void handle_timer_tick(struct pt_regs *regs)
135 xtime.tv_sec > last_rtc_update + 660 && 135 xtime.tv_sec > last_rtc_update + 660 &&
136 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 136 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
137 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 137 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
138 if (rtc_set_time(xtime.tv_sec) == 0) 138 if (rtc_sh_set_time(xtime.tv_sec) == 0)
139 last_rtc_update = xtime.tv_sec; 139 last_rtc_update = xtime.tv_sec;
140 else 140 else
141 /* do it again in 60s */ 141 /* do it again in 60s */
@@ -193,8 +193,8 @@ void __init time_init(void)
193 193
194 clk_init(); 194 clk_init();
195 195
196 if (rtc_get_time) { 196 if (rtc_sh_get_time) {
197 rtc_get_time(&xtime); 197 rtc_sh_get_time(&xtime);
198 } else { 198 } else {
199 xtime.tv_sec = mktime(2000, 1, 1, 0, 0, 0); 199 xtime.tv_sec = mktime(2000, 1, 1, 0, 0, 0);
200 xtime.tv_nsec = 0; 200 xtime.tv_nsec = 0;
diff --git a/arch/sh/kernel/timers/timer-tmu.c b/arch/sh/kernel/timers/timer-tmu.c
index ea4bdf8cdf0d..205816fcf0da 100644
--- a/arch/sh/kernel/timers/timer-tmu.c
+++ b/arch/sh/kernel/timers/timer-tmu.c
@@ -132,17 +132,17 @@ static unsigned long tmu_timer_get_frequency(void)
132 ctrl_outl(0xffffffff, TMU0_TCOR); 132 ctrl_outl(0xffffffff, TMU0_TCOR);
133 ctrl_outl(0xffffffff, TMU0_TCNT); 133 ctrl_outl(0xffffffff, TMU0_TCNT);
134 134
135 rtc_get_time(&ts2); 135 rtc_sh_get_time(&ts2);
136 136
137 do { 137 do {
138 rtc_get_time(&ts1); 138 rtc_sh_get_time(&ts1);
139 } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec); 139 } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec);
140 140
141 /* actually start the timer */ 141 /* actually start the timer */
142 ctrl_outb(TMU_TSTR_INIT, TMU_TSTR); 142 ctrl_outb(TMU_TSTR_INIT, TMU_TSTR);
143 143
144 do { 144 do {
145 rtc_get_time(&ts2); 145 rtc_sh_get_time(&ts2);
146 } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec); 146 } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec);
147 147
148 freq = 0xffffffff - ctrl_inl(TMU0_TCNT); 148 freq = 0xffffffff - ctrl_inl(TMU0_TCNT);
diff --git a/include/asm-sh/rtc.h b/include/asm-sh/rtc.h
index cea9cdf9b925..4c7be859c9c0 100644
--- a/include/asm-sh/rtc.h
+++ b/include/asm-sh/rtc.h
@@ -8,8 +8,8 @@
8extern void sh_rtc_gettimeofday(struct timespec *ts); 8extern void sh_rtc_gettimeofday(struct timespec *ts);
9extern int sh_rtc_settimeofday(const time_t secs); 9extern int sh_rtc_settimeofday(const time_t secs);
10extern void (*board_time_init)(void); 10extern void (*board_time_init)(void);
11extern void (*rtc_get_time)(struct timespec *); 11extern void (*rtc_sh_get_time)(struct timespec *);
12extern int (*rtc_set_time)(const time_t); 12extern int (*rtc_sh_set_time)(const time_t);
13 13
14/* RCR1 Bits */ 14/* RCR1 Bits */
15#define RCR1_CF 0x80 /* Carry Flag */ 15#define RCR1_CF 0x80 /* Carry Flag */