All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Cooper <u-boot@lakedaemon.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] RFC [PATCH 2/5] arm/kirkwood: print speeds with cpu info.
Date: Tue, 26 Jul 2011 21:19:23 +0000	[thread overview]
Message-ID: <1311715171-13128-2-git-send-email-u-boot@lakedaemon.net> (raw)
In-Reply-To: <05ec95501d6c02ffeb1bc38d09fdca99142956a3.1307979826.git.u-boot@lakedaemon.net>


Signed-off-by: Jason Cooper <u-boot@lakedaemon.net>
---
 arch/arm/cpu/arm926ejs/kirkwood/cpu.c    |   46 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-kirkwood/cpu.h |    1 +
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index b4a4c04..a69f9f2 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -270,11 +270,26 @@ static void kw_sysrst_check(void)
 }
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
+#define MSAR_CPUCLCK_EXTRACT(X)	(((X & 0x2) >> 1) | ((X & 0x400000) >> 21) | \
+				((X & 0x18) >> 1))
+#define MSAR_L2CLCK_EXTRACT(X)  (((X & 0x600) >> 9) | ((X & 0x80000) >> 17))
+#define MSAR_DDRCLCK_RTIO_MASK  (0xf << 5)
+
+#define MSAR_TCLCK_OFFS		21
+#define MSAR_TCLCK_MASK		(0x1 << MSAR_TCLCK_OFFS)
+#define MV_BOARD_TCLK_166MHZ	166666667
+#define MV_BOARD_TCLK_200MHZ	200000000
+#define MSAR_TCLCK_167		(0x1 << MSAR_TCLCK_OFFS)
+#define MSAR_TCLCK_200		(0x0 << MSAR_TCLCK_OFFS)
+
 int print_cpuinfo(void)
 {
 	char *rev;
 	u16 devid = (readl(KW_REG_PCIE_DEVID) >> 16) & 0xffff;
 	u8 revid = readl(KW_REG_PCIE_REVID) & 0xff;
+	u32 cpu_clk, t_clk, tmp;
+	u32 sys_clk, l2_clk;
+	u32 l2_ratio, ddr_ratio;
 
 	if ((readl(KW_REG_DEVICE_ID) & 0x03) > 2) {
 		printf("Error.. %s:Unsupported Kirkwood SoC 88F%04x\n", __FUNCTION__, devid);
@@ -297,6 +312,37 @@ int print_cpuinfo(void)
 	}
 
 	printf("SoC:   Kirkwood 88F%04x_%s\n", devid, rev);
+
+	tmp = readl(MPP_SAMPLE_AT_RESET);
+	cpu_clk = MSAR_CPUCLCK_EXTRACT(tmp);
+	if (cpu_clk == 0x9)
+		cpu_clk = 1200;
+
+	l2_ratio = MSAR_L2CLCK_EXTRACT(tmp);
+	l2_clk = cpu_clk / l2_ratio;
+
+	ddr_ratio = tmp & MSAR_DDRCLCK_RTIO_MASK;
+	ddr_ratio = ddr_ratio >> 5;
+	if (ddr_ratio == 4)
+		sys_clk = 400;
+
+	switch (tmp & MSAR_TCLCK_MASK) {
+	case MSAR_TCLCK_167:
+		t_clk = MV_BOARD_TCLK_166MHZ;
+		break;
+	case MSAR_TCLCK_200:
+		t_clk = MV_BOARD_TCLK_200MHZ;
+		break;
+	default:
+		t_clk = MV_BOARD_TCLK_200MHZ;
+		break;
+	}
+
+	printf("CPU running @ %dMHz L2 running @ %dMHz\n",
+		cpu_clk, l2_clk);
+	printf("SysClock = %dMHz, TClock = %dMHz\n",
+		sys_clk, t_clk / 1000000);
+
 	return 0;
 }
 #endif /* CONFIG_DISPLAY_CPUINFO */
diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h b/arch/arm/include/asm/arch-kirkwood/cpu.h
index d28c51a..28ddd25 100644
--- a/arch/arm/include/asm/arch-kirkwood/cpu.h
+++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
@@ -41,6 +41,7 @@
 #define KW_REG_SYSRST_CNT		(KW_MPP_BASE + 0x50)
 #define SYSRST_CNT_1SEC_VAL		(25*1000000)
 #define KW_REG_MPP_OUT_DRV_REG		(KW_MPP_BASE + 0xE0)
+#define MPP_SAMPLE_AT_RESET		(KW_MPP_BASE + 0x30)
 
 enum memory_bank {
 	BANK0,
-- 
1.7.0.4

  parent reply	other threads:[~2011-07-26 21:19 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13 15:54 [U-Boot] [PATCH 0/1 v4] RFC: Dreamplug support u-boot at lakedaemon.net
2011-06-13 15:54 ` [U-Boot] [PATCH 1/1 v4] RFC: dreamplug: Initial support u-boot at lakedaemon.net
2011-06-13 15:59   ` Prafulla Wadaskar
2011-06-13 16:07     ` Jason
2011-06-13 16:46       ` Wolfgang Denk
2011-06-13 16:51         ` Jason
2011-07-21 19:36           ` Clint Adams
2011-07-21 20:26             ` Jason
2011-07-21 20:56               ` Clint Adams
2011-07-21 21:17                 ` Jason
2011-07-26 21:19   ` [U-Boot] RFC [PATCH 0/5 v5] add dreamplug support Jason Cooper
2011-09-11 22:10     ` [U-Boot] [PATCH v6] dreamplug: initial board support u-boot at lakedaemon.net
2011-09-12  7:37       ` Igor Grinberg
2011-09-12 11:36         ` Jason
2011-09-12 11:45       ` [U-Boot] [PATCH v7] " Jason Cooper
2011-09-13  7:32         ` Igor Grinberg
2011-09-13 13:53           ` Jason
2011-09-13 11:56         ` Prafulla Wadaskar
2011-09-13 13:00           ` Wolfgang Denk
2011-09-13 14:17             ` Jason
2011-09-14  6:39               ` Prafulla Wadaskar
2011-09-18 17:58                 ` Albert ARIBAUD
2011-09-18 18:27                   ` Albert ARIBAUD
2011-09-18 18:39                   ` Jason
2011-09-18 20:28                     ` Wolfgang Denk
2011-09-18 20:58                       ` Jason
2011-09-18 19:06         ` [U-Boot] [PATCH v8] " Jason Cooper
2011-10-03  4:37           ` Prafulla Wadaskar
2011-07-26 21:19   ` [U-Boot] RFC [PATCH 1/5] drivers/rtc: add Marvell Integrated RTC Jason Cooper
2011-07-27 18:12     ` Prafulla Wadaskar
2011-07-28  1:22       ` Jason
2011-07-28 19:09         ` Prafulla Wadaskar
2011-07-26 21:19   ` Jason Cooper [this message]
2011-07-27 18:21     ` [U-Boot] RFC [PATCH 2/5] arm/kirkwood: print speeds with cpu info Prafulla Wadaskar
2011-07-28  1:31       ` Jason
2011-07-28 19:14         ` Prafulla Wadaskar
2011-10-06 18:13     ` Wolfgang Denk
2011-10-07 12:37       ` Jason
2011-07-26 21:19   ` [U-Boot] RFC [PATCH 3/5] usb: Some EHCI chipsets are slow to respond Jason Cooper
2011-07-27 18:23     ` Prafulla Wadaskar
2011-07-28  1:37       ` Jason
2011-07-28 19:16         ` Prafulla Wadaskar
2011-07-29 14:31           ` Jason
2011-07-26 21:19   ` [U-Boot] RFC [PATCH 4/5 v5] dreamplug: initial board support Jason Cooper
2011-07-27 18:38     ` Prafulla Wadaskar
2011-07-28  2:02       ` Jason
2011-07-28 19:37         ` Prafulla Wadaskar
2011-07-29 15:18           ` Jason
2011-07-29 18:57             ` Prafulla Wadaskar
2011-07-29 19:43               ` Jason
2011-10-06 18:15     ` Wolfgang Denk
2011-10-07 12:40       ` Jason
2011-07-26 21:19   ` [U-Boot] RFC [PATCH 5/5 v5] dreamplug: use MACH_TYPE_DREAMPLUG Jason Cooper
2011-07-27 18:40     ` Prafulla Wadaskar
2011-07-28  2:08       ` Jason
2011-07-28  7:25         ` Bdale Garbee
2011-07-28 12:43           ` Jason
2011-07-28 13:44             ` Bdale Garbee
2011-07-28 19:39         ` Prafulla Wadaskar
2011-07-29 15:25           ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311715171-13128-2-git-send-email-u-boot@lakedaemon.net \
    --to=u-boot@lakedaemon.net \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.