lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 15 Dec 2011 23:19:51 +0800
From:	Shawn Guo <shawn.guo@...escale.com>
To:	Grant Likely <grant.likely@...retlab.ca>
CC:	<linux-kernel@...r.kernel.org>,
	<devicetree-discuss@...ts.ozlabs.org>,
	Mike Turquette <mturquette@...com>,
	Sascha Hauer <kernel@...gutronix.de>,
	Rob Herring <rob.herring@...xeda.com>
Subject: Re: [RFC v2 5/9] dt/clock: Add handling for fixed clocks and a clock
 node setup iterator

Hi Grant,

On Mon, Dec 12, 2011 at 03:02:05PM -0700, Grant Likely wrote:
> Signed-off-by: Grant Likely <grant.likely@...retlab.ca>
> ---
>  drivers/of/clock.c     |   43 +++++++++++++++++++++++++++++++++++++++++++
>  include/linux/of_clk.h |    4 ++++
>  2 files changed, 47 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/of/clock.c b/drivers/of/clock.c
> index 6519e96..1c189b4 100644
> --- a/drivers/of/clock.c
> +++ b/drivers/of/clock.c
> @@ -3,6 +3,7 @@
>   */
>  
>  #include <linux/clk.h>
> +#include <linux/clkdev.h>
>  #include <linux/err.h>
>  #include <linux/errno.h>
>  #include <linux/module.h>
> @@ -163,3 +164,45 @@ struct clk *of_clk_get_by_name(struct device_node *np, const char *name)
>  
>  	return clk;
>  }
> +
> +/**
> + * of_clk_init() - Scan and init clock providers from the DT
> + * @matches: array of compatible values and init functions for providers.
> + *
> + * This function scans the device tree for matching clock providers and
> + * calls their initialization functions
> + */
> +void __init of_clk_init(const struct of_device_id *matches)
> +{
> +	struct device_node *np;
> +
> +	for_each_matching_node(np, matches) {
> +		const struct of_device_id *match = of_match_node(matches, np);
> +		of_clk_init_cb_t clk_init_cb = match->data;
> +		clk_init_cb(np);
> +	}
> +}
> +
> +static struct clk *of_fixed_clk_get(struct of_phandle_args *a, void *data)
> +{
> +	return data;
> +}
> +
> +/**
> + * of_fixed_clk_setup() - Setup function for simple fixed rate clock
> + */
> +void __init of_fixed_clk_setup(struct device_node *node)
> +{
> +	struct clk *clk;
> +	u32 rate;
> +
> +	if (of_property_read_u32(node, "clock-frequency", &rate))
> +		return;
> +
> +	clk = kzalloc(sizeof(*clk), GFP_KERNEL);
> +	if (!clk)
> +		return;
> +	clk->rate = rate;
> +
> +	of_clk_add_provider(node, of_fixed_clk_get, clk);
> +}

Just take the fixed clk as example, I have a node below as a blob,
which has 3 fixed clks encoded.

ref_clk: ref {
	compatible = "fixed-clock", "basic-clock";
	#clock-cells = <1>;
	clock-frequency = <24000000 32768 0>;
	clock-output-name = "osc",
			    "ckil",
			    "ckih";
};

If this is valid, the of_fixed_clk_setup() should scan the node for
multiple clks, right?

-- 
Regards,
Shawn

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ