[PATCH] sunxi: make gate clock getable by name

Emilio López emilio at elopez.com.ar
Wed Apr 30 01:39:53 PDT 2014


Hi,

El 30/04/14 05:25, Александр Берсенев escribió:
> This patch enables to use devm_clk_get function to get gate clocks by name.
> Signed-off-by: Alexander Bersenev <bay at hackerdom.ru>
>
> diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
> index 31584ee..3617681 100644
> --- a/drivers/clk/sunxi/clk-sunxi.c
> +++ b/drivers/clk/sunxi/clk-sunxi.c
> @@ -1048,6 +1048,8 @@ static void __init sunxi_gates_clk_setup(struct
> device_node *node,
>       reg + 4 * (i/32), i % 32,
>       0, &clk_lock);
> WARN_ON(IS_ERR(clk_data->clks[i]));
> +if (!IS_ERR(clk_data->clks[i]))
> +clk_register_clkdev(clk_data->clks[i], clk_name, NULL);
> j++;
> }

What are you trying to achieve here? Do you want to use devm_clk_get on 
your driver? If so, you just need to list the clock your device needs on 
its device tree node, like for example

device: blah at 0f0.... {
        ....
        clocks = <&gate 12>, <&clock>, <&whatever>;
        clock-names = "module", "ref", "sample";
}

And then you can pass "module", "ref" or "sample" to devm_clk_get to get 
the respective clock.

Cheers,

Emilio



More information about the linux-arm-kernel mailing list