diff mbox

[U-Boot,v2,19/37] rockchip: Add a simple 'clock' command

Message ID 1453430725-4641-20-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Jan. 22, 2016, 2:45 a.m. UTC
Add a command that displays the PLLs and their current rate.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/arm/mach-rockchip/board.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Simon Glass Jan. 22, 2016, 6:38 p.m. UTC | #1
On 21 January 2016 at 19:45, Simon Glass <sjg@chromium.org> wrote:
> Add a command that displays the PLLs and their current rate.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  arch/arm/mach-rockchip/board.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)

Applied to u-boot-rockchip.
diff mbox

Patch

diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index 380aa91..133d663 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -5,6 +5,7 @@ 
  */
 
 #include <common.h>
+#include <clk.h>
 #include <dm.h>
 #include <ram.h>
 #include <asm/io.h>
@@ -49,3 +50,26 @@  void enable_caches(void)
 void lowlevel_init(void)
 {
 }
+
+static int do_clock(cmd_tbl_t *cmdtp, int flag, int argc,
+		       char * const argv[])
+{
+	struct udevice *dev;
+
+	for (uclass_first_device(UCLASS_CLK, &dev);
+	     dev;
+	     uclass_next_device(&dev)) {
+		ulong rate;
+
+		rate = clk_get_rate(dev);
+		printf("%s: %lu\n", dev->name, rate);
+	}
+
+	return 0;
+}
+
+U_BOOT_CMD(
+	clock, 2, 1, do_clock,
+	"display information about clocks",
+	""
+);