zynq: Implement dump clock command
authorSoren Brinkmann <soren.brinkmann@xilinx.com>
Thu, 21 Nov 2013 21:39:03 +0000 (13:39 -0800)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 19 Feb 2014 08:41:22 +0000 (09:41 +0100)
Enable and implement dump clock command which shows
soc frequencies.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm/cpu/armv7/zynq/clk.c
include/configs/zynq-common.h

index 0891a23526a2507fa1793496625aed0117ed13c3..43071111c4dc8c45f0daee59d39e26f49a406b84 100644 (file)
@@ -6,6 +6,7 @@
  */
 #include <common.h>
 #include <errno.h>
+#include <clk.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/clk.h>
@@ -636,3 +637,23 @@ const char *zynq_clk_get_name(enum zynq_clk clk)
 {
        return clks[clk].name;
 }
+
+/**
+ * soc_clk_dump() - Print clock frequencies
+ * Returns zero on success
+ *
+ * Implementation for the clk dump command.
+ */
+int soc_clk_dump(void)
+{
+       int i;
+
+       printf("clk\t\tfrequency\n");
+       for (i = 0; i < clk_max; i++) {
+               const char *name = zynq_clk_get_name(i);
+               if (name)
+                       printf("%10s%20lu\n", name, zynq_clk_get_rate(i));
+       }
+
+       return 0;
+}
index 406ccaf9df83c356c5cc6caef24ba96152110597..d6dc74581e455bbb23c3ec52faf7aa82e41522d8 100644 (file)
 #define CONFIG_BOARD_LATE_INIT
 #define CONFIG_SYS_LONGHELP
 #define CONFIG_CLOCKS
+#define CONFIG_CMD_CLK
 #define CONFIG_SYS_MAXARGS             15 /* max number of command args */
 #define CONFIG_SYS_CBSIZE              256 /* Console I/O Buffer Size */
 #define CONFIG_SYS_PBSIZE              (CONFIG_SYS_CBSIZE + \