[U-Boot] [PATCH 4/4 v2] mxs: generalize code for print_cpuinfo()

Otavio Salvador otavio at ossystems.com.br
Sat Jun 23 22:31:17 CEST 2012


The information now is gathered from HW_DIGCTL_CHIPID register and
includes the revision of the chip on the output.

Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
Cc: Marek Vasut <marex at denx.de>
Cc: Stefano Babic <sbabic at denx.de>
Cc: Fabio Estevam <fabio.estevam at freescale.com>
---
Changes since v1:
 * Move mask and product code to regs-digctl.h

 arch/arm/cpu/arm926ejs/mx28/mx28.c           |   53 +++++++++++++++++++++++++-
 arch/arm/include/asm/arch-mx28/regs-digctl.h |    5 +++
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c b/arch/arm/cpu/arm926ejs/mx28/mx28.c
index a82ff25..a6e5036 100644
--- a/arch/arm/cpu/arm926ejs/mx28/mx28.c
+++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c
@@ -190,13 +190,62 @@ int arch_cpu_init(void)
 #endif
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
+static const char *get_cpu_type(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) {
+	case HW_DIGCTL_CHIPID_MX28:
+		return "28";
+	case HW_DIGCTL_CHIPID_MX23:
+		return "23";
+	default:
+		return "<unknown>";
+	}
+}
+
+static const char *get_cpu_rev(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+	uint8_t rev = readl(&digctl_regs->hw_digctl_chipid) & 0x000000FF;
+
+	switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) {
+	case HW_DIGCTL_CHIPID_MX28:
+		switch (rev) {
+		case 0x1:
+			return "TO1.2";
+		default:
+			return "<unknown>";
+		}
+	case HW_DIGCTL_CHIPID_MX23:
+		switch (rev) {
+		case 0x0:
+			return "TA1";
+		case 0x1:
+			return "TA2";
+		case 0x2:
+			return "TA3";
+		case 0x3:
+			return "TA4";
+		case 0x5:
+			return "TA5";
+		}
+	default:
+		return "<unknown>";
+	}
+}
+
 int print_cpuinfo(void)
 {
 	struct mx28_spl_data *data = (struct mx28_spl_data *)
 		((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);
 
-	printf("Freescale i.MX28 family at %d MHz\n",
-			mxc_get_clock(MXC_ARM_CLK) / 1000000);
+	printf("CPU:   Freescale i.MX%s %s at %d MHz\n",
+		get_cpu_type(),
+		get_cpu_rev(),
+		mxc_get_clock(MXC_ARM_CLK) / 1000000);
 	printf("BOOT:  %s\n", mx28_boot_modes[data->boot_mode_idx].mode);
 	return 0;
 }
diff --git a/arch/arm/include/asm/arch-mx28/regs-digctl.h b/arch/arm/include/asm/arch-mx28/regs-digctl.h
index 9a63594..67f91e7 100644
--- a/arch/arm/include/asm/arch-mx28/regs-digctl.h
+++ b/arch/arm/include/asm/arch-mx28/regs-digctl.h
@@ -152,4 +152,9 @@ struct mx28_digctl_regs {
 };
 #endif
 
+/* Product code identification */
+#define HW_DIGCTL_CHIPID_MASK	(0xffff << 16)
+#define HW_DIGCTL_CHIPID_MX23	(0x3780 << 16)
+#define HW_DIGCTL_CHIPID_MX28	(0x2800 << 16)
+
 #endif /* __MX28_REGS_DIGCTL_H__ */
-- 
1.7.10



More information about the U-Boot mailing list