From patchwork Mon Feb 18 11:37:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Afzal Mohammed X-Patchwork-Id: 2157241 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 00CA0DF25A for ; Mon, 18 Feb 2013 11:41:23 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U7P3h-0002Ej-Av; Mon, 18 Feb 2013 11:38:57 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U7P2r-0001nx-03 for linux-arm-kernel@lists.infradead.org; Mon, 18 Feb 2013 11:38:10 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r1IBbsUf010174; Mon, 18 Feb 2013 05:37:54 -0600 Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id r1IBbrhi014183; Mon, 18 Feb 2013 17:07:53 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Mon, 18 Feb 2013 17:07:53 +0530 Received: from psplinux063.india.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id r1IBbrJI024299; Mon, 18 Feb 2013 17:07:53 +0530 From: Afzal Mohammed To: , , , , Subject: [PATCH, RFC 3/8] ARM: twd: clock rate from DT (if no DT clk tree) Date: Mon, 18 Feb 2013 17:07:52 +0530 Message-ID: <94cb377171f84ceefd667aead4602d70adab6619.1361186097.git.afzal@ti.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130218_063805_306776_D0F4728C X-CRM114-Status: GOOD ( 11.78 ) X-Spam-Score: -4.6 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.40 listed in list.dnswl.org] 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Russell King , Nicolas Pitre , Tony Lindgren , Sekhar Nori , Linus Walleij , Will Deacon , Rob Herring , Grant Likely , Marc Zyngier , Santosh Shilimkar , Rob Landley , Syed Mohammed Khasim 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: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add an optional property to find clock-frequency from DT. This helps as a fallback mechanism in case there is no representation of clock tree in DT. Signed-off-by: Afzal Mohammed --- Documentation/devicetree/bindings/arm/twd.txt | 7 ++++++- arch/arm/kernel/smp_twd.c | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/twd.txt b/Documentation/devicetree/bindings/arm/twd.txt index 75b8610..fdafa4f 100644 --- a/Documentation/devicetree/bindings/arm/twd.txt +++ b/Documentation/devicetree/bindings/arm/twd.txt @@ -7,8 +7,9 @@ and watchdog. The TWD is usually attached to a GIC to deliver its two per-processor interrupts. -** Timer node required properties: +** Timer node properties: +Required properties: - compatible : Should be one of: "arm,cortex-a9-twd-timer" "arm,cortex-a5-twd-timer" @@ -19,12 +20,16 @@ interrupts. - reg : Specify the base address and the size of the TWD timer register window. +Optional property: +- clock-frequency : frequency(Hz) of peripheral clock fed to timer + Example: twd-timer@2c000600 { compatible = "arm,arm11mp-twd-timer""; reg = <0x2c000600 0x20>; interrupts = <1 13 0xf01>; + clock-frequency = <300000000>; }; ** Watchdog node properties: diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 118f4f2..aac0f9f 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -247,7 +247,15 @@ static void twd_get_clock(struct device_node *np) twd_clk = clk_get_sys("smp_twd", NULL); if (IS_ERR(twd_clk)) { + u32 freq; + pr_err("smp_twd: clock not found %d\n", (int) PTR_ERR(twd_clk)); + + /* If there is no representation of clock tree in DT, + provide a fallback option to obtain frequency + */ + if (np && !of_property_read_u32(np, "clock-frequency", &freq)) + twd_timer_rate = freq; return; }