]> Pileus Git - ~andy/linux/commitdiff
clk: ux500: Add a 2-cell Device Tree parser for obtaining PRCC clocks
authorLee Jones <lee.jones@linaro.org>
Mon, 22 Jul 2013 12:13:01 +0000 (13:13 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 26 Sep 2013 09:05:35 +0000 (11:05 +0200)
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>
drivers/clk/ux500/u8500_of_clk.c

index bfbe3cae72d7a573f75ef2b590655add854171af..b9b3317bdc2fbe16a4c0939407b3bf1fdbb2421c 100644 (file)
 #include <linux/platform_data/clk-ux500.h>
 #include "clk.h"
 
+#define PRCC_SHOW(clk, base, bit) \
+       clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit]
+
+struct clk *ux500_twocell_get(struct of_phandle_args *clkspec, void *data)
+{
+       struct clk **clk_data = data;
+       unsigned int base, bit;
+
+       if (clkspec->args_count != 2)
+               return  ERR_PTR(-EINVAL);
+
+       base = clkspec->args[0];
+       bit = clkspec->args[1];
+
+       if (base != 1 && base != 2 && base != 3 && base != 5 && base != 6) {
+               pr_err("%s: invalid PRCC base %d\n", __func__, base);
+               return ERR_PTR(-EINVAL);
+       }
+
+       return PRCC_SHOW(clk_data, base, bit);
+}
+
 static const struct of_device_id u8500_clk_of_match[] = {
        { .compatible = "stericsson,u8500-clks", },
        { },