From patchwork Fri Jan 4 16:35:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Langsdorf X-Patchwork-Id: 1933821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 4E398DFABD for ; Fri, 4 Jan 2013 16:38:57 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TrAFA-0001wM-Um; Fri, 04 Jan 2013 16:35:41 +0000 Received: from smtp131.dfw.emailsrvr.com ([67.192.241.131]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TrAEw-0001tf-93 for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2013 16:35:27 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp23.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 9B6F62F8613; Fri, 4 Jan 2013 11:35:24 -0500 (EST) X-Virus-Scanned: OK Received: by smtp23.relay.dfw1a.emailsrvr.com (Authenticated sender: mark.langsdorf-AT-calxeda.com) with ESMTPSA id B284D2F85C2; Fri, 4 Jan 2013 11:35:23 -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 Subject: [PATCH 1/4 v10] arm: use devicetree to get smp_twd clock Date: Fri, 4 Jan 2013 10:35:43 -0600 Message-Id: <1357317346-1120-2-git-send-email-mark.langsdorf@calxeda.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1357317346-1120-1-git-send-email-mark.langsdorf@calxeda.com> References: <1351631056-25938-1-git-send-email-mark.langsdorf@calxeda.com> <1357317346-1120-1-git-send-email-mark.langsdorf@calxeda.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130104_113526_488909_6A6E030C X-CRM114-Status: GOOD ( 11.90 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [67.192.241.131 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Rob Herring , Mark Langsdorf X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Rob Herring Signed-off-by: Rob Herring Signed-off-by: Mark Langsdorf --- Changes from v9 Updated to work with 3.8 kernel. 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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 49f335d..dad2d81 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -239,12 +239,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; @@ -257,6 +260,7 @@ static struct clk *twd_get_clock(void) return ERR_PTR(err); } + twd_timer_rate = clk_get_rate(clk); return clk; } @@ -285,7 +289,7 @@ static int __cpuinit twd_timer_setup(struct clock_event_device *clk) * during the runtime of the system. */ if (!common_setup_called) { - twd_clk = twd_get_clock(); + twd_clk = twd_get_clock(NULL); /* * We use IS_ERR_OR_NULL() here, because if the clock stubs @@ -373,6 +377,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(); } @@ -405,6 +411,8 @@ void __init twd_local_timer_of_register(void) goto out; } + twd_clk = twd_get_clock(np); + err = twd_local_timer_common_register(); out: