From patchwork Fri Apr 26 21:37:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 2496021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id DD890DF230 for ; Fri, 26 Apr 2013 21:37:38 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVqKk-0002Lz-02; Fri, 26 Apr 2013 21:37:34 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVqKh-0005l8-Br; Fri, 26 Apr 2013 21:37:31 +0000 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVqKd-0005km-7N for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2013 21:37:29 +0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id CC7CD816C0; Fri, 26 Apr 2013 23:37:24 +0200 (CEST) Date: Fri, 26 Apr 2013 23:37:23 +0200 From: Pavel Machek To: Jamie Iles Subject: Re: dw_apb_timer_of.c: remove parts that were picoxcell-specific Message-ID: <20130426213723.GA24891@amd.pavel.ucw.cz> References: <20130426121433.GA16249@amd.pavel.ucw.cz> <20130426124128.GB6946@page> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130426124128.GB6946@page> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130426_173727_509393_B4284BB4 X-CRM114-Status: GOOD ( 21.06 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [195.113.26.193 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: wd@denx.de, arnd@arndb.de, johnstul@us.ibm.com, kernel list , dinguyen@altera.com, olof@lixom.net, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hi! > On Fri, Apr 26, 2013 at 02:14:34PM +0200, Pavel Machek wrote: > > diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c > > index 70b441a..22759f5 100644 > > --- a/arch/arm/mach-picoxcell/common.c > > +++ b/arch/arm/mach-picoxcell/common.c > > @@ -84,11 +84,39 @@ static void picoxcell_wdt_restart(char mode, const char *cmd) > > } > > } > > > > +static const struct of_device_id picochip_rtc_ids[] __initconst = { > > + { .compatible = "picochip,pc3x2-rtc" }, > > + { /* Sentinel */ }, > > +}; > > + > > +static void __iomem *sched_io_base; > > + > > +static u32 read_sched_clock(void) > > +{ > > + return __raw_readl(sched_io_base); > > +} > > + > > +static void __init timer_init(void) > > +{ > > + u32 rate; > > + > > + dw_apb_timer_init(0); > > + > > + sched_timer = of_find_matching_node(timer, osctimer_ids); > > + if (!sched_timer) > > + panic("No suitable timer for scheduler clock\n"); > > + > > + timer_get_base_and_rate(sched_timer, &sched_io_base, &rate); > > + of_node_put(sched_timer); > > This doesn't work as osctimer_ids is private to the dw_apb_timer files > as is timer_get_base_and_rate. The other timer is unused in picoxcell > though so dw_apb_timer_init(1), something like the patch below on top of > yours. That would still not compile due to common.h. ... _but_ it allows some very nice simplification, with this on top: I'll post merged-up patch in next mail. Thanks, Pavel diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c index c027920..70b441a 100644 --- a/arch/arm/mach-picoxcell/common.c +++ b/arch/arm/mach-picoxcell/common.c @@ -84,16 +84,11 @@ static void picoxcell_wdt_restart(char mode, const char *cmd) } } -static void __init timer_init(void) -{ - dw_apb_timer_init(1); -} - DT_MACHINE_START(PICOXCELL, "Picochip picoXcell") .map_io = picoxcell_map_io, .nr_irqs = NR_IRQS_LEGACY, .init_irq = irqchip_init, - .init_time = timer_init, + .init_time = dw_apb_timer_init, .init_machine = picoxcell_init_machine, .dt_compat = picoxcell_dt_match, .restart = picoxcell_wdt_restart, diff --git a/arch/arm/mach-picoxcell/common.h b/arch/arm/mach-picoxcell/common.h index 481b42a..237fb3b 100644 --- a/arch/arm/mach-picoxcell/common.h +++ b/arch/arm/mach-picoxcell/common.h @@ -12,6 +12,4 @@ #include -extern void dw_apb_timer_init(void); - #endif /* __PICOXCELL_COMMON_H__ */ diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c index 6efbc12..81b8f1e 100644 --- a/arch/arm/mach-socfpga/socfpga.c +++ b/arch/arm/mach-socfpga/socfpga.c @@ -110,17 +110,11 @@ static const char *altera_dt_match[] = { NULL }; -static void __init timer_init(void) -{ - dw_apb_timer_init(1); -} - - DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA") .smp = smp_ops(socfpga_smp_ops), .map_io = socfpga_map_io, .init_irq = socfpga_init_irq, - .init_time = timer_init, + .init_time = dw_apb_timer_init, .init_machine = socfpga_cyclone5_init, .restart = socfpga_cyclone5_restart, .dt_compat = altera_dt_match, diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c index 872ce66..0fa3104 100644 --- a/drivers/clocksource/dw_apb_timer_of.c +++ b/drivers/clocksource/dw_apb_timer_of.c @@ -66,7 +66,7 @@ static u32 read_sched_clock_sptimer(void) return ~__raw_readl(sched_io_base + APBTMR_N_CURRENT_VALUE); } -static void add_clocksource(struct device_node *source_timer, int use_as_scheduler) +static void add_clocksource(struct device_node *source_timer) { void __iomem *iobase; struct dw_apb_clocksource *cs; @@ -81,10 +81,8 @@ static void add_clocksource(struct device_node *source_timer, int use_as_schedul dw_apb_clocksource_start(cs); dw_apb_clocksource_register(cs); - if (use_as_scheduler) { - sched_io_base = iobase; - setup_sched_clock(read_sched_clock_sptimer, 32, rate); - } + sched_io_base = iobase; + setup_sched_clock(read_sched_clock_sptimer, 32, rate); } static const struct of_device_id osctimer_ids[] __initconst = { @@ -104,7 +102,7 @@ static const struct of_device_id osctimer_ids[] __initconst = { */ -void __init dw_apb_timer_init(int use_as_scheduler) +void __init dw_apb_timer_init(void) { struct device_node *event_timer, *source_timer; @@ -116,7 +114,7 @@ void __init dw_apb_timer_init(int use_as_scheduler) source_timer = of_find_matching_node(event_timer, osctimer_ids); if (!source_timer) panic("No timer for clocksource"); - add_clocksource(source_timer, use_as_scheduler); + add_clocksource(source_timer); of_node_put(event_timer); of_node_put(source_timer); diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h index d503245..a64c987 100644 --- a/include/linux/dw_apb_timer.h +++ b/include/linux/dw_apb_timer.h @@ -59,5 +59,5 @@ void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs); cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs); -extern void dw_apb_timer_init(int); +extern void dw_apb_timer_init(void); #endif /* __DW_APB_TIMER_H__ */