aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lasat
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-10-11 18:46:08 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-10-11 18:46:08 -0400
commit4b550488f894c899aa54dc935c8fee47bca2b7df (patch)
treef7ee1d0ff80542124b5fa864a30022277d703c49 /arch/mips/lasat
parentf5ff0a280201c9cbfb6e9eb4bafdb465c2269ed3 (diff)
[MIPS] Deforest the function pointer jungle in the time code.
Hard to follow who is pointing what to where and why so it's simply getting in the way of the time code renovation. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lasat')
-rw-r--r--arch/mips/lasat/ds1603.c6
-rw-r--r--arch/mips/lasat/ds1603.h2
-rw-r--r--arch/mips/lasat/setup.c6
-rw-r--r--arch/mips/lasat/sysctl.c10
4 files changed, 10 insertions, 14 deletions
diff --git a/arch/mips/lasat/ds1603.c b/arch/mips/lasat/ds1603.c
index 0b315f51d62c..52cb1436a12a 100644
--- a/arch/mips/lasat/ds1603.c
+++ b/arch/mips/lasat/ds1603.c
@@ -135,8 +135,7 @@ static void rtc_end_op(void)
135 lasat_ndelay(1000); 135 lasat_ndelay(1000);
136} 136}
137 137
138/* interface */ 138unsigned long read_persistent_clock(void)
139unsigned long ds1603_read(void)
140{ 139{
141 unsigned long word; 140 unsigned long word;
142 unsigned long flags; 141 unsigned long flags;
@@ -147,10 +146,11 @@ unsigned long ds1603_read(void)
147 word = rtc_read_word(); 146 word = rtc_read_word();
148 rtc_end_op(); 147 rtc_end_op();
149 spin_unlock_irqrestore(&rtc_lock, flags); 148 spin_unlock_irqrestore(&rtc_lock, flags);
149
150 return word; 150 return word;
151} 151}
152 152
153int ds1603_set(unsigned long time) 153int rtc_mips_set_mmss(unsigned long time)
154{ 154{
155 unsigned long flags; 155 unsigned long flags;
156 156
diff --git a/arch/mips/lasat/ds1603.h b/arch/mips/lasat/ds1603.h
index c2e5c76a379d..2da3704044fd 100644
--- a/arch/mips/lasat/ds1603.h
+++ b/arch/mips/lasat/ds1603.h
@@ -20,8 +20,6 @@ struct ds_defs {
20 20
21extern struct ds_defs *ds1603; 21extern struct ds_defs *ds1603;
22 22
23unsigned long ds1603_read(void);
24int ds1603_set(unsigned long);
25void ds1603_set_trimmer(unsigned int); 23void ds1603_set_trimmer(unsigned int);
26void ds1603_enable(void); 24void ds1603_enable(void);
27void ds1603_disable(void); 25void ds1603_disable(void);
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
index 187e37821d93..54827d0174bf 100644
--- a/arch/mips/lasat/setup.c
+++ b/arch/mips/lasat/setup.c
@@ -117,7 +117,7 @@ static struct notifier_block lasat_panic_block[] =
117 } 117 }
118}; 118};
119 119
120static void lasat_time_init(void) 120void plat_time_init(void)
121{ 121{
122 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2; 122 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2;
123} 123}
@@ -142,12 +142,8 @@ void __init plat_mem_setup(void)
142 142
143 lasat_reboot_setup(); 143 lasat_reboot_setup();
144 144
145 board_time_init = lasat_time_init;
146
147#ifdef CONFIG_DS1603 145#ifdef CONFIG_DS1603
148 ds1603 = &ds_defs[mips_machtype]; 146 ds1603 = &ds_defs[mips_machtype];
149 rtc_mips_get_time = ds1603_read;
150 rtc_mips_set_time = ds1603_set;
151#endif 147#endif
152 148
153#ifdef DYNAMIC_SERIAL_INIT 149#ifdef DYNAMIC_SERIAL_INIT
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c
index 4575a829766d..389336c4ecc5 100644
--- a/arch/mips/lasat/sysctl.c
+++ b/arch/mips/lasat/sysctl.c
@@ -32,6 +32,8 @@
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33#include <linux/uaccess.h> 33#include <linux/uaccess.h>
34 34
35#include <asm/time.h>
36
35#include "sysctl.h" 37#include "sysctl.h"
36#include "ds1603.h" 38#include "ds1603.h"
37 39
@@ -106,7 +108,7 @@ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp,
106 108
107 mutex_lock(&lasat_info_mutex); 109 mutex_lock(&lasat_info_mutex);
108 if (!write) { 110 if (!write) {
109 rtctmp = ds1603_read(); 111 rtctmp = read_persistent_clock();
110 /* check for time < 0 and set to 0 */ 112 /* check for time < 0 and set to 0 */
111 if (rtctmp < 0) 113 if (rtctmp < 0)
112 rtctmp = 0; 114 rtctmp = 0;
@@ -116,7 +118,7 @@ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp,
116 mutex_unlock(&lasat_info_mutex); 118 mutex_unlock(&lasat_info_mutex);
117 return r; 119 return r;
118 } 120 }
119 ds1603_set(rtctmp); 121 rtc_mips_set_mmss(rtctmp);
120 mutex_unlock(&lasat_info_mutex); 122 mutex_unlock(&lasat_info_mutex);
121 123
122 return 0; 124 return 0;
@@ -152,7 +154,7 @@ int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen,
152 int r; 154 int r;
153 155
154 mutex_lock(&lasat_info_mutex); 156 mutex_lock(&lasat_info_mutex);
155 rtctmp = ds1603_read(); 157 rtctmp = read_persistent_clock();
156 if (rtctmp < 0) 158 if (rtctmp < 0)
157 rtctmp = 0; 159 rtctmp = 0;
158 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen); 160 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);
@@ -161,7 +163,7 @@ int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen,
161 return r; 163 return r;
162 } 164 }
163 if (newval && newlen) 165 if (newval && newlen)
164 ds1603_set(rtctmp); 166 rtc_mips_set_mmss(rtctmp);
165 mutex_unlock(&lasat_info_mutex); 167 mutex_unlock(&lasat_info_mutex);
166 168
167 return 1; 169 return 1;