diff options
author | Adrian Bunk <bunk@kernel.org> | 2008-08-31 23:59:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-31 23:59:37 -0400 |
commit | 5110bd21b8af4199b8332c0ab0b23367556653d3 (patch) | |
tree | fcd655bb454ee7b0382aa200d9a2e160465ac6ae /arch/sparc/kernel/time.c | |
parent | b69416b51be0757c82f1c5a0a3f0995a4484dab4 (diff) |
sparc: remove CONFIG_SUN4
While doing some easy cleanups on the sparc code I noticed that the
CONFIG_SUN4 code seems to be worse than the rest - there were some
"I don't know how it should work, but the current code definitely cannot
work." places.
And while I have seen people running Linux on machines like a
SPARCstation 5 a few years ago I don't recall having seen sun4
machines, even less ones running Linux.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/time.c')
-rw-r--r-- | arch/sparc/kernel/time.c | 162 |
1 files changed, 1 insertions, 161 deletions
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c index 339c4762fbcf..f0a2874b04e9 100644 --- a/arch/sparc/kernel/time.c +++ b/arch/sparc/kernel/time.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | #include <asm/idprom.h> | 40 | #include <asm/idprom.h> |
41 | #include <asm/machines.h> | 41 | #include <asm/machines.h> |
42 | #include <asm/sun4paddr.h> | ||
43 | #include <asm/page.h> | 42 | #include <asm/page.h> |
44 | #include <asm/pcic.h> | 43 | #include <asm/pcic.h> |
45 | #include <asm/irq_regs.h> | 44 | #include <asm/irq_regs.h> |
@@ -54,27 +53,6 @@ static struct mostek48t08 __iomem *mstk48t08_regs = NULL; | |||
54 | static int set_rtc_mmss(unsigned long); | 53 | static int set_rtc_mmss(unsigned long); |
55 | static int sbus_do_settimeofday(struct timespec *tv); | 54 | static int sbus_do_settimeofday(struct timespec *tv); |
56 | 55 | ||
57 | #ifdef CONFIG_SUN4 | ||
58 | struct intersil *intersil_clock; | ||
59 | #define intersil_cmd(intersil_reg, intsil_cmd) intersil_reg->int_cmd_reg = \ | ||
60 | (intsil_cmd) | ||
61 | |||
62 | #define intersil_intr(intersil_reg, intsil_cmd) intersil_reg->int_intr_reg = \ | ||
63 | (intsil_cmd) | ||
64 | |||
65 | #define intersil_start(intersil_reg) intersil_cmd(intersil_reg, \ | ||
66 | ( INTERSIL_START | INTERSIL_32K | INTERSIL_NORMAL | INTERSIL_24H |\ | ||
67 | INTERSIL_INTR_ENABLE)) | ||
68 | |||
69 | #define intersil_stop(intersil_reg) intersil_cmd(intersil_reg, \ | ||
70 | ( INTERSIL_STOP | INTERSIL_32K | INTERSIL_NORMAL | INTERSIL_24H |\ | ||
71 | INTERSIL_INTR_ENABLE)) | ||
72 | |||
73 | #define intersil_read_intr(intersil_reg, towhere) towhere = \ | ||
74 | intersil_reg->int_intr_reg | ||
75 | |||
76 | #endif | ||
77 | |||
78 | unsigned long profile_pc(struct pt_regs *regs) | 56 | unsigned long profile_pc(struct pt_regs *regs) |
79 | { | 57 | { |
80 | extern char __copy_user_begin[], __copy_user_end[]; | 58 | extern char __copy_user_begin[], __copy_user_end[]; |
@@ -117,15 +95,7 @@ static irqreturn_t timer_interrupt(int dummy, void *dev_id) | |||
117 | 95 | ||
118 | /* Protect counter clear so that do_gettimeoffset works */ | 96 | /* Protect counter clear so that do_gettimeoffset works */ |
119 | write_seqlock(&xtime_lock); | 97 | write_seqlock(&xtime_lock); |
120 | #ifdef CONFIG_SUN4 | 98 | |
121 | if((idprom->id_machtype == (SM_SUN4 | SM_4_260)) || | ||
122 | (idprom->id_machtype == (SM_SUN4 | SM_4_110))) { | ||
123 | int temp; | ||
124 | intersil_read_intr(intersil_clock, temp); | ||
125 | /* re-enable the irq */ | ||
126 | enable_pil_irq(10); | ||
127 | } | ||
128 | #endif | ||
129 | clear_clock_irq(); | 99 | clear_clock_irq(); |
130 | 100 | ||
131 | do_timer(1); | 101 | do_timer(1); |
@@ -250,55 +220,6 @@ static void __devinit mostek_set_system_time(void) | |||
250 | spin_unlock_irq(&mostek_lock); | 220 | spin_unlock_irq(&mostek_lock); |
251 | } | 221 | } |
252 | 222 | ||
253 | /* Probe for the real time clock chip on Sun4 */ | ||
254 | static inline void sun4_clock_probe(void) | ||
255 | { | ||
256 | #ifdef CONFIG_SUN4 | ||
257 | int temp; | ||
258 | struct resource r; | ||
259 | |||
260 | memset(&r, 0, sizeof(r)); | ||
261 | if( idprom->id_machtype == (SM_SUN4 | SM_4_330) ) { | ||
262 | sp_clock_typ = MSTK48T02; | ||
263 | r.start = sun4_clock_physaddr; | ||
264 | mstk48t02_regs = of_ioremap(&r, 0, | ||
265 | sizeof(struct mostek48t02), NULL); | ||
266 | mstk48t08_regs = NULL; /* To catch weirdness */ | ||
267 | intersil_clock = NULL; /* just in case */ | ||
268 | |||
269 | /* Kick start the clock if it is completely stopped. */ | ||
270 | if (mostek_read(mstk48t02_regs + MOSTEK_SEC) & MSTK_STOP) | ||
271 | kick_start_clock(); | ||
272 | } else if( idprom->id_machtype == (SM_SUN4 | SM_4_260)) { | ||
273 | /* intersil setup code */ | ||
274 | printk("Clock: INTERSIL at %8x ",sun4_clock_physaddr); | ||
275 | sp_clock_typ = INTERSIL; | ||
276 | r.start = sun4_clock_physaddr; | ||
277 | intersil_clock = (struct intersil *) | ||
278 | of_ioremap(&r, 0, sizeof(*intersil_clock), "intersil"); | ||
279 | mstk48t02_regs = 0; /* just be sure */ | ||
280 | mstk48t08_regs = NULL; /* ditto */ | ||
281 | /* initialise the clock */ | ||
282 | |||
283 | intersil_intr(intersil_clock,INTERSIL_INT_100HZ); | ||
284 | |||
285 | intersil_start(intersil_clock); | ||
286 | |||
287 | intersil_read_intr(intersil_clock, temp); | ||
288 | while (!(temp & 0x80)) | ||
289 | intersil_read_intr(intersil_clock, temp); | ||
290 | |||
291 | intersil_read_intr(intersil_clock, temp); | ||
292 | while (!(temp & 0x80)) | ||
293 | intersil_read_intr(intersil_clock, temp); | ||
294 | |||
295 | intersil_stop(intersil_clock); | ||
296 | |||
297 | } | ||
298 | #endif | ||
299 | } | ||
300 | |||
301 | #ifndef CONFIG_SUN4 | ||
302 | static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match) | 223 | static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match) |
303 | { | 224 | { |
304 | struct device_node *dp = op->node; | 225 | struct device_node *dp = op->node; |
@@ -365,7 +286,6 @@ static int __init clock_init(void) | |||
365 | * need to see the clock registers. | 286 | * need to see the clock registers. |
366 | */ | 287 | */ |
367 | fs_initcall(clock_init); | 288 | fs_initcall(clock_init); |
368 | #endif /* !CONFIG_SUN4 */ | ||
369 | 289 | ||
370 | static void __init sbus_time_init(void) | 290 | static void __init sbus_time_init(void) |
371 | { | 291 | { |
@@ -373,51 +293,8 @@ static void __init sbus_time_init(void) | |||
373 | BTFIXUPSET_CALL(bus_do_settimeofday, sbus_do_settimeofday, BTFIXUPCALL_NORM); | 293 | BTFIXUPSET_CALL(bus_do_settimeofday, sbus_do_settimeofday, BTFIXUPCALL_NORM); |
374 | btfixup(); | 294 | btfixup(); |
375 | 295 | ||
376 | if (ARCH_SUN4) | ||
377 | sun4_clock_probe(); | ||
378 | |||
379 | sparc_init_timers(timer_interrupt); | 296 | sparc_init_timers(timer_interrupt); |
380 | 297 | ||
381 | #ifdef CONFIG_SUN4 | ||
382 | if(idprom->id_machtype == (SM_SUN4 | SM_4_330)) { | ||
383 | mostek_set_system_time(); | ||
384 | } else if(idprom->id_machtype == (SM_SUN4 | SM_4_260) ) { | ||
385 | /* initialise the intersil on sun4 */ | ||
386 | unsigned int year, mon, day, hour, min, sec; | ||
387 | int temp; | ||
388 | struct intersil *iregs; | ||
389 | |||
390 | iregs=intersil_clock; | ||
391 | if(!iregs) { | ||
392 | prom_printf("Something wrong, clock regs not mapped yet.\n"); | ||
393 | prom_halt(); | ||
394 | } | ||
395 | |||
396 | intersil_intr(intersil_clock,INTERSIL_INT_100HZ); | ||
397 | disable_pil_irq(10); | ||
398 | intersil_stop(iregs); | ||
399 | intersil_read_intr(intersil_clock, temp); | ||
400 | |||
401 | temp = iregs->clk.int_csec; | ||
402 | |||
403 | sec = iregs->clk.int_sec; | ||
404 | min = iregs->clk.int_min; | ||
405 | hour = iregs->clk.int_hour; | ||
406 | day = iregs->clk.int_day; | ||
407 | mon = iregs->clk.int_month; | ||
408 | year = MSTK_CVT_YEAR(iregs->clk.int_year); | ||
409 | |||
410 | enable_pil_irq(10); | ||
411 | intersil_start(iregs); | ||
412 | |||
413 | xtime.tv_sec = mktime(year, mon, day, hour, min, sec); | ||
414 | xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); | ||
415 | set_normalized_timespec(&wall_to_monotonic, | ||
416 | -xtime.tv_sec, -xtime.tv_nsec); | ||
417 | printk("%u/%u/%u %u:%u:%u\n",day,mon,year,hour,min,sec); | ||
418 | } | ||
419 | #endif | ||
420 | |||
421 | /* Now that OBP ticker has been silenced, it is safe to enable IRQ. */ | 298 | /* Now that OBP ticker has been silenced, it is safe to enable IRQ. */ |
422 | local_irq_enable(); | 299 | local_irq_enable(); |
423 | } | 300 | } |
@@ -532,43 +409,6 @@ static int set_rtc_mmss(unsigned long nowtime) | |||
532 | int real_seconds, real_minutes, mostek_minutes; | 409 | int real_seconds, real_minutes, mostek_minutes; |
533 | struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs; | 410 | struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs; |
534 | unsigned long flags; | 411 | unsigned long flags; |
535 | #ifdef CONFIG_SUN4 | ||
536 | struct intersil *iregs = intersil_clock; | ||
537 | int temp; | ||
538 | #endif | ||
539 | |||
540 | /* Not having a register set can lead to trouble. */ | ||
541 | if (!regs) { | ||
542 | #ifdef CONFIG_SUN4 | ||
543 | if(!iregs) | ||
544 | return -1; | ||
545 | else { | ||
546 | temp = iregs->clk.int_csec; | ||
547 | |||
548 | mostek_minutes = iregs->clk.int_min; | ||
549 | |||
550 | real_seconds = nowtime % 60; | ||
551 | real_minutes = nowtime / 60; | ||
552 | if (((abs(real_minutes - mostek_minutes) + 15)/30) & 1) | ||
553 | real_minutes += 30; /* correct for half hour time zone */ | ||
554 | real_minutes %= 60; | ||
555 | |||
556 | if (abs(real_minutes - mostek_minutes) < 30) { | ||
557 | intersil_stop(iregs); | ||
558 | iregs->clk.int_sec=real_seconds; | ||
559 | iregs->clk.int_min=real_minutes; | ||
560 | intersil_start(iregs); | ||
561 | } else { | ||
562 | printk(KERN_WARNING | ||
563 | "set_rtc_mmss: can't update from %d to %d\n", | ||
564 | mostek_minutes, real_minutes); | ||
565 | return -1; | ||
566 | } | ||
567 | |||
568 | return 0; | ||
569 | } | ||
570 | #endif | ||
571 | } | ||
572 | 412 | ||
573 | spin_lock_irqsave(&mostek_lock, flags); | 413 | spin_lock_irqsave(&mostek_lock, flags); |
574 | /* Read the current RTC minutes. */ | 414 | /* Read the current RTC minutes. */ |