[PATCH v2 3/6] dt: add new member 'clk' into device_node

Grant Likely grant.likely at secretlab.ca
Fri Apr 1 06:59:51 EST 2011


On Sat, Mar 19, 2011 at 02:24:29AM +0800, Shawn Guo wrote:
> This pointer to 'struct clk' is added to save the reference to 'clk'
> which is dynamically created per dt clock node, so that clkdev API
> like clk_get can work with dt based device driver.
> 
> Signed-off-by: Shawn Guo <shawn.guo at linaro.org>
> ---
>  include/linux/of.h |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/of.h b/include/linux/of.h
> index d9dd664..e621295 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -54,6 +54,7 @@ struct device_node {
>  	struct	device_node *allnext;	/* next in list of all nodes */
>  	struct	proc_dir_entry *pde;	/* this node's proc directory */
>  	struct	kref kref;
> +	struct	clk *clk;

The dt clock support code can already translate from dt node to a
clock provider, and each clock provider should provide a .get() hook
to return the correct struct clk.  of_clk_add_provider() inserts a
mapping into the of_clk_providers() list, and clk_get() calls
of_clk_get() which will process a devicenode->clk provider mapping.

Adding a struct clk pointer to the device node isn't sufficient since
a single clock provider node can provide multiple clock outputs.

g.



More information about the devicetree-discuss mailing list