[PATCH 05/11] m68knommu: probe CPU identity for ColdFire 5249/5251 types

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

 



The ColdFire 5249 and 5251 family of SoCs have a Device Identification
Register 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/m5249.c       | 12 ++++++++++++
 arch/m68k/coldfire/m525x.c       | 12 ++++++++++++
 arch/m68k/include/asm/m525xsim.h | 10 ++++++++++
 3 files changed, 34 insertions(+)

diff --git a/arch/m68k/coldfire/m5249.c b/arch/m68k/coldfire/m5249.c
index 6d66972de214..d795e18b52be 100644
--- a/arch/m68k/coldfire/m5249.c
+++ b/arch/m68k/coldfire/m5249.c
@@ -19,6 +19,7 @@
 #include <asm/coldfire.h>
 #include <asm/mcfsim.h>
 #include <asm/mcfclk.h>
+#include <asm/setup.h>
 
 /***************************************************************************/
 
@@ -121,10 +122,21 @@ static void __init m5249_smc91x_init(void)
 
 /***************************************************************************/
 
+static void __init m5249_probe_cpu(void)
+{
+	u32 v;
+
+	v = readl(MCF_DEVICEID);
+	if (MCFID(v) == MCFID_5249)
+		m68k_cpuname = "5249";
+	m68k_cpurevision = MCFREV(v);
+}
+
 void __init config_BSP(char *commandp, int size)
 {
 	mach_sched_init = hw_timer_init;
 
+	m5249_probe_cpu();
 #ifdef CONFIG_M5249C3
 	m5249_smc91x_init();
 #endif
diff --git a/arch/m68k/coldfire/m525x.c b/arch/m68k/coldfire/m525x.c
index 485375112e28..94a6b9def81a 100644
--- a/arch/m68k/coldfire/m525x.c
+++ b/arch/m68k/coldfire/m525x.c
@@ -19,6 +19,7 @@
 #include <asm/coldfire.h>
 #include <asm/mcfsim.h>
 #include <asm/mcfclk.h>
+#include <asm/setup.h>
 
 /***************************************************************************/
 
@@ -75,10 +76,21 @@ static void __init m525x_i2c_init(void)
 
 /***************************************************************************/
 
+static void __init m525x_probe_cpu(void)
+{
+	u32 v;
+
+	v = readl(MCF_DEVICEID);
+	if (MCFID(v) == MCFID_5251)
+		m68k_cpuname = "5251";
+	m68k_cpurevision = MCFREV(v);
+}
+
 void __init config_BSP(char *commandp, int size)
 {
 	mach_sched_init = hw_timer_init;
 
+	m525x_probe_cpu();
 	m525x_qspi_init();
 	m525x_i2c_init();
 
diff --git a/arch/m68k/include/asm/m525xsim.h b/arch/m68k/include/asm/m525xsim.h
index 2cb54f656701..80c38f242733 100644
--- a/arch/m68k/include/asm/m525xsim.h
+++ b/arch/m68k/include/asm/m525xsim.h
@@ -215,6 +215,16 @@
 #define MCFGPIO_IRQ_VECBASE	MCF_IRQ_GPIO0
 #endif
 
+/*
+ * Device ID and revision
+ */
+#define MCF_DEVICEID		(MCF_MBAR2 + 0xac)	/* Device ID */
+#define MCFID(x)		((x) >> 8)		/* Chip ID */
+#define MCFREV(x)		((x) & 0xff)		/* Chip revision */
+
+#define MCFID_5249		0x5448			/* MCF5249 */
+#define MCFID_5251		0x5251			/* MCF5251 */
+
 /****************************************************************************/
 
 #ifdef __ASSEMBLER__
-- 
2.25.1




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

  Powered by Linux