[PATCH] clk: respect the clock dependencies in of_clk_init
Emilio López
emilio at elopez.com.ar
Fri Feb 7 13:17:54 EST 2014
Hi,
El 07/02/14 15:10, Gregory CLEMENT escribió:
(snip)
>> ---
>> drivers/clk/mvebu/common.c | 13 +++++++------
>> 1 file changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
>> index 25ceccf..730625b 100644
>> --- a/drivers/clk/mvebu/common.c
>> +++ b/drivers/clk/mvebu/common.c
>> @@ -119,19 +119,20 @@ void __init mvebu_clk_gating_setup(struct
>> device_node *np,
>> const struct clk_gating_soc_desc *desc)
>> {
>> struct clk_gating_ctrl *ctrl;
>> - struct clk *clk;
>> void __iomem *base;
>> - const char *default_parent = NULL;
>> + struct of_phandle_args clkspec;
>> + const char *default_parent = "tclk";
>> int n;
>>
>> base = of_iomap(np, 0);
>> if (WARN_ON(!base))
>> return;
>>
>> - clk = of_clk_get(np, 0);
>> - if (!IS_ERR(clk)) {
>> - default_parent = __clk_get_name(clk);
>> - clk_put(clk);
>> + if (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", 0,
>> &clkspec)) {
>> + of_property_read_string_index(clkspec.np, "clock-output-names",
>> + clkspec.args_count ? clkspec.args[0] : 0,
>> + &default_parent);
>> + of_node_put(clkspec.np);
>
> OK here you duplicate the code from of_clk_get_parent_name, I wonder why
> you didn't use the function.But whatever.
I specifically duplicated it because of_clk_get_parent_name returns the
node name if there's no clock-output-names. That wouldn't be useful in
this case.
> Here you will get default_parent = "mvebu-sar" which is the name of the node, you
> can't have "tclk" because this name is not in the device tree, but it will be
> created by the initialization of the core clocks.
No, default_parent would be "tclk" still because clock-output-names
property doesn't exist. If you ever add such a property, it will
override "tclk".
Cheers,
Emilio
More information about the linux-arm-kernel
mailing list