Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761149Ab3JPVs1 (ORCPT ); Wed, 16 Oct 2013 17:48:27 -0400 Received: from mms2.broadcom.com ([216.31.210.18]:2090 "EHLO mms2.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760635Ab3JPVsT (ORCPT ); Wed, 16 Oct 2013 17:48:19 -0400 X-Server-Uuid: 4500596E-606A-40F9-852D-14843D8201B2 From: "Tim Kryger" To: "Christian Daudt" , "Rob Herring" , "Pawel Moll" , "Mark Rutland" , "Stephen Warren" , "Ian Campbell" , "Daniel Lezcano" , "Thomas Gleixner" , "Chris Ball" cc: "Tim Kryger" , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, patches@linaro.org Subject: [RESEND PATCH v2 4/6] clocksource: kona: Add basic use of external clock Date: Wed, 16 Oct 2013 14:47:08 -0700 Message-ID: <1381960030-1640-5-git-send-email-tim.kryger@linaro.org> X-Mailer: git-send-email 1.8.0.1 In-Reply-To: <1381960030-1640-1-git-send-email-tim.kryger@linaro.org> References: <1381960030-1640-1-git-send-email-tim.kryger@linaro.org> MIME-Version: 1.0 X-WSS-ID: 7E41D61D1R0101263017-01-01 Content-Type: text/plain Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1770 Lines: 53 When an clock handle is specified in the device tree, enable it and use it to determine the external clock frequency. Signed-off-by: Tim Kryger Reviewed-by: Markus Mayer Reviewed-by: Matt Porter --- drivers/clocksource/bcm_kona_timer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c index 0d7d8c3..fd11f96 100644 --- a/drivers/clocksource/bcm_kona_timer.c +++ b/drivers/clocksource/bcm_kona_timer.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -107,11 +108,18 @@ static const struct of_device_id bcm_timer_ids[] __initconst = { static void __init kona_timers_init(struct device_node *node) { u32 freq; + struct clk *external_clk; - if (!of_property_read_u32(node, "clock-frequency", &freq)) + external_clk = of_clk_get_by_name(node, NULL); + + if (!IS_ERR(external_clk)) { + arch_timer_rate = clk_get_rate(external_clk); + clk_prepare_enable(external_clk); + } else if (!of_property_read_u32(node, "clock-frequency", &freq)) { arch_timer_rate = freq; - else - panic("clock-frequency not set in the .dts file"); + } else { + panic("neither clock-frequency or clocks handle in .dts file"); + } /* Setup IRQ numbers */ timers.tmr_irq = irq_of_parse_and_map(node, 0); -- 1.8.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/