diff mbox

[U-Boot] mpc86xx: implement clocks command

Message ID 1318250188-13618-1-git-send-email-prabhakar.csengg@gmail.com
State Superseded
Delegated to: Kumar Gala
Headers show

Commit Message

spundhan.patches@gmail.com Oct. 10, 2011, 12:36 p.m. UTC
From: Prabhakar Lad <prabhakar.csengg@gmail.com>

print the clock information while booting causes additional
delay. Implemented the clocks command for printing the CPU,
MPX, DDR and LBC frequency info.

Signed-off-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
---
 arch/powerpc/cpu/mpc86xx/cpu.c |   50 ++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 17 deletions(-)
diff mbox

Patch

diff --git a/arch/powerpc/cpu/mpc86xx/cpu.c b/arch/powerpc/cpu/mpc86xx/cpu.c
index ffcc8e6..32f9932 100644
--- a/arch/powerpc/cpu/mpc86xx/cpu.c
+++ b/arch/powerpc/cpu/mpc86xx/cpu.c
@@ -46,7 +46,6 @@  void board_reset(void) __attribute__((weak, alias("__board_reset")));
 int
 checkcpu(void)
 {
-	sys_info_t sysinfo;
 	uint pvr, svr;
 	uint ver;
 	uint major, minor;
@@ -88,22 +87,6 @@  checkcpu(void)
 
 	printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
 
-	get_sys_info(&sysinfo);
-
-	puts("Clock Configuration:\n");
-	printf("       CPU:%-4s MHz, ", strmhz(buf1, sysinfo.freqProcessor));
-	printf("MPX:%-4s MHz\n", strmhz(buf1, sysinfo.freqSystemBus));
-	printf("       DDR:%-4s MHz (%s MT/s data rate), ",
-		strmhz(buf1, sysinfo.freqSystemBus / 2),
-		strmhz(buf2, sysinfo.freqSystemBus));
-
-	if (sysinfo.freqLocalBus > LCRR_CLKDIV) {
-		printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
-	} else {
-		printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
-		       sysinfo.freqLocalBus);
-	}
-
 	puts("L1:    D-cache 32 KB enabled\n");
 	puts("       I-cache 32 KB enabled\n");
 
@@ -219,3 +202,36 @@  void setup_ddr_bat(phys_addr_t dram_size)
 	write_bat(DBAT0, batu, CONFIG_SYS_DBAT0L);
 	write_bat(IBAT0, batu, CONFIG_SYS_IBAT0L);
 }
+
+/*
+ * Dump some core clocks.
+ */
+int mpc8xx_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	sys_info_t sysinfo;
+
+	get_sys_info(&sysinfo);
+
+	printf("   CPU:%-4s MHz, ", strmhz(buf1, sysinfo.freqProcessor));
+	printf("MPX:%-4s MHz\n", strmhz(buf1, sysinfo.freqSystemBus));
+	printf("   DDR:%-4s MHz (%s MT/s data rate), ",
+		strmhz(buf1, sysinfo.freqSystemBus / 2),
+		strmhz(buf2, sysinfo.freqSystemBus));
+
+	if (sysinfo.freqLocalBus > LCRR_CLKDIV) {
+		printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
+	} else {
+		printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
+		       sysinfo.freqLocalBus);
+	}
+
+	return 0;
+}
+
+/***************************************************/
+
+U_BOOT_CMD(
+	clocks,	CONFIG_SYS_MAXARGS, 1, mpc8xx_showclocks,
+	"Clock Configuration",
+	"      clocks"
+);