From patchwork Thu Dec 6 22:42:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Langsdorf X-Patchwork-Id: 1847271 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 458B2DF2F9 for ; Thu, 6 Dec 2012 22:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964961Ab2LFWmn (ORCPT ); Thu, 6 Dec 2012 17:42:43 -0500 Received: from smtp127.dfw.emailsrvr.com ([67.192.241.127]:54168 "EHLO smtp127.dfw.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964862Ab2LFWmm (ORCPT ); Thu, 6 Dec 2012 17:42:42 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id ED15378303; Thu, 6 Dec 2012 17:42:41 -0500 (EST) X-Virus-Scanned: OK Received: by smtp2.relay.dfw1a.emailsrvr.com (Authenticated sender: mark.langsdorf-AT-calxeda.com) with ESMTPSA id B76FA78361; Thu, 6 Dec 2012 17:42:41 -0500 (EST) From: Mark Langsdorf To: linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Mark Langsdorf , Rob Herring Subject: [PATCH 1/6 v9] arm: use devicetree to get smp_twd clock Date: Thu, 6 Dec 2012 16:42:48 -0600 Message-Id: <1354833773-22845-2-git-send-email-mark.langsdorf@calxeda.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1354833773-22845-1-git-send-email-mark.langsdorf@calxeda.com> References: <1351631056-25938-1-git-send-email-mark.langsdorf@calxeda.com> <1354833773-22845-1-git-send-email-mark.langsdorf@calxeda.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Rob Herring Signed-off-by: Rob Herring Signed-off-by: Mark Langsdorf --- Changes from v4, v5, v6, v7, v8 None. Changes from v3 No longer setting *clk to NULL in twd_get_clock(). Changes from v2 Turned the check for the node pointer into an if-then-else statement. Removed the second, redundant clk_get_rate. Changes from v1 None. arch/arm/kernel/smp_twd.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index b22d700..af46b80 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -237,12 +237,15 @@ static irqreturn_t twd_handler(int irq, void *dev_id) return IRQ_NONE; } -static struct clk *twd_get_clock(void) +static struct clk *twd_get_clock(struct device_node *np) { struct clk *clk; int err; - clk = clk_get_sys("smp_twd", NULL); + if (np) + clk = of_clk_get(np, 0); + else + clk = clk_get_sys("smp_twd", NULL); if (IS_ERR(clk)) { pr_err("smp_twd: clock not found: %d\n", (int)PTR_ERR(clk)); return clk; @@ -263,6 +266,7 @@ static struct clk *twd_get_clock(void) return ERR_PTR(err); } + twd_timer_rate = clk_get_rate(clk); return clk; } @@ -273,12 +277,7 @@ static int __cpuinit twd_timer_setup(struct clock_event_device *clk) { struct clock_event_device **this_cpu_clk; - if (!twd_clk) - twd_clk = twd_get_clock(); - - if (!IS_ERR_OR_NULL(twd_clk)) - twd_timer_rate = clk_get_rate(twd_clk); - else + if (IS_ERR_OR_NULL(twd_clk)) twd_calibrate_rate(); __raw_writel(0, twd_base + TWD_TIMER_CONTROL); @@ -349,6 +348,8 @@ int __init twd_local_timer_register(struct twd_local_timer *tlt) if (!twd_base) return -ENOMEM; + twd_clk = twd_get_clock(NULL); + return twd_local_timer_common_register(); } @@ -383,6 +384,8 @@ void __init twd_local_timer_of_register(void) goto out; } + twd_clk = twd_get_clock(np); + err = twd_local_timer_common_register(); out: