diff options
author | Andrew Bresticker <abrestic@chromium.org> | 2015-02-23 21:28:34 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-01 11:22:11 -0400 |
commit | 5b4e845393d313af1d319b8bd01c9daaca3aa487 (patch) | |
tree | 707f495616d86e67b329f2bda21d514bdaea1415 /drivers/clocksource | |
parent | 615eb603f4e1da4f151c7fac4aa175753a9913ec (diff) |
CLOCKSOURCE: mips-gic: Allow GIC clock to be specified in device-tree
As an alternative to the "clock-frequency" property, allow the GIC
timer operating clock to be specified in the device-tree instead.
This is useful on systems which use common clock or where the GIC
is not fixed to a particular frequency and is instead, for example,
derived from the CPU clock.
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: devicetree@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/9309/
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/mips-gic-timer.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index 16adbc1fa4c1..b81ed1a5342d 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. | 6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. |
7 | */ | 7 | */ |
8 | #include <linux/clk.h> | ||
8 | #include <linux/clockchips.h> | 9 | #include <linux/clockchips.h> |
9 | #include <linux/cpu.h> | 10 | #include <linux/cpu.h> |
10 | #include <linux/init.h> | 11 | #include <linux/init.h> |
@@ -149,11 +150,18 @@ void __init gic_clocksource_init(unsigned int frequency) | |||
149 | 150 | ||
150 | static void __init gic_clocksource_of_init(struct device_node *node) | 151 | static void __init gic_clocksource_of_init(struct device_node *node) |
151 | { | 152 | { |
153 | struct clk *clk; | ||
154 | |||
152 | if (WARN_ON(!gic_present || !node->parent || | 155 | if (WARN_ON(!gic_present || !node->parent || |
153 | !of_device_is_compatible(node->parent, "mti,gic"))) | 156 | !of_device_is_compatible(node->parent, "mti,gic"))) |
154 | return; | 157 | return; |
155 | 158 | ||
156 | if (of_property_read_u32(node, "clock-frequency", &gic_frequency)) { | 159 | clk = of_clk_get(node, 0); |
160 | if (!IS_ERR(clk)) { | ||
161 | gic_frequency = clk_get_rate(clk); | ||
162 | clk_put(clk); | ||
163 | } else if (of_property_read_u32(node, "clock-frequency", | ||
164 | &gic_frequency)) { | ||
157 | pr_err("GIC frequency not specified.\n"); | 165 | pr_err("GIC frequency not specified.\n"); |
158 | return; | 166 | return; |
159 | } | 167 | } |