Patchwork [U-Boot,v2,3/5] davinci: add clocks command

login
register
mail settings
Submitter Hadli, Manjunath
Date Oct. 17, 2011, 8:01 a.m.
Message ID <1318838504-9766-4-git-send-email-manjunath.hadli@ti.com>
Download mbox | patch
Permalink /patch/120105/
State Changes Requested
Delegated to: Tom Rini
Headers show

Comments

Hadli, Manjunath - Oct. 17, 2011, 8:01 a.m.
From: Manjunath Hadli <manjunath.hadli@ti.com>

add 'clocks' command to print various clock frequency info found
in SOC such as ARM core frequency, DSP core frequency and DDR
frequency.

Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
---
 arch/arm/cpu/arm926ejs/davinci/speed.c |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)
Andreas Bießmann - Oct. 17, 2011, 10:20 a.m.
Dear Manjunath Hadli,

Am 17.10.2011 10:01, schrieb manjunath.hadli@ti.com:
> From: Manjunath Hadli <manjunath.hadli@ti.com>
> 
> add 'clocks' command to print various clock frequency info found
> in SOC such as ARM core frequency, DSP core frequency and DDR
> frequency.

Isn't that the job of command 'bdi'? Why introduce a new, proprietary
command instead of changing still available ones?
Well maybe is a 'clocks' command really useful, but then it should be
provided to all with a clear interface and not hidden in some
architecture specific directory.

Best regards

Andreas Bießmann
Wolfgang Denk - Oct. 17, 2011, 10:53 a.m.
Dear "=?ISO-8859-1?Q?Andreas_Bie=DFmann?=",

In message <4E9C017D.1080407@gmail.com> you wrote:
>
> > add 'clocks' command to print various clock frequency info found
> > in SOC such as ARM core frequency, DSP core frequency and DDR
> > frequency.
> 
> Isn't that the job of command 'bdi'? Why introduce a new, proprietary
> command instead of changing still available ones?

"bdinfo" indeed should include major clock information, but does not
necissarily print all relevant data on a specific SoC.

> Well maybe is a 'clocks' command really useful, but then it should be
> provided to all with a clear interface and not hidden in some
> architecture specific directory.

Correct.  There are already several such implementations (in
arch/powerpc/cpu/mpc512x/speed.c and
arch/powerpc/cpu/mpc83xx/speed.c), now it is high time to turn this
into a generic command that can be used by everyone.

Best regards,

Wolfgang Denk

Patch

diff --git a/arch/arm/cpu/arm926ejs/davinci/speed.c b/arch/arm/cpu/arm926ejs/davinci/speed.c
index 3cc845f..8c570ca 100644
--- a/arch/arm/cpu/arm926ejs/davinci/speed.c
+++ b/arch/arm/cpu/arm926ejs/davinci/speed.c
@@ -25,6 +25,7 @@ 
 #include <netdev.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
+#include <command.h>
 
 /* offsets from PLL controller base */
 #define PLLC_PLLCTL	0x100
@@ -167,11 +168,21 @@  static unsigned pll_sysclk_mhz(unsigned pll_addr, unsigned div)
 	return DIV_ROUND_UP(base, 1000 * pll_div(pll_addr, div));
 }
 
-int print_cpuinfo(void)
+#ifdef DAVINCI_DM6467EVM
+unsigned int davinci_arm_clk_get()
+{
+	return pll_sysclk_mhz(DAVINCI_PLL_CNTRL0_BASE, ARM_PLLDIV) * 1000000;
+}
+#endif
+
+int showclocks(cmd_tbl_t *cmdtp,
+	int flag, int argc, char * const argv[])
 {
 	/* REVISIT fetch and display CPU ID and revision information
 	 * too ... that will matter as more revisions appear.
 	 */
+	printf("Clock configuration:\n");
+
 	printf("Cores: ARM %d MHz",
 			pll_sysclk_mhz(DAVINCI_PLL_CNTRL0_BASE, ARM_PLLDIV));
 
@@ -185,11 +196,11 @@  int print_cpuinfo(void)
 			pll_sysclk_mhz(DAVINCI_PLL_CNTRL1_BASE, DDR_PLLDIV)
 				/ 2);
 	return 0;
-}
 
-#ifdef DAVINCI_DM6467EVM
-unsigned int davinci_arm_clk_get()
-{
-	return pll_sysclk_mhz(DAVINCI_PLL_CNTRL0_BASE, ARM_PLLDIV) * 1000000;
 }
-#endif
+
+U_BOOT_CMD(
+	clocks,	1, 0, showclocks,
+	"display clocks",
+	""
+);