diff mbox

[U-Boot,12/12] da850: print DDR frequency from u-boot

Message ID 1312299792-16415-13-git-send-email-nagabhushana.netagunte@ti.com
State Changes Requested
Headers show

Commit Message

nagabhushana.netagunte@ti.com Aug. 2, 2011, 3:43 p.m. UTC
From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>

Print DDR frequency when u-boot is coming up. Function
is added in hardware.h to find which PLL clock is used.

Signed-off-by: Rajashekhara, Sudhakar <sudhakar.raj@ti.com>
Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
---
 arch/arm/include/asm/arch-davinci/hardware.h |   16 ++++++++++++++--
 board/davinci/da8xxevm/da850evm.c            |    1 +
 2 files changed, 15 insertions(+), 2 deletions(-)

Comments

Wolfgang Denk Aug. 2, 2011, 4:33 p.m. UTC | #1
Dear nagabhushana.netagunte@ti.com,

In message <1312299792-16415-13-git-send-email-nagabhushana.netagunte@ti.com> you wrote:
> From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> 
> Print DDR frequency when u-boot is coming up. Function
> is added in hardware.h to find which PLL clock is used.

Please don;t add needless output to the standard boot messages.  You
can add this as part of the "clock" command if you consider the
information to be useful to your users.

Best regards,

Wolfgang Denk
nagabhushana.netagunte@ti.com Aug. 9, 2011, 1:40 p.m. UTC | #2
Hi Denk,

Thanks for the comments. It's a very good suggestion to add it as part of 
Command. Unfortunately, I am unable to locate the 'Clock' command source.
I would greatly appreciate if you can point it for me.

Thanks,
Nag

On Tue, Aug 02, 2011 at 22:03:26, Wolfgang Denk wrote:
> Dear nagabhushana.netagunte@ti.com,
> 
> In message <1312299792-16415-13-git-send-email-nagabhushana.netagunte@ti.com> you wrote:
> > From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> > 
> > Print DDR frequency when u-boot is coming up. Function is added in 
> > hardware.h to find which PLL clock is used.
> 
> Please don;t add needless output to the standard boot messages.  You can add this as part of the "clock" command if you consider the information to be useful to your users.
> 
> Best regards,
> 
> Wolfgang Denk
> 
> -- 
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de "I dislike companies that have a we-are-the-high-priests-of-hardware-
> so-you'll-like-what-we-give-you attitude. I like commodity markets in which iron-and-silicon hawkers know that they exist to  provide  fast
> toys for software types like me to play with..."    - Eric S. Raymond
>
Detlev Zundel Aug. 10, 2011, 10:47 a.m. UTC | #3
Hi Nag,

> Thanks for the comments. It's a very good suggestion to add it as part of 
> Command. Unfortunately, I am unable to locate the 'Clock' command source.
> I would greatly appreciate if you can point it for me.

"git grep -A 2 U_BOOT_CMD' is your friend.

Actually as far as I can see, there is no single generic command but
"clockinfo" (e.g. arch/arm/cpu/arm1136/mx35/generic.c) and "clocks"
(e.g. arch/powerpc/cpu/mpc83xx/speed.c).

Maybe we should use this opportunity to align them?  So what example
should we follow? Hm, oldest code wins, so here we go:

[dzu@pollux u-boot-testing (master)]$ for f in arch/arm/cpu/arm1136/mx35/generic.c arch/arm/cpu/armv7/mx5/clock.c arch/powerpc/cpu/mpc512x/speed.c arch/powerpc/cpu/mpc83xx/speed.c ; do git describe --contains `git log --follow --pretty=format:%H $f | tail -1` ; done
v2011.03-rc1~2^2~36
v2010.03-rc1~35
v1.3.0-rc4~69^2~1
U-Boot-1_1_3~20^2~7

So PowerPC wins ;)  I.e. please use "clocks" as the command name, and
I'd appreciate it if you send a patch changing the mx35 and mx5 code.

Cheers
  Detlev
nagabhushana.netagunte@ti.com Aug. 17, 2011, 12:47 p.m. UTC | #4
Detlev,

Thanks for detailed explanation. I will make appropriate patches
And send them separately(not as part of ongoing series). Even though
I love to make patches for mx35 and mx5 base, I am afraid I may not
Able to find time. But, I will do my best.

Thanks again for comments!
Nag

On Wed, Aug 10, 2011 at 16:17:30, Detlev Zundel wrote:
> Hi Nag,
> 
> > Thanks for the comments. It's a very good suggestion to add it as part 
> > of Command. Unfortunately, I am unable to locate the 'Clock' command source.
> > I would greatly appreciate if you can point it for me.
> 
> "git grep -A 2 U_BOOT_CMD' is your friend.
> 
> Actually as far as I can see, there is no single generic command but "clockinfo" (e.g. arch/arm/cpu/arm1136/mx35/generic.c) and "clocks"
> (e.g. arch/powerpc/cpu/mpc83xx/speed.c).
> 
> Maybe we should use this opportunity to align them?  So what example should we follow? Hm, oldest code wins, so here we go:
> 
> [dzu@pollux u-boot-testing (master)]$ for f in arch/arm/cpu/arm1136/mx35/generic.c arch/arm/cpu/armv7/mx5/clock.c arch/powerpc/cpu/mpc512x/speed.c arch/powerpc/cpu/mpc83xx/speed.c ; do git describe --contains `git log --follow --pretty=format:%H $f | tail -1` ; done
> v2011.03-rc1~2^2~36
> v2010.03-rc1~35
> v1.3.0-rc4~69^2~1
> U-Boot-1_1_3~20^2~7
> 
> So PowerPC wins ;)  I.e. please use "clocks" as the command name, and I'd appreciate it if you send a patch changing the mx35 and mx5 code.
> 
> Cheers
>   Detlev
> 
> --
> Be careful in casting out your devil 'lest you cast out the best thing about you.
>                            -- Friedrich Nietzsche
> --
> DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu@denx.de
>
Stefano Babic Aug. 17, 2011, 3:37 p.m. UTC | #5
On 08/17/2011 02:47 PM, Netagunte, Nagabhushana wrote:
>> Maybe we should use this opportunity to align them?  So what example should we follow? Hm, oldest code wins, so here we go:

Never heard about this rule, but I agree it makes no sense to have
differen commands.

>> [dzu@pollux u-boot-testing (master)]$ for f in arch/arm/cpu/arm1136/mx35/generic.c arch/arm/cpu/armv7/mx5/clock.c arch/powerpc/cpu/mpc512x/speed.c arch/powerpc/cpu/mpc83xx/speed.c ; do git describe --contains `git log --follow --pretty=format:%H $f | tail -1` ; done
>> v2011.03-rc1~2^2~36
>> v2010.03-rc1~35
>> v1.3.0-rc4~69^2~1
>> U-Boot-1_1_3~20^2~7
>>
>> So PowerPC wins ;)  I.e. please use "clocks" as the command name, and I'd appreciate it if you send a patch changing the mx35 and mx5 code.

No luck here for i.MX ;-). I will send the patch to change the command
name for i.MX.

Regards,
Stefano
Detlev Zundel Aug. 17, 2011, 3:48 p.m. UTC | #6
Hi Stefano,

> On 08/17/2011 02:47 PM, Netagunte, Nagabhushana wrote:
>>> Maybe we should use this opportunity to align them?  So what
>>> example should we follow? Hm, oldest code wins, so here we go:
>
> Never heard about this rule, but I agree it makes no sense to have
> differen commands.

You never heard about the principle of least surprise?  Commands doing
the same thing should be called by the same name...

>>> [dzu@pollux u-boot-testing (master)]$ for f in
>>> arch/arm/cpu/arm1136/mx35/generic.c arch/arm/cpu/armv7/mx5/clock.c
>>> arch/powerpc/cpu/mpc512x/speed.c arch/powerpc/cpu/mpc83xx/speed.c ;
>>> do git describe --contains `git log --follow --pretty=format:%H $f
>>> | tail -1` ; done
>>> v2011.03-rc1~2^2~36
>>> v2010.03-rc1~35
>>> v1.3.0-rc4~69^2~1
>>> U-Boot-1_1_3~20^2~7
>>>
>>> So PowerPC wins ;) I.e. please use "clocks" as the command name,
>>> and I'd appreciate it if you send a patch changing the mx35 and mx5
>>> code.
>
> No luck here for i.MX ;-). I will send the patch to change the command
> name for i.MX.

Thanks in advance!  I really hope that this command was never widely
used so we don't need to keep an deprecated alias for some time...

/me ducks and runs

Cheers
  Detlev
diff mbox

Patch

diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h
index fda8203..e0473c9 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -35,7 +35,7 @@ 
 
 #include <config.h>
 #include <asm/sizes.h>
-
+#include <asm/io.h>
 #define	REG(addr)	(*(volatile unsigned int *)(addr))
 #define REG_P(addr)	((volatile unsigned int *)(addr))
 
@@ -381,8 +381,14 @@  struct davinci_pllc_regs {
 #define DAVINCI_PLLC_DIV_MASK	0x1f
 
 #define ASYNC3          get_async3_src()
-#define PLL1_SYSCLK2		((1 << 16) | 0x2)
+#define EMIFB		get_emifb_src()
+
+#define PLL1_PLLM	((1 << 16) | DAVINCI_PLLM_CLKID)
+#define PLL1_SYSCLK1	((1 << 16) | 0x1)
+#define PLL1_SYSCLK2	((1 << 16) | 0x2)
 #define DAVINCI_SPI1_CLKID  (cpu_is_da830() ? 2 : ASYNC3)
+#define DAVINCI_DDR_CLKID	EMIFB
+
 /* Clock IDs */
 enum davinci_clk_ids {
 	DAVINCI_SPI0_CLKID = 2,
@@ -486,6 +492,12 @@  static inline int get_async3_src(void)
 			PLL1_SYSCLK2 : 2;
 }
 
+static inline int get_emifb_src(void)
+{
+	return (readl(&davinci_syscfg_regs->cfgchip3) & 0x80) ?
+			PLL1_PLLM : PLL1_SYSCLK1;
+}
+
 #endif /* CONFIG_SOC_DA8XX */
 
 #endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index a0b4425..3a4f041 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -507,6 +507,7 @@  int misc_init_r(void)
 	int ret;
 
 	printf("ARM Clock : %d Hz\n", clk_get(DAVINCI_ARM_CLKID));
+	printf("DDR Clock : %d Hz\n", clk_get(DAVINCI_DDR_CLKID)/2);
 
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
 		/* Read Ethernet MAC address from EEPROM */