diff mbox

[U-Boot,RFC,2/2] zynq: Implement dump clock command

Message ID fe6dd55bfd38fe3b4feee67c71f40b924ab4f56c.1390388559.git.michal.simek@xilinx.com
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Michal Simek Jan. 22, 2014, 11:02 a.m. UTC
From: Soren Brinkmann <soren.brinkmann@xilinx.com>

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>
---
On the top of Zynq clk patches I have sent.

All paches available for testing here
git://git.denx.de/u-boot-microblaze.git
xnext/clk-cmd branch.

For example:
zynq-uboot> clk dump
clk		frequency
    armpll          1333333320
    ddrpll          1066666656
     iopll           999999990
 cpu_6or4x           666666660
 cpu_3or2x           333333330
    cpu_2x           222222220
    cpu_1x           111111110
    ddr_2x           355555552
    ddr_3x           533333328
       dci            10158730
     lqspi           199999998
       smc            22222222
      pcap           199999998
      gem0            25000000
      gem1            16666667
     fclk0            50000000
     fclk1            50000000
     fclk2            50000000
     fclk3            50000000
     sdio0            50000000
     sdio1            50000000
     uart0            50000000
     uart1            50000000
      spi0            15873016
      spi1            15873016
 usb0_aper           111111110
 usb1_aper           111111110
 gem0_aper           111111110
 gem1_aper           111111110
sdio0_aper           111111110
sdio1_aper           111111110
 spi0_aper           111111110
 spi1_aper           111111110
 can0_aper           111111110
 can1_aper           111111110
 i2c0_aper           111111110
 i2c1_aper           111111110
uart0_aper           111111110
uart1_aper           111111110
 gpio_aper           111111110
lqspi_aper           111111110
  smc_aper           111111110
   dbg_trc            66666666
   dbg_apb            66666666

 arch/arm/cpu/armv7/zynq/clk.c | 21 +++++++++++++++++++++
 include/configs/zynq-common.h |  1 +
 2 files changed, 22 insertions(+)

--
1.8.2.3
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/zynq/clk.c b/arch/arm/cpu/armv7/zynq/clk.c
index ea7a677..6a759a1 100644
--- a/arch/arm/cpu/armv7/zynq/clk.c
+++ b/arch/arm/cpu/armv7/zynq/clk.c
@@ -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>
@@ -641,3 +642,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;
+}
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index 9666f88..52f1c66 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -164,6 +164,7 @@ 
 #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 + \