mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 9/9 V2] clkdev: add print clk info command
Date: Thu,  2 Sep 2010 21:41:50 +0200	[thread overview]
Message-ID: <1283456510-28086-9-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20100902194046.GA21449@game.jcrosoft.org>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@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..fe13f90 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 CLKDEV_LOOKUP
+	prompt "clock info command"
+	help
+	  show list of registered clock
+
 endmenu
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 717fea5..49d98df 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("Global clocks:\n");
+
+	list_for_each_entry(p, &clocks, node)
+		if (!p->dev_id)
+			printf("%s: %#wHz\n", p->con_id, clk_get_rate(p->clk));
+
+	puts("Device specific clocks:\n");
+
+	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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2010-09-02 19:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-02 14:10 [PATCH 0/9] preperation for sh adding Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 1/9] types.h: move __kernel_dev_t to include/linux/types.h Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 2/9] device: fix dev_name Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 3/9] stm8815: fix the uart device clock match Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 4/9] arm: move clkdev to drivers/clk Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 5/9] vsprintf: add %w and %w support to print unit Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 15:29   ` Uwe Kleine-König
2010-09-02 15:32     ` Uwe Kleine-König
     [not found]       ` <20100902155421.GB28968@game.jcrosoft.org>
2010-09-02 17:54         ` Uwe Kleine-König
2010-09-02 14:10 ` [PATCH 6/9] at91/clock: switch to %w for clock info printing Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 7/9] cfi_flash: use %W and IEEE 1541 format Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 8/9] use %W instead of size_human_readable and use " Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 9/9] clkdev: add print clk info command Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 15:22   ` Uwe Kleine-König
2010-09-02 19:40 ` [PATCH 0/9 V2] preperation for sh adding Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 1/9 V2] types.h: move __kernel_dev_t to include/linux/types.h Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 2/9 V2] device: fix dev_name Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 3/9 V2] stm8815: fix the uart device clock match Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 4/9 V2] arm: move clkdev to drivers/clk Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 5/9 V2] vsprintf: add %w and %w support to print unit Jean-Christophe PLAGNIOL-VILLARD
2010-09-03 18:34     ` Uwe Kleine-König
2010-09-02 19:41   ` [PATCH 6/9 V2] at91/clock: switch to %w for clock info printing Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 7/9 V2] cfi_flash: use %W and IEEE 1541 format Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 8/9 V2] use %W instead of size_human_readable and use " Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2010-09-16 10:38   ` [PATCH 0/9 V2] preperation for sh adding Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1283456510-28086-9-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox