Hi,

On 01/08/2014 02:19 AM, Ma Haijun wrote:
Hi,
I think there is no much reason to use dummy clock names.
It is better to access them by index, and use clock-names for documentation
only.
Then it can support arbitrary number of clocks easily.

num_clks = of_count_phandle_with_args(np, "clocks", "#clock-cells");
for ( id = 0; id < num_clks; id++) {
        clk[id] = of_clk_get(np, id);
}

Except that we will want to use a devm version of of_clk_get, which means
adding a new devm_get_clk_by_index function. Certainly doable. But the same
argument could be made for the phy, so that means adding a devm_get_phy_by_index
oh wait maybe we also want to add support for regulators for some boards,
so that is a devm_get_regulator_by_index, oh but it is an optional
regulator so we want devm_get_regulator_optional_by_index. So this will lead
to an explosion of devm_get_foo_bar_by_index functions additions which I
want to avoid.

TL;DR:
1) We want to use devm_get_foo functions
2) All devm_get_foo functions take an (often mandatory) name argument
3) We don't know the exact clk names since we're trying to do a generic driver
4) Therefor we use generic clock-names: "clk0", "clk1", etc.

Regards,

Hans

--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to