[PATCH 11/11] m68k: probe CPU identity for ColdFire 5441x types

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

 



The ColdFire 5441x family of SoCs (including 54410, 54415, 54416, 54417
and 54418) 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/m5441x.c       | 29 +++++++++++++++++++++++++++++
 arch/m68k/include/asm/m5441xsim.h | 13 +++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c
index 405e9d5c832c..07d41fb24935 100644
--- a/arch/m68k/coldfire/m5441x.c
+++ b/arch/m68k/coldfire/m5441x.c
@@ -17,6 +17,7 @@
 #include <asm/mcfuart.h>
 #include <asm/mcfdma.h>
 #include <asm/mcfclk.h>
+#include <asm/setup.h>
 
 DEFINE_CLK(0, "flexbus", 2, MCF_CLK);
 DEFINE_CLK(0, "flexcan.0", 8, MCF_CLK);
@@ -239,8 +240,36 @@ static void __init m5441x_fec_init(void)
 	__raw_writeb(0x03, MCFGPIO_PAR_FEC);
 }
 
+static void __init m5441x_probe_cpu(void)
+{
+	u16 v;
+
+	v = __raw_readw(MCF_CIR);
+
+	switch (MCFCIR_PIN(v)) {
+	case MCFCIR_54410:
+		m68k_cpuname = "54410";
+		break;
+	case MCFCIR_54415:
+		m68k_cpuname = "54415";
+		break;
+	case MCFCIR_54416:
+		m68k_cpuname = "54416";
+		break;
+	case MCFCIR_54417:
+		m68k_cpuname = "54417";
+		break;
+	case MCFCIR_54418:
+		m68k_cpuname = "54418";
+		break;
+	}
+
+	m68k_cpurevision = MCFCIR_PRN(v);
+}
+
 void __init config_BSP(char *commandp, int size)
 {
+	m5441x_probe_cpu();
 	m5441x_clk_init();
 	mach_sched_init = hw_timer_init;
 	m5441x_uarts_init();
diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m5441xsim.h
index bb713b2f0c71..d38a65cb7ee8 100644
--- a/arch/m68k/include/asm/m5441xsim.h
+++ b/arch/m68k/include/asm/m5441xsim.h
@@ -333,4 +333,17 @@
 #define MCF_IRQ_BOFF1		(MCFINT1_VECBASE + MCFINT1_FLEXCAN1_BOFF)
 #define MCF_IRQ_ERR1		(MCFINT1_VECBASE + MCFINT1_FLEXCAN1_ERR)
 
+/*
+ * Chip Identification.
+ */
+#define MCF_CIR			0xec09000a
+#define MCFCIR_PRN(x)		((x) & 0x3f)	/* Chip revision */
+#define MCFCIR_PIN(x)		((x) >> 6)	/* Chip ID */
+
+#define MCFCIR_54410		0x9f
+#define MCFCIR_54415		0xa0
+#define MCFCIR_54416		0xa1
+#define MCFCIR_54417		0xa2
+#define MCFCIR_54418		0xa3
+
 #endif /* m5441xsim_h */
-- 
2.25.1




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

  Powered by Linux