[PATCH 9/9] clkdev: add print clk info command

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Thu Sep 2 11:22:31 EDT 2010


On Thu, Sep 02, 2010 at 04:10:24PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
>  commands/Kconfig     |    7 +++++++
>  drivers/clk/clkdev.c |   33 +++++++++++++++++++++++++++++++++
>  2 files changed, 40 insertions(+), 0 deletions(-)
> 
> diff --git a/commands/Kconfig b/commands/Kconfig
> index 57c9b75..f20c2e1 100644
> --- a/commands/Kconfig
> +++ b/commands/Kconfig
> @@ -338,4 +338,11 @@ config CMD_I2C
>  	  include i2c_probe, i2c_read and i2c_write commands to communicate
>  	  on i2c bus.
>  
> +config CMD_CLOCK_INFO
> +	bool
> +	depends on LOOKUP_CLKDEV
> +	prompt "clock info command"
> +	help
> +	  shop list of registered clock
> +
>  endmenu
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index 717fea5..d78d3e0 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -11,6 +11,7 @@
>   */
>  
>  #include <common.h>
> +#include <command.h>
>  #include <linux/list.h>
>  #include <errno.h>
>  #include <linux/err.h>
> @@ -166,3 +167,35 @@ void clkdev_drop(struct clk_lookup *cl)
>  	kfree(cl);
>  }
>  EXPORT_SYMBOL(clkdev_drop);
> +
> +#ifdef CONFIG_CMD_CLOCK_INFO
> +static int do_clock_info(struct command *cmdtp, int argc, char *argv[])
> +{
> +	struct clk_lookup *p;
> +
> +	puts("Clocks\n");
"global clocks"?
> +
> +	list_for_each_entry(p, &clocks, node)
> +		if (!p->dev_id)
> +			printf("%s: %wHz\n", p->con_id, clk_get_rate(p->clk));
> +
> +	puts("Clocks for dev\n");
"device specific clocks"?

> +
> +	list_for_each_entry(p, &clocks, node)
> +		if (p->dev_id)
> +			printf("%s[%s]: %wHz\n", p->con_id, p->dev_id,
> +					       clk_get_rate(p->clk));
> +
> +	return 0;
> +}
> +
> +static const __maybe_unused char cmd_clock_info_help[] =
> +"Print clocks info\n"
> +;
> +
> +BAREBOX_CMD_START(clock_info)
> +	.cmd		= do_clock_info,
> +	.usage		= "Clocks Info",
> +	BAREBOX_CMD_HELP(cmd_clock_info_help)
> +BAREBOX_CMD_END
> +#endif
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the barebox mailing list