[PATCHv9 12/43] CLK: TI: add support for clockdomain binding

Nishanth Menon nm at ti.com
Fri Nov 1 16:22:17 EDT 2013


On 10/25/2013 10:57 AM, Tero Kristo wrote:
[...]
> diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c
> new file mode 100644
> index 0000000..1b3099e
> --- /dev/null
> +++ b/drivers/clk/ti/clockdomain.c
> @@ -0,0 +1,58 @@
> +/*
> + * OMAP clockdomain support
> + *
> + * Copyright (C) 2013 Texas Instruments, Inc.
> + *
> + * Tero Kristo <t-kristo at ti.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether express or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/clk-provider.h>
> +#include <linux/slab.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/clk/ti.h>
> +
> +static void __init of_ti_clockdomain_setup(struct device_node *node)
> +{
> +	struct clk *clk;
> +	struct clk_hw *clk_hw;
> +	const char *clkdm_name = node->name;
> +	int i;
> +	int num_clks;
> +
> +	num_clks = of_count_phandle_with_args(node, "clocks", "#clock-cells");
> +
> +	for (i = 0; i < num_clks; i++) {
> +		clk = of_clk_get(node, i);
> +		if (__clk_get_flags(clk) & CLK_IS_BASIC) {
> +			pr_warn("%s: can't setup clkdm for basic clk %s\n",
> +				__func__, __clk_get_name(clk));
> +			continue;
> +		}
> +		clk_hw = __clk_get_hw(clk);
> +		to_clk_hw_omap(clk_hw)->clkdm_name = clkdm_name;
> +		omap2_init_clk_clkdm(clk_hw);

eventually, this can disappear ofcourse.. and that will pave way to
remove the clock domain data to dts as well.. but yes, we have to find
a proper home for this away from current location..

> +	}
> +}
> +
> +static struct of_device_id ti_clkdm_match_table[] __initdata = {
> +	{ .compatible = "ti,clockdomain" },
> +	{ }
> +};
> +
> +void __init ti_dt_clockdomains_setup(void)

since we are using of_clk_get, it will be good to provide
documentation w.r.t when the call is expected to be invoked.

> +{
> +	struct device_node *np;
> +	for_each_matching_node(np, ti_clkdm_match_table) {
> +		of_ti_clockdomain_setup(np);
> +	}
> +}



-- 
Regards,
Nishanth Menon



More information about the linux-arm-kernel mailing list