summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-07-28 19:24:38 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-28 19:24:38 -0700
commit9d22e6d7ad50472da399a500bf039e7718a6cdc9 (patch)
treee3b69a31ca755d33ec86e52bbac5e883c59d6daf /arch
parent159099dc3d501f8a39a169125c476f9b25182610 (diff)
parent93853fd0d492524e9172297d8e8b8364dc2c4c59 (diff)
downloadop-kernel-dev-9d22e6d7ad50472da399a500bf039e7718a6cdc9.zip
op-kernel-dev-9d22e6d7ad50472da399a500bf039e7718a6cdc9.tar.gz
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6: [SUNLANCE]: fix compilation on sparc-UP [SPARC]: Defer clock_probe to fs_initcall() [SPARC64]: Fix typo in pgprot_noncached(). [SPARC64]: Fix quad-float multiply emulation.
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/kernel/time.c74
1 files changed, 42 insertions, 32 deletions
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 04eb1ea..845081b0 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -225,6 +225,32 @@ static __inline__ int has_low_battery(void)
return (data1 == data2); /* Was the write blocked? */
}
+static void __init mostek_set_system_time(void)
+{
+ unsigned int year, mon, day, hour, min, sec;
+ struct mostek48t02 *mregs;
+
+ mregs = (struct mostek48t02 *)mstk48t02_regs;
+ if(!mregs) {
+ prom_printf("Something wrong, clock regs not mapped yet.\n");
+ prom_halt();
+ }
+ spin_lock_irq(&mostek_lock);
+ mregs->creg |= MSTK_CREG_READ;
+ sec = MSTK_REG_SEC(mregs);
+ min = MSTK_REG_MIN(mregs);
+ hour = MSTK_REG_HOUR(mregs);
+ day = MSTK_REG_DOM(mregs);
+ mon = MSTK_REG_MONTH(mregs);
+ year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) );
+ xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
+ xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
+ set_normalized_timespec(&wall_to_monotonic,
+ -xtime.tv_sec, -xtime.tv_nsec);
+ mregs->creg &= ~MSTK_CREG_READ;
+ spin_unlock_irq(&mostek_lock);
+}
+
/* Probe for the real time clock chip on Sun4 */
static __inline__ void sun4_clock_probe(void)
{
@@ -273,6 +299,7 @@ static __inline__ void sun4_clock_probe(void)
#endif
}
+#ifndef CONFIG_SUN4
static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match)
{
struct device_node *dp = op->node;
@@ -307,6 +334,8 @@ static int __devinit clock_probe(struct of_device *op, const struct of_device_id
if (mostek_read(mstk48t02_regs + MOSTEK_SEC) & MSTK_STOP)
kick_start_clock();
+ mostek_set_system_time();
+
return 0;
}
@@ -325,56 +354,37 @@ static struct of_platform_driver clock_driver = {
/* Probe for the mostek real time clock chip. */
-static void clock_init(void)
+static int __init clock_init(void)
{
- of_register_driver(&clock_driver, &of_bus_type);
+ return of_register_driver(&clock_driver, &of_bus_type);
}
+/* Must be after subsys_initcall() so that busses are probed. Must
+ * be before device_initcall() because things like the RTC driver
+ * need to see the clock registers.
+ */
+fs_initcall(clock_init);
+#endif /* !CONFIG_SUN4 */
+
void __init sbus_time_init(void)
{
- unsigned int year, mon, day, hour, min, sec;
- struct mostek48t02 *mregs;
-
-#ifdef CONFIG_SUN4
- int temp;
- struct intersil *iregs;
-#endif
BTFIXUPSET_CALL(bus_do_settimeofday, sbus_do_settimeofday, BTFIXUPCALL_NORM);
btfixup();
if (ARCH_SUN4)
sun4_clock_probe();
- else
- clock_init();
sparc_init_timers(timer_interrupt);
#ifdef CONFIG_SUN4
if(idprom->id_machtype == (SM_SUN4 | SM_4_330)) {
-#endif
- mregs = (struct mostek48t02 *)mstk48t02_regs;
- if(!mregs) {
- prom_printf("Something wrong, clock regs not mapped yet.\n");
- prom_halt();
- }
- spin_lock_irq(&mostek_lock);
- mregs->creg |= MSTK_CREG_READ;
- sec = MSTK_REG_SEC(mregs);
- min = MSTK_REG_MIN(mregs);
- hour = MSTK_REG_HOUR(mregs);
- day = MSTK_REG_DOM(mregs);
- mon = MSTK_REG_MONTH(mregs);
- year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) );
- xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
- xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
- set_normalized_timespec(&wall_to_monotonic,
- -xtime.tv_sec, -xtime.tv_nsec);
- mregs->creg &= ~MSTK_CREG_READ;
- spin_unlock_irq(&mostek_lock);
-#ifdef CONFIG_SUN4
+ mostek_set_system_time();
} else if(idprom->id_machtype == (SM_SUN4 | SM_4_260) ) {
/* initialise the intersil on sun4 */
+ unsigned int year, mon, day, hour, min, sec;
+ int temp;
+ struct intersil *iregs;
iregs=intersil_clock;
if(!iregs) {
OpenPOWER on IntegriCloud