aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/snapgear/rtc.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/arch/sh/boards/snapgear/rtc.c b/arch/sh/boards/snapgear/rtc.c
index 722479deb55a..1659fdd6695a 100644
--- a/arch/sh/boards/snapgear/rtc.c
+++ b/arch/sh/boards/snapgear/rtc.c
@@ -19,9 +19,7 @@
19#include <linux/mc146818rtc.h> 19#include <linux/mc146818rtc.h>
20#include <asm/io.h> 20#include <asm/io.h>
21 21
22/****************************************************************************/ 22static int use_ds1302;
23
24static int use_ds1302 = 0;
25 23
26/****************************************************************************/ 24/****************************************************************************/
27/* 25/*
@@ -79,10 +77,6 @@ static unsigned int ds1302_readbyte(unsigned int addr)
79 unsigned int val; 77 unsigned int val;
80 unsigned long flags; 78 unsigned long flags;
81 79
82#if 0
83 printk("SnapGear RTC: ds1302_readbyte(addr=%x)\n", addr);
84#endif
85
86 local_irq_save(flags); 80 local_irq_save(flags);
87 set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK); 81 set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
88 set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK)); 82 set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));
@@ -101,10 +95,6 @@ static void ds1302_writebyte(unsigned int addr, unsigned int val)
101{ 95{
102 unsigned long flags; 96 unsigned long flags;
103 97
104#if 0
105 printk("SnapGear RTC: ds1302_writebyte(addr=%x)\n", addr);
106#endif
107
108 local_irq_save(flags); 98 local_irq_save(flags);
109 set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK); 99 set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
110 set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK)); 100 set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));
@@ -167,9 +157,6 @@ void __init secureedge5410_rtc_init(void)
167 if (use_ds1302) { 157 if (use_ds1302) {
168 rtc_sh_get_time = snapgear_rtc_gettimeofday; 158 rtc_sh_get_time = snapgear_rtc_gettimeofday;
169 rtc_sh_set_time = snapgear_rtc_settimeofday; 159 rtc_sh_set_time = snapgear_rtc_settimeofday;
170 } else {
171 rtc_sh_get_time = sh_rtc_gettimeofday;
172 rtc_sh_set_time = sh_rtc_settimeofday;
173 } 160 }
174 161
175 printk("SnapGear RTC: using %s rtc.\n", use_ds1302 ? "ds1302" : "internal"); 162 printk("SnapGear RTC: using %s rtc.\n", use_ds1302 ? "ds1302" : "internal");
@@ -184,10 +171,8 @@ void snapgear_rtc_gettimeofday(struct timespec *ts)
184{ 171{
185 unsigned int sec, min, hr, day, mon, yr; 172 unsigned int sec, min, hr, day, mon, yr;
186 173
187 if (!use_ds1302) { 174 if (!use_ds1302)
188 sh_rtc_gettimeofday(ts);
189 return; 175 return;
190 }
191 176
192 sec = bcd2int(ds1302_readbyte(RTC_ADDR_SEC)); 177 sec = bcd2int(ds1302_readbyte(RTC_ADDR_SEC));
193 min = bcd2int(ds1302_readbyte(RTC_ADDR_MIN)); 178 min = bcd2int(ds1302_readbyte(RTC_ADDR_MIN));
@@ -228,7 +213,7 @@ int snapgear_rtc_settimeofday(const time_t secs)
228 unsigned long nowtime; 213 unsigned long nowtime;
229 214
230 if (!use_ds1302) 215 if (!use_ds1302)
231 return sh_rtc_settimeofday(secs); 216 return 0;
232 217
233/* 218/*
234 * This is called direct from the kernel timer handling code. 219 * This is called direct from the kernel timer handling code.
@@ -237,10 +222,6 @@ int snapgear_rtc_settimeofday(const time_t secs)
237 222
238 nowtime = secs; 223 nowtime = secs;
239 224
240#if 1
241 printk("SnapGear RTC: snapgear_rtc_settimeofday(nowtime=%ld)\n", nowtime);
242#endif
243
244 /* STOP RTC */ 225 /* STOP RTC */
245 ds1302_writebyte(RTC_ADDR_SEC, ds1302_readbyte(RTC_ADDR_SEC) | 0x80); 226 ds1302_writebyte(RTC_ADDR_SEC, ds1302_readbyte(RTC_ADDR_SEC) | 0x80);
246 227
@@ -326,5 +307,3 @@ void secureedge5410_cmos_write(unsigned char val, int addr)
326 default: break; 307 default: break;
327 } 308 }
328} 309}
329
330/****************************************************************************/