From patchwork Fri Jun 3 14:57:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 847342 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p53F237I026577 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 3 Jun 2011 15:02:26 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QSVsQ-0003xC-Bi; Fri, 03 Jun 2011 15:01:31 +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 1QSVsP-0000b2-Vw; Fri, 03 Jun 2011 15:01:30 +0000 Received: from service87.mimecast.com ([94.185.240.25]) by canuck.infradead.org with smtp (Exim 4.76 #1 (Red Hat Linux)) id 1QSVoW-0007ky-EJ for linux-arm-kernel@lists.infradead.org; Fri, 03 Jun 2011 14:57:32 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Fri, 03 Jun 2011 15:57:26 +0100 Received: from localhost.localdomain ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 3 Jun 2011 15:57:21 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 10/18] ARM: versatile/vexpress: dynamically register local timer setup function Date: Fri, 3 Jun 2011 15:57:25 +0100 Message-Id: <1307113053-30209-11-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1307113053-30209-1-git-send-email-marc.zyngier@arm.com> References: <1307113053-30209-1-git-send-email-marc.zyngier@arm.com> X-OriginalArrivalTime: 03 Jun 2011 14:57:21.0694 (UTC) FILETIME=[8A8F03E0:01CC21FE] X-MC-Unique: 111060315572607501 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110603_105729_022395_00B95363 X-CRM114-Status: GOOD ( 13.00 ) 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] 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 (demeter2.kernel.org [140.211.167.43]); Fri, 03 Jun 2011 15:02:26 +0000 (UTC) Signed-off-by: Marc Zyngier --- arch/arm/mach-realview/realview_eb.c | 4 +++- arch/arm/mach-realview/realview_pb11mp.c | 4 +++- arch/arm/mach-realview/realview_pbx.c | 5 +++-- arch/arm/mach-vexpress/v2m.c | 4 ++++ arch/arm/plat-versatile/include/plat/localtimer.h | 6 ++++++ arch/arm/plat-versatile/localtimer.c | 10 +++++++++- 6 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 arch/arm/plat-versatile/include/plat/localtimer.h diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index 10e75fa..e17e985 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c @@ -45,6 +45,8 @@ #include #include +#include + #include "core.h" static struct map_desc realview_eb_io_desc[] __initdata = { @@ -402,7 +404,7 @@ static void __init realview_eb_timer_init(void) if (core_tile_eb11mp() || core_tile_a9mp()) { #ifdef CONFIG_LOCAL_TIMERS - twd_base = __io_address(REALVIEW_EB11MP_TWD_BASE); + versatile_local_timer_init(__io_address(REALVIEW_EB11MP_TWD_BASE)); #endif timer_irq = IRQ_EB11MP_TIMER0_1; } else diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c index b2985fc..76da67d 100644 --- a/arch/arm/mach-realview/realview_pb11mp.c +++ b/arch/arm/mach-realview/realview_pb11mp.c @@ -46,6 +46,8 @@ #include #include +#include + #include "core.h" static struct map_desc realview_pb11mp_io_desc[] __initdata = { @@ -306,7 +308,7 @@ static void __init realview_pb11mp_timer_init(void) timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20; #ifdef CONFIG_LOCAL_TIMERS - twd_base = __io_address(REALVIEW_TC11MP_TWD_BASE); + versatile_local_timer_init(__io_address(REALVIEW_TC11MP_TWD_BASE)); #endif realview_timer_init(IRQ_TC11MP_TIMER0_1); } diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c index 92ace2c..280befd 100644 --- a/arch/arm/mach-realview/realview_pbx.c +++ b/arch/arm/mach-realview/realview_pbx.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -44,6 +43,8 @@ #include #include +#include + #include "core.h" static struct map_desc realview_pbx_io_desc[] __initdata = { @@ -310,7 +311,7 @@ static void __init realview_pbx_timer_init(void) #ifdef CONFIG_LOCAL_TIMERS if (core_tile_pbx11mp() || core_tile_pbxa9mp()) - twd_base = __io_address(REALVIEW_PBX_TILE_TWD_BASE); + versatile_local_timer_init(__io_address(REALVIEW_PBX_TILE_TWD_BASE)); #endif realview_timer_init(IRQ_PBX_TIMER0_1); } diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index 9e6b93b..3a1497e 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c @@ -28,6 +28,7 @@ #include #include +#include #include "core.h" @@ -50,6 +51,9 @@ static void __init v2m_timer_init(void) { u32 scctrl; + /* twd_base is assigned in the tile code */ + versatile_local_timer_init(NULL); + /* Select 1MHz TIMCLK as the reference clock for SP804 timers */ scctrl = readl(MMIO_P2V(V2M_SYSCTL + SCCTRL)); scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK; diff --git a/arch/arm/plat-versatile/include/plat/localtimer.h b/arch/arm/plat-versatile/include/plat/localtimer.h new file mode 100644 index 0000000..1246fc2 --- /dev/null +++ b/arch/arm/plat-versatile/include/plat/localtimer.h @@ -0,0 +1,6 @@ +#ifndef ARM_PLAT_LOCALTIMER_H +#define ARM_PLAT_LOCALTIMER_H + +void versatile_local_timer_init(void __iomem *base); + +#endif diff --git a/arch/arm/plat-versatile/localtimer.c b/arch/arm/plat-versatile/localtimer.c index a8e8b85..22603a5 100644 --- a/arch/arm/plat-versatile/localtimer.c +++ b/arch/arm/plat-versatile/localtimer.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -18,8 +19,15 @@ /* * Setup the local clock events for a CPU. */ -int __cpuinit local_timer_setup(struct clock_event_device *evt) +static int __cpuinit versatile_local_timer_setup(struct clock_event_device *evt) { evt->irq = gic_ppi_to_vppi(IRQ_LOCALTIMER); return 0; } + +void __init versatile_local_timer_init(void __iomem *base) +{ + if (base) + twd_base = base; + twd_timer_register_setup(versatile_local_timer_setup); +}