From patchwork Wed Jun 1 14:03:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 840332 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p51E56qf025214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 1 Jun 2011 14:05:28 GMT Received: from canuck.infradead.org ([134.117.69.58]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRm0V-0006d6-U1; Wed, 01 Jun 2011 14:02:48 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QRm0V-0004lX-FI; Wed, 01 Jun 2011 14:02:47 +0000 Received: from service87.mimecast.com ([94.185.240.25]) by canuck.infradead.org with smtp (Exim 4.76 #1 (Red Hat Linux)) id 1QRm0Q-0004lF-TB for linux-arm-kernel@lists.infradead.org; Wed, 01 Jun 2011 14:02:43 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 01 Jun 2011 15:02:39 +0100 Received: from localhost.localdomain ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 1 Jun 2011 15:02:59 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: local timers: Allow boot CPU to have its timer running early Date: Wed, 1 Jun 2011 15:03:26 +0100 Message-Id: <1306937006-26597-1-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.7.0.4 X-OriginalArrivalTime: 01 Jun 2011 14:02:59.0193 (UTC) FILETIME=[9D215E90:01CC2064] X-MC-Unique: 111060115023901501 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110601_100243_159783_882CBAB7 X-CRM114-Status: GOOD ( 15.01 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [94.185.240.25 listed in list.dnswl.org] Cc: Paul Mundt , Magnus Damm X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Jun 2011 14:05:29 +0000 (UTC) Currently, the boot CPU has its local timer enabled long after the delay loop has been calibrated. This makes it impossible to boot a system that only uses local timers, like the A15. Use late_time_init hook to initialize the boot CPU local timer. Since shmobile is already using this hook, add an ARM specific arm_late_time_init hook that platforms can use instead. Cc: Paul Mundt Cc: Magnus Damm Signed-off-by: Marc Zyngier Acked-by: Paul Mundt --- arch/arm/include/asm/mach/time.h | 1 + arch/arm/kernel/smp.c | 6 ------ arch/arm/kernel/time.c | 14 ++++++++++++++ arch/arm/mach-shmobile/timer.c | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h index d5adaae..f46ca39 100644 --- a/arch/arm/include/asm/mach/time.h +++ b/arch/arm/include/asm/mach/time.h @@ -43,5 +43,6 @@ struct sys_timer { }; extern void timer_tick(void); +extern void (* __initdata arm_late_time_init)(void); #endif diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 344e52b..70badae 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -364,12 +364,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) if (max_cpus > 1) { /* - * Enable the local timer or broadcast device for the - * boot CPU, but only if we have more than one CPU. - */ - percpu_timer_setup(); - - /* * Initialise the SCU if there are more than one CPU * and let them know where to start. */ diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index cb634c3..ba85044 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -147,6 +148,18 @@ static int __init timer_init_syscore_ops(void) device_initcall(timer_init_syscore_ops); +void (* __initdata arm_late_time_init)(void); + +static void __init __arm_late_time_init(void) +{ + if (arm_late_time_init) + arm_late_time_init(); +#ifdef CONFIG_LOCAL_TIMERS + /* Init the local timer on the boot CPU */ + percpu_timer_setup(); +#endif +} + void __init time_init(void) { system_timer = machine_desc->timer; @@ -154,5 +167,6 @@ void __init time_init(void) #ifdef CONFIG_HAVE_SCHED_CLOCK sched_clock_postinit(); #endif + late_time_init = __arm_late_time_init; } diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c index 895794b..835baa4 100644 --- a/arch/arm/mach-shmobile/timer.c +++ b/arch/arm/mach-shmobile/timer.c @@ -38,7 +38,7 @@ static void __init shmobile_late_time_init(void) static void __init shmobile_timer_init(void) { - late_time_init = shmobile_late_time_init; + arm_late_time_init = shmobile_late_time_init; } struct sys_timer shmobile_timer = {