aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-04-28 04:19:50 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-04-28 05:01:25 -0400
commit8e0b842948156e3463879caed12b4ce51bed772e (patch)
tree0c5e01d3103e886a89e5663ac02552e04472f8d3
parent5b644c7a218702668d7b610994e7dcbc3d4705d3 (diff)
sh: setup timers in late_time_init()
This patch moves the SuperH timer setup code from time_init() to late_time_init(). Good things about this change: - interrupts: they are enabled at late_time_init() - mm: regular kmalloc() can be used at late_time_init() Together with moving to late_time_init() this patch changes the sh_cmt driver to always allocate with kmalloc(). This simplifies the code a bit and also fixes section mismatches. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/kernel/time_32.c34
-rw-r--r--drivers/clocksource/sh_cmt.c13
2 files changed, 22 insertions, 25 deletions
diff --git a/arch/sh/kernel/time_32.c b/arch/sh/kernel/time_32.c
index 109409f5ca53..a2458bfdda26 100644
--- a/arch/sh/kernel/time_32.c
+++ b/arch/sh/kernel/time_32.c
@@ -237,21 +237,8 @@ unsigned long long sched_clock(void)
237} 237}
238#endif 238#endif
239 239
240void __init time_init(void) 240static void __init sh_late_time_init(void)
241{ 241{
242 if (board_time_init)
243 board_time_init();
244
245 clk_init();
246
247 rtc_sh_get_time(&xtime);
248 set_normalized_timespec(&wall_to_monotonic,
249 -xtime.tv_sec, -xtime.tv_nsec);
250
251#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
252 local_timer_setup(smp_processor_id());
253#endif
254
255 /* 242 /*
256 * Make sure all compiled-in early timers register themselves. 243 * Make sure all compiled-in early timers register themselves.
257 * Run probe() for one "earlytimer" device. 244 * Run probe() for one "earlytimer" device.
@@ -270,3 +257,22 @@ void __init time_init(void)
270 257
271 printk(KERN_INFO "Using %s for system timer\n", sys_timer->name); 258 printk(KERN_INFO "Using %s for system timer\n", sys_timer->name);
272} 259}
260
261void __init time_init(void)
262{
263 if (board_time_init)
264 board_time_init();
265
266 clk_init();
267
268 rtc_sh_get_time(&xtime);
269 set_normalized_timespec(&wall_to_monotonic,
270 -xtime.tv_sec, -xtime.tv_nsec);
271
272#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
273 local_timer_setup(smp_processor_id());
274#endif
275
276 late_time_init = sh_late_time_init;
277}
278
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index d607ac2d516b..bf3e4c11fd37 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -18,7 +18,6 @@
18 */ 18 */
19 19
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/bootmem.h>
22#include <linux/platform_device.h> 21#include <linux/platform_device.h>
23#include <linux/spinlock.h> 22#include <linux/spinlock.h>
24#include <linux/interrupt.h> 23#include <linux/interrupt.h>
@@ -645,11 +644,7 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev)
645 return 0; 644 return 0;
646 } 645 }
647 646
648 if (is_early_platform_device(pdev)) 647 p = kmalloc(sizeof(*p), GFP_KERNEL);
649 p = alloc_bootmem(sizeof(*p));
650 else
651 p = kmalloc(sizeof(*p), GFP_KERNEL);
652
653 if (p == NULL) { 648 if (p == NULL) {
654 dev_err(&pdev->dev, "failed to allocate driver data\n"); 649 dev_err(&pdev->dev, "failed to allocate driver data\n");
655 return -ENOMEM; 650 return -ENOMEM;
@@ -657,11 +652,7 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev)
657 652
658 ret = sh_cmt_setup(p, pdev); 653 ret = sh_cmt_setup(p, pdev);
659 if (ret) { 654 if (ret) {
660 if (is_early_platform_device(pdev)) 655 kfree(p);
661 free_bootmem(__pa(p), sizeof(*p));
662 else
663 kfree(p);
664
665 platform_set_drvdata(pdev, NULL); 656 platform_set_drvdata(pdev, NULL);
666 } 657 }
667 return ret; 658 return ret;