[U-Boot] [PATCH] mpc86xx: implement clocks command

spundhan.patches at gmail.com spundhan.patches at gmail.com
Mon Oct 10 14:36:28 CEST 2011


From: Prabhakar Lad <prabhakar.csengg at 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 at gmail.com>
---
 arch/powerpc/cpu/mpc86xx/cpu.c |   50 ++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 17 deletions(-)

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"
+);
-- 
1.7.0.4



More information about the U-Boot mailing list