From patchwork Thu Mar 13 20:35:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 3828601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 45713BF540 for ; Thu, 13 Mar 2014 20:39:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30BC620154 for ; Thu, 13 Mar 2014 20:39:20 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 40E8020149 for ; Thu, 13 Mar 2014 20:39:19 +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 1WOCNb-0008Dd-3X; Thu, 13 Mar 2014 20:37:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOCN9-00077L-CA; Thu, 13 Mar 2014 20:36:59 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOCMQ-00071t-DJ for linux-arm-kernel@lists.infradead.org; Thu, 13 Mar 2014 20:36:18 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2DKZnYP014501; Thu, 13 Mar 2014 15:35:49 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2DKZnXs013321; Thu, 13 Mar 2014 15:35:49 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Thu, 13 Mar 2014 15:35:48 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2DKZmqo002070; Thu, 13 Mar 2014 15:35:48 -0500 Received: from joel-laptop.am.dhcp.ti.com (joel-laptop.am.dhcp.ti.com [10.247.27.57]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id s2DKZmt10056; Thu, 13 Mar 2014 15:35:48 -0500 (CDT) From: Joel Fernandes To: Tony Lindgren , Rob Herring , Tero Kristo , Nishanth Menon , Suman Anna , Felipe Balbi Subject: [RFC 3/5] ARM: OMAP2+: timer: Add clocksource initialization and powerup support Date: Thu, 13 Mar 2014 15:35:17 -0500 Message-ID: <1394742919-32163-4-git-send-email-joelf@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1394742919-32163-1-git-send-email-joelf@ti.com> References: <1394742919-32163-1-git-send-email-joelf@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140313_163614_580052_40563DB3 X-CRM114-Status: GOOD ( 11.20 ) X-Spam-Score: -6.9 (------) Cc: Joel Fernandes , Linux OMAP List , Linux Kernel Mailing List , Linux ARM Kernel List 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce a generic omap timer initialization function that can be used by all SoCs for which support is available in the clocksource driver introduced in the series. The function will also be responsible for calling clock initialization required for everything else to work. Signed-off-by: Joel Fernandes --- arch/arm/mach-omap2/common.h | 1 + arch/arm/mach-omap2/timer.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index a6aae30..e58d9a4 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h @@ -92,6 +92,7 @@ extern void omap3_secure_sync32k_timer_init(void); extern void omap3_gptimer_timer_init(void); extern void omap4_local_timer_init(void); extern void omap5_realtime_timer_init(void); +void omap_generic_timer_init(void); void omap2420_init_early(void); void omap2430_init_early(void); diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 74044aa..08c73a0 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c @@ -324,6 +324,25 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, return r; } +int __init omap_dmtimer_powerup(struct omap_dm_timer *timer, + struct device_node *np) { + struct omap_hwmod *oh; + const char *oh_name = NULL; + + of_property_read_string_index(np, "ti,hwmods", 0, &oh_name); + if (!oh_name) + return -ENODEV; + + oh = omap_hwmod_lookup(oh_name); + if (!oh) + return -ENODEV; + + omap_hwmod_setup_one(oh_name); + + omap_hwmod_enable(oh); + return 0; +} + static void __init omap2_gp_clockevent_init(int gptimer_id, const char *fck_source, const char *property) @@ -615,6 +634,15 @@ static OMAP_SYS_32K_TIMER_INIT(4, 1, "timer_32k_ck", "ti,timer-alwon", 2, "sys_clkin_ck", NULL); #endif +void omap_generic_timer_init(void) +{ + if (!of_have_populated_dt()) + BUG_ON("Generic timer init should only be used for DT boot\n"); + + omap_clk_init(); + clocksource_of_init(); +} + #ifdef CONFIG_ARCH_OMAP4 #ifdef CONFIG_HAVE_ARM_TWD static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29);