From patchwork Thu Jan 5 16:55:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 134514 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6713F1007D6 for ; Fri, 6 Jan 2012 03:59:06 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Riqc3-0004yI-Vw; Thu, 05 Jan 2012 16:56:24 +0000 Received: from [2002:4e20:1eda::1] (helo=caramon.arm.linux.org.uk) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Riqc0-0004xb-M9 for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2012 16:56:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=1cy3KxdxKg2OMzh+n6BYTh/SQVR4q+Q6EAgc5aVWqi8=; b=bY52s/qtCT4Iqb/4//3ktPwwAyz52xw87P6z3ZuerWKxBR/Q6OOfHG6kBKZrHYtqSjsoHlv6f/h1035UcsZYzSP/5Ajiote87R/VjCcAg9HRYiabPOPfcVBTTMao+NPRr25aOMfpr+FX56e+CbMgJ42Uc2KLmJQKmy4EERSV/2I=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:41996) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Riqb5-0006Br-G1; Thu, 05 Jan 2012 16:55:24 +0000 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1Riqb3-0003Ht-SU; Thu, 05 Jan 2012 16:55:21 +0000 Date: Thu, 5 Jan 2012 16:55:21 +0000 From: Russell King - ARM Linux To: Marc Zyngier Subject: Re: [PATCH v2 00/15] Make SMP timers standalone Message-ID: <20120105165521.GB11810@n2100.arm.linux.org.uk> References: <20120104214748.GH11810@n2100.arm.linux.org.uk> <4F0584B5.60908@arm.com> <4F058744.4030503@arm.com> <20120105112602.GQ11810@n2100.arm.linux.org.uk> <4F058B1C.2070109@arm.com> <20120105121026.GS11810@n2100.arm.linux.org.uk> <4F05CC0D.6090101@arm.com> <20120105162650.GY11810@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120105162650.GY11810@n2100.arm.linux.org.uk> User-Agent: Mutt/1.5.19 (2009-01-05) X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS Cc: Kukjin Kim , Stephen Warren , Linus Walleij , Erik Gilling , Tony Lindgren , Stephen Boyd , Linus Walleij , Magnus Damm , Rob Herring , Paul Mundt , "Shilimkar, Santosh" , Colin Cross , Olof Johansson , David Brown , Shawn Guo , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org On Thu, Jan 05, 2012 at 04:26:50PM +0000, Russell King - ARM Linux wrote: > But... it's not quite that simple because platforms need to intercept the > local_timer_setup() call to do platform specific things - such as finding > the twd base, and setting the twd IRQ. That can be solved by moving > that out of platform code (why is it there in the first place?) into > smp_twd.c, and providing twd_local_timer_dt. And that's something we really should do anyway - we already have two implementations which are virtually identical to each other for no real reason other than people like to mess around in their own platform stuff rather than solving problems at higher levels. So, I'll queue this patch after the next merge window. Note: there's no need for that WARN_ON and subsequent oops in each of these setup functions - it can return an error, in which case we'll fall back to a broadcasted tick for the CPU. 8<--------- From: Russell King ARM: TWD: Move DT code into smp_twd.c Rather than have each platform implement their own DT veneer to discover the base address and IRQ for their TWD, move this code into the TWD driver itself. Signed-off-by: Russell King --- arch/arm/include/asm/smp_twd.h | 1 + arch/arm/kernel/smp_twd.c | 21 +++++++++++++++++++++ arch/arm/mach-highbank/localtimer.c | 14 +------------- arch/arm/mach-imx/localtimer.c | 14 +------------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h index ef9ffba9..855f58e 100644 --- a/arch/arm/include/asm/smp_twd.h +++ b/arch/arm/include/asm/smp_twd.h @@ -23,6 +23,7 @@ struct clock_event_device; extern void __iomem *twd_base; void twd_timer_setup(struct clock_event_device *); +int twd_timer_setup_dt(struct clock_event_device *); void twd_timer_stop(struct clock_event_device *); #endif diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index c8e9385..f43f039 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -20,6 +20,9 @@ #include #include #include +#include +#include +#include #include #include @@ -266,3 +269,21 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk) 0xf, 0xffffffff); enable_percpu_irq(clk->irq, 0); } + +int __cpuinit twd_timer_setup_dt(struct clock_event_device *clk) +{ + struct device_node *np; + + np = of_find_compatible_node(NULL, NULL, "arm,smp-twd"); + if (np) { + if (!twd_base) { + twd_base = of_iomap(np, 0); + if (!twd_base) + return -ENOMEM; + } + evt->irq = irq_of_parse_and_map(np, 0); + } + twd_timer_setup(evt); + + return 0; +} diff --git a/arch/arm/mach-highbank/localtimer.c b/arch/arm/mach-highbank/localtimer.c index 5a00e79..1b6c0d1 100644 --- a/arch/arm/mach-highbank/localtimer.c +++ b/arch/arm/mach-highbank/localtimer.c @@ -16,9 +16,6 @@ */ #include #include -#include -#include -#include #include @@ -27,14 +24,5 @@ */ int __cpuinit local_timer_setup(struct clock_event_device *evt) { - struct device_node *np; - - np = of_find_compatible_node(NULL, NULL, "arm,smp-twd"); - if (!twd_base) { - twd_base = of_iomap(np, 0); - WARN_ON(!twd_base); - } - evt->irq = irq_of_parse_and_map(np, 0); - twd_timer_setup(evt); - return 0; + return twd_timer_setup_dt(evt); } diff --git a/arch/arm/mach-imx/localtimer.c b/arch/arm/mach-imx/localtimer.c index 3a16351..1252c22 100644 --- a/arch/arm/mach-imx/localtimer.c +++ b/arch/arm/mach-imx/localtimer.c @@ -12,8 +12,6 @@ #include #include -#include -#include #include /* @@ -21,15 +19,5 @@ */ int __cpuinit local_timer_setup(struct clock_event_device *evt) { - struct device_node *np; - - np = of_find_compatible_node(NULL, NULL, "arm,smp-twd"); - if (!twd_base) { - twd_base = of_iomap(np, 0); - WARN_ON(!twd_base); - } - evt->irq = irq_of_parse_and_map(np, 0); - twd_timer_setup(evt); - - return 0; + return twd_timer_setup_dt(evt); }