[PATCH 03/11] m68knommu: probe CPU identity for ColdFire 520x types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The ColdFire 520x family of SoCs (including 5207 and 5208) have a Chip
Identification Register (CIR) that can be used to determine the exact
SoC family member. Read this at startup to report the exact SoC type
and its revision number.

Signed-off-by: Greg Ungerer <gerg@xxxxxxxxxxxxxx>
---
 arch/m68k/coldfire/m520x.c       | 21 +++++++++++++++++++++
 arch/m68k/include/asm/m520xsim.h | 10 ++++++++++
 2 files changed, 31 insertions(+)

diff --git a/arch/m68k/coldfire/m520x.c b/arch/m68k/coldfire/m520x.c
index d2f96b40aee1..30b85c7fb460 100644
--- a/arch/m68k/coldfire/m520x.c
+++ b/arch/m68k/coldfire/m520x.c
@@ -22,6 +22,7 @@
 #include <asm/mcfsim.h>
 #include <asm/mcfuart.h>
 #include <asm/mcfclk.h>
+#include <asm/setup.h>
 
 /***************************************************************************/
 
@@ -185,9 +186,29 @@ static void __init m520x_fec_init(void)
 
 /***************************************************************************/
 
+static void __init m520x_probe_cpu(void)
+{
+	u16 v;
+
+	v = readw(MCF_CIR);
+
+	switch (MCFCIR_PIN(v)) {
+	case MCFCIR_5208:
+		m68k_cpuname = "5208";
+		break;
+	case MCFCIR_5207:
+		m68k_cpuname = "5207";
+		break;
+	}
+
+	m68k_cpurevision = MCFCIR_PRN(v);
+}
+
 void __init config_BSP(char *commandp, int size)
 {
 	mach_sched_init = hw_timer_init;
+
+	m520x_probe_cpu();
 	m520x_clk_init();
 	m520x_uarts_init();
 	m520x_fec_init();
diff --git a/arch/m68k/include/asm/m520xsim.h b/arch/m68k/include/asm/m520xsim.h
index af2c708a528c..dada224bf26e 100644
--- a/arch/m68k/include/asm/m520xsim.h
+++ b/arch/m68k/include/asm/m520xsim.h
@@ -209,5 +209,15 @@
 #define MCFI2C_BASE0		0xFC058000
 #define MCFI2C_SIZE0		0x40
 
+/*
+ * Chip Identification.
+ */
+#define MCF_CIR			0xFC0A000A
+#define MCFCIR_PRN(x)		((x) & 0x3f)		/* Chip revision */
+#define MCFCIR_PIN(x)		(((x) >> 6) & 0x3ff)	/* Chip ID */
+
+#define MCFCIR_5207		0x45
+#define MCFCIR_5208		0x44
+
 /****************************************************************************/
 #endif  /* m520xsim_h */
-- 
2.25.1




[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux