From: tim.kryger@linaro.org (Tim Kryger)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 7/8] clocksource: kona: Add basic use of external clock
Date: Thu, 5 Dec 2013 11:20:43 -0800 [thread overview]
Message-ID: <1386271244-3927-8-git-send-email-tim.kryger@linaro.org> (raw)
In-Reply-To: <1386271244-3927-1-git-send-email-tim.kryger@linaro.org>
When an clock is specified in the device tree, enable it and use it to
determine the external clock frequency.
Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---
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..8a4ab36 100644
--- a/drivers/clocksource/bcm_kona_timer.c
+++ b/drivers/clocksource/bcm_kona_timer.c
@@ -17,6 +17,7 @@
#include <linux/jiffies.h>
#include <linux/clockchips.h>
#include <linux/types.h>
+#include <linux/clk.h>
#include <linux/io.h>
#include <asm/mach/time.h>
@@ -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("unable to determine clock-frequency");
+ }
/* Setup IRQ numbers */
timers.tmr_irq = irq_of_parse_and_map(node, 0);
--
1.8.0.1
next prev parent reply other threads:[~2013-12-05 19:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-05 19:20 [PATCH v4 0/8] Update Kona drivers to use clocks Tim Kryger
2013-12-05 19:20 ` [PATCH v4 1/8] ARM: dts: Declare clocks as fixed on bcm11351 Tim Kryger
2013-12-10 7:18 ` Christian Daudt
2013-12-10 20:26 ` Tim Kryger
2013-12-13 7:48 ` Christian Daudt
2013-12-13 15:56 ` Tim Kryger
2013-12-05 19:20 ` [PATCH v4 2/8] ARM: dts: Specify clocks for UARTs " Tim Kryger
2013-12-13 7:56 ` Christian Daudt
2013-12-05 19:20 ` [PATCH v4 3/8] Documentation: dt: kona-sdhci: Add clocks property Tim Kryger
2013-12-13 8:02 ` Christian Daudt
2013-12-05 19:20 ` [PATCH v4 4/8] ARM: dts: Specify clocks for SDHCIs on bcm11351 Tim Kryger
2013-12-13 8:22 ` Christian Daudt
2013-12-05 19:20 ` [PATCH v4 5/8] mmc: sdhci-bcm-kona: Add basic use of clocks Tim Kryger
2013-12-14 8:14 ` Christian Daudt
2013-12-23 8:26 ` Christian Daudt
2014-01-07 19:37 ` Tim Kryger
2014-01-24 17:07 ` Tim Kryger
2014-02-24 19:33 ` Matt Porter
2014-02-24 19:40 ` Chris Ball
2013-12-05 19:20 ` [PATCH v4 6/8] Documentation: dt: kona-timer: Add clocks property Tim Kryger
2013-12-14 8:19 ` Christian Daudt
2013-12-05 19:20 ` Tim Kryger [this message]
2013-12-14 8:26 ` [PATCH v4 7/8] clocksource: kona: Add basic use of external clock Christian Daudt
2013-12-16 10:34 ` Daniel Lezcano
2013-12-05 19:20 ` [PATCH v4 8/8] ARM: dts: Specify clocks for timer on bcm11351 Tim Kryger
2013-12-13 8:06 ` Christian Daudt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386271244-3927-8-git-send-email-tim.kryger@linaro.org \
--to=tim.kryger@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).