diff options
author | Ezequiel Garcia <ezequiel.garcia@imgtec.com> | 2015-07-27 10:00:12 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-09-03 06:08:05 -0400 |
commit | eb811c73b69f18cefb7a63f22fe07212c6575650 (patch) | |
tree | ae72d2ac745def91f5edc69991b3a2d8a20af23e | |
parent | 1a3d59579b9f436da038f377309cf2270c76318e (diff) |
CLOCKSOURCE: mips-gic: Enable the clock before using it
For the clock to be used (e.g. get its rate through clk_get_rate)
it should be prepared and enabled first.
Also, while the clock is enabled the driver must hold a reference to it,
so let's remove the call to clk_put.
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: devicetree@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: James Hartley <James.Hartley@imgtec.com>
Cc: Govindraj Raja <Govindraj.Raja@imgtec.com>
Cc: Damien Horsley <Damien.Horsley@imgtec.com>
Cc: James Hogan <James.Hogan@imgtec.com>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Patchwork: https://patchwork.linux-mips.org/patch/10779/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | drivers/clocksource/mips-gic-timer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index b81ed1a5342d..913585d93466 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c | |||
@@ -158,8 +158,13 @@ static void __init gic_clocksource_of_init(struct device_node *node) | |||
158 | 158 | ||
159 | clk = of_clk_get(node, 0); | 159 | clk = of_clk_get(node, 0); |
160 | if (!IS_ERR(clk)) { | 160 | if (!IS_ERR(clk)) { |
161 | if (clk_prepare_enable(clk) < 0) { | ||
162 | pr_err("GIC failed to enable clock\n"); | ||
163 | clk_put(clk); | ||
164 | return; | ||
165 | } | ||
166 | |||
161 | gic_frequency = clk_get_rate(clk); | 167 | gic_frequency = clk_get_rate(clk); |
162 | clk_put(clk); | ||
163 | } else if (of_property_read_u32(node, "clock-frequency", | 168 | } else if (of_property_read_u32(node, "clock-frequency", |
164 | &gic_frequency)) { | 169 | &gic_frequency)) { |
165 | pr_err("GIC frequency not specified.\n"); | 170 | pr_err("GIC frequency not specified.\n"); |