From patchwork Mon Jun 27 10:44:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 920312 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5RAilKw002995 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 27 Jun 2011 10:45:11 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qb9J0-0000zz-8D; Mon, 27 Jun 2011 10:44:38 +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 1Qb9Iz-00047w-TA; Mon, 27 Jun 2011 10:44:37 +0000 Received: from mho-04-ewr.mailhop.org ([204.13.248.74] helo=mho-02-ewr.mailhop.org) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qb9Iw-00047e-FB for linux-arm-kernel@lists.infradead.org; Mon, 27 Jun 2011 10:44:35 +0000 Received: from c-98-234-237-12.hsd1.ca.comcast.net ([98.234.237.12] helo=localhost.localdomain) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1Qb9It-000D8k-OD; Mon, 27 Jun 2011 10:44:31 +0000 Received: from Mutt by mutt-smtp-wrapper.pl 1.2 (www.zdo.com/articles/mutt-smtp-wrapper.shtml) X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 98.234.237.12 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/3Ei/RH+PJmX3lu1XRwxYE Date: Mon, 27 Jun 2011 03:44:28 -0700 From: Tony Lindgren To: Kevin Hilman Subject: Re: [PATCH 07/10] omap2+: Reserve clocksource and timesource and initialize dmtimer later Message-ID: <20110627104428.GK23145@atomide.com> References: <20110620091754.357.56441.stgit@kaulin> <20110620092343.357.60445.stgit@kaulin> <87ei2ka2u6.fsf@ti.com> <20110627075101.GE23145@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110627075101.GE23145@atomide.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110627_064434_572390_B64BE4E1 X-CRM114-Status: GOOD ( 18.16 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [204.13.248.74 listed in list.dnswl.org] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.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: , 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]); Mon, 27 Jun 2011 10:48:35 +0000 (UTC) * Tony Lindgren [110627 00:46]: > * Kevin Hilman [110623 10:08]: > > Tony Lindgren writes: > > > > > There's no need to initialize the dmtimer framework early. > > > Just mark the clocksource and timesource as reserved, and > > > initialize dmtimer with an arch_initcall. > > > > > > Signed-off-by: Tony Lindgren > > > Reviewed-by: Kevin Hilman > > > > Also, when you are able to fully get rid of omap_dm_timer_init(), you > > can probably remove it from dmtimer.h and make it static in dmtimer.c > > Good catch. That can be made static now. Here's an updated version of this patch. Tony From: Tony Lindgren Date: Tue, 29 Mar 2011 15:54:49 -0700 Subject: [PATCH] omap2+: Reserve clocksource and timesource and initialize dmtimer later There's no need to initialize the dmtimer framework early. Just mark the clocksource and timesource as reserved, and initialize dmtimer with an arch_initcall. Signed-off-by: Tony Lindgren Reviewed-by: Kevin Hilman diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c index 13d7b8f..96604a5 100644 --- a/arch/arm/mach-omap1/timer32k.c +++ b/arch/arm/mach-omap1/timer32k.c @@ -183,10 +183,6 @@ static __init void omap_init_32k_timer(void) bool __init omap_32k_timer_init(void) { omap_init_clocksource_32k(); - -#ifdef CONFIG_OMAP_DM_TIMER - omap_dm_timer_init(); -#endif omap_init_32k_timer(); return true; diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index 578e9df..cf2ec85 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c @@ -69,6 +69,8 @@ /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */ #define MAX_GPTIMER_ID 12 +u32 sys_timer_reserved; + /* Clockevent code */ static struct omap_dm_timer clkev; @@ -195,6 +197,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, omap_hwmod_enable(oh); + sys_timer_reserved |= (1 << (gptimer_id - 1)); + if (gptimer_id != 12) { struct clk *src; @@ -321,7 +325,6 @@ static void __init omap2_gp_clocksource_init(void) #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src) \ static void __init omap##name##_timer_init(void) \ { \ - omap_dm_timer_init(); \ omap2_gp_clockevent_init((clkev_nr), clkev_src); \ omap2_gp_clocksource_init(); \ } @@ -350,7 +353,6 @@ static void __init omap4_timer_init(void) twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256); BUG_ON(!twd_base); #endif - omap_dm_timer_init(); omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE); omap2_gp_clocksource_init(); } diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 7c5cb4e..8dfb818 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -572,7 +572,7 @@ int omap_dm_timers_active(void) } EXPORT_SYMBOL_GPL(omap_dm_timers_active); -int __init omap_dm_timer_init(void) +static int __init omap_dm_timer_init(void) { struct omap_dm_timer *timer; int i, map_size = SZ_8K; /* Module 4KB + L4 4KB except on omap1 */ @@ -625,8 +625,16 @@ int __init omap_dm_timer_init(void) sprintf(clk_name, "gpt%d_fck", i + 1); timer->fclk = clk_get(NULL, clk_name); } + + /* One or two timers may be set up early for sys_timer */ + if (sys_timer_reserved & (1 << i)) { + timer->reserved = 1; + timer->posted = 1; + } #endif } return 0; } + +arch_initcall(omap_dm_timer_init); diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h index dd8b3ff..40d7936 100644 --- a/arch/arm/plat-omap/include/plat/dmtimer.h +++ b/arch/arm/plat-omap/include/plat/dmtimer.h @@ -62,8 +62,6 @@ struct omap_dm_timer; extern struct omap_dm_timer *gptimer_wakeup; struct clk; -int omap_dm_timer_init(void); - struct omap_dm_timer *omap_dm_timer_request(void); struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); void omap_dm_timer_free(struct omap_dm_timer *timer); @@ -222,6 +220,7 @@ struct omap_dm_timer { unsigned posted:1; }; +extern u32 sys_timer_reserved; void omap_dm_timer_prepare(struct omap_dm_timer *timer); static inline u32 __omap_dm_timer_read(void __iomem *base, u32 reg,