diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-07-22 08:13:01 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-09-26 05:05:35 -0400 |
commit | b4bdc81b5b234beb876ffc70380e05b21f64c7ac (patch) | |
tree | 4fa91bcb42d2ef2b6fc6b69b514b620ced8f01ab /drivers/clk/ux500 | |
parent | dec759d8ef01b3edd5ceb9832ce2338c6c396d11 (diff) |
clk: ux500: Add a 2-cell Device Tree parser for obtaining PRCC clocks
PRCC (peripheral and kernel) clocks are specified using a property tuple
<&phandle base bit>, where 'base' is the peripheral (1, 2, 3, 5 or 6),
and bit is read-in value into that peripheral stipulated by the hardware
specification.
Acked-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/clk/ux500')
-rw-r--r-- | drivers/clk/ux500/u8500_of_clk.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/clk/ux500/u8500_of_clk.c b/drivers/clk/ux500/u8500_of_clk.c index bfbe3cae72d7..b9b3317bdc2f 100644 --- a/drivers/clk/ux500/u8500_of_clk.c +++ b/drivers/clk/ux500/u8500_of_clk.c | |||
@@ -15,6 +15,28 @@ | |||
15 | #include <linux/platform_data/clk-ux500.h> | 15 | #include <linux/platform_data/clk-ux500.h> |
16 | #include "clk.h" | 16 | #include "clk.h" |
17 | 17 | ||
18 | #define PRCC_SHOW(clk, base, bit) \ | ||
19 | clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] | ||
20 | |||
21 | struct clk *ux500_twocell_get(struct of_phandle_args *clkspec, void *data) | ||
22 | { | ||
23 | struct clk **clk_data = data; | ||
24 | unsigned int base, bit; | ||
25 | |||
26 | if (clkspec->args_count != 2) | ||
27 | return ERR_PTR(-EINVAL); | ||
28 | |||
29 | base = clkspec->args[0]; | ||
30 | bit = clkspec->args[1]; | ||
31 | |||
32 | if (base != 1 && base != 2 && base != 3 && base != 5 && base != 6) { | ||
33 | pr_err("%s: invalid PRCC base %d\n", __func__, base); | ||
34 | return ERR_PTR(-EINVAL); | ||
35 | } | ||
36 | |||
37 | return PRCC_SHOW(clk_data, base, bit); | ||
38 | } | ||
39 | |||
18 | static const struct of_device_id u8500_clk_of_match[] = { | 40 | static const struct of_device_id u8500_clk_of_match[] = { |
19 | { .compatible = "stericsson,u8500-clks", }, | 41 | { .compatible = "stericsson,u8500-clks", }, |
20 | { }, | 42 | { }, |