Skip to contentSkip to conversation

sh: arch earlytimer support

PATCH In review Magnus Damm 2 participants 3 messages Apr 15, 2009 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 2/5 sh: arch earlytimer support

From: Magnus Damm <[email protected]>

Extend the 32-bit SuperH timer code to register and probe the earlytimer class of Early Platform Drivers.

This registers the sh_cmt driver if compiled-in.

---

 arch/sh/kernel/time_32.c |    9 +++++++++
 1 file changed, 9 insertions(+)
arch/sh/kernel/time_32.c +9 -0
@@ -17,6 +17,7 @@
 #include <linux/sched.h>
 #include <linux/clockchips.h>
 #include <linux/mc146818rtc.h>	/* for rtc_lock */
+#include <linux/platform_device.h>
 #include <linux/smp.h>
 #include <asm/clock.h>
 #include <asm/rtc.h>
@@ -233,6 +234,14 @@ void __init time_init(void)
 	 * initialized for us.
 	 */
 	sys_timer = get_sys_timer();
+
+	/* Make sure all compiled-in early timers register themselves.
+	 * Run probe() for one "earlytimer" device.
+	 */
+	early_platform_driver_register_all("earlytimer");
+	if (early_platform_driver_probe("earlytimer", 1, 0))
+		return;
+
 	if (unlikely(!sys_timer))
 		panic("System timer missing.\n");
 
#1 lore raw
Quoted 7 lines · Magnus Damm
arch/sh/kernel/time_32.c +1 -0
@@ -233,6 +234,14 @@ void __init time_init(void)
 	 * initialized for us.
 	 */
 	sys_timer = get_sys_timer();
+

arch/sh/kernel/time_32.c void __init time_init(void) · line 247

Quoted 10 lines
arch/sh/kernel/time_32.c +7 -0
+	/* Make sure all compiled-in early timers register themselves.
+	 * Run probe() for one "earlytimer" device.
+	 */
+	early_platform_driver_register_all("earlytimer");
+	if (early_platform_driver_probe("earlytimer", 1, 0))
+		return;
+
 	if (unlikely(!sys_timer))
 		panic("System timer missing.\n");
 

What exactly is the plan for progression from here? If the CMT clocksource and clockevent drivers are filling the role of the old CMT driver, then the sys_timer stuff needs to be isolated. As it is now, platforms that only contain the CMT will still need to use the sys_timer version, especially if they don't have multiple channels.

#2 lore raw
In reply to Magnus Damm
Quoted 15 lines · Paul Mundt
Quoted 14 lines · Magnus Damm
arch/sh/kernel/time_32.c     2009-04-15 16:59:31.000000000 +0900 renamed from arch/sh/kernel/time_32.c +8 -0
@@ -233,6 +234,14 @@ void __init time_init(void)
        * initialized for us.
        */
       sys_timer = get_sys_timer();
+
+     /* Make sure all compiled-in early timers register themselves.
+      * Run probe() for one "earlytimer" device.
+      */
+     early_platform_driver_register_all("earlytimer");
+     if (early_platform_driver_probe("earlytimer", 1, 0))
+             return;
+
Quoted 8 lines

arch/sh/kernel/time_32.c     2009-04-15 16:59:31.000000000 +0900 void __init time_init(void) · line 247

Quoted 3 lines
arch/sh/kernel/time_32.c     2009-04-15 16:59:31.000000000 +0900 renamed from arch/sh/kernel/time_32.c +0 -0
       if (unlikely(!sys_timer))
               panic("System timer missing.\n");
 

What exactly is the plan for progression from here? If the CMT clocksource and clockevent drivers are filling the role of the old CMT driver, then the sys_timer stuff needs to be isolated. As it is now, platforms that only contain the CMT will still need to use the sys_timer version, especially if they don't have multiple channels.

Sorry about the unclear code. So the early platform stuff should be moved up before get_sys_timer(). This way sys_timer will always be NULL if earlytimer is used. I'll resend a new version.

/ magnus