Skip to contentSkip to conversation

ARM: MX3: fix CPU revision number detection

PATCH New Daniel Mack 1 participant 1 message Nov 21, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: MX3: fix CPU revision number detection

The macro mx31_revision() used to take the global variable system_rev to determine the CPU revision number. However, this number is expected to be set by the bootloader and is usually zero (at least on my MX31 based boards here). More than that, it is usually taken to identify the board's revision, not the CPU's.

Fix that by reading the the CPU's SREV register instead.

Right now, mx31_read_cpu_rev() is called from mx31_clocks_init() which is admittedly not a good place for it. However, we need to enable the IIM clock first, and the clock code also has conditional code that depends on mx31_revision() returning the right thing.

---
 arch/arm/mach-mx3/Makefile            |    2 +-
 arch/arm/mach-mx3/clock.c             |    2 +
 arch/arm/mach-mx3/cpu.c               |   57 +++++++++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/mx3x.h |    5 ++-
 4 files changed, 63 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-mx3/cpu.c
arch/arm/mach-mx3/Makefile +1 -1
index d47a674..47e9358 100644
@@ -4,7 +4,7 @@
 
 # Object file lists.
 
-obj-y				:= mm.o devices.o
+obj-y				:= mm.o devices.o cpu.o
 obj-$(CONFIG_MX3_SDMA)		+= sdma/
 obj-$(CONFIG_ARCH_MX31)		+= clock.o iomux.o
 obj-$(CONFIG_ARCH_MX35)		+= clock-imx35.o
arch/arm/mach-mx3/clock.c +2 -0
index e147084..23866fc 100644
@@ -616,6 +616,8 @@ int __init mx31_clocks_init(unsigned long fref)
 
 	clk_enable(&serial_pll_clk);
 
+	mx31_read_cpu_rev();
+
 	if (mx31_revision() >= CHIP_REV_2_0) {
 		reg = __raw_readl(MXC_CCM_PMCR1);
 		/* No PLL restart on DVFS switch; enable auto EMI handshake */
arch/arm/mach-mx3/cpu.c new file +57 -0

57 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mx3x.h +3 -2
index 009f444..d9613d6 100644
@@ -263,11 +263,12 @@
 
 #if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
 
-extern unsigned int system_rev;
+extern unsigned int mx31_cpu_rev;
+extern void mx31_read_cpu_rev(void);
 
 static inline int mx31_revision(void)
 {
-	return system_rev;
+	return mx31_cpu_rev;
 }
 #endif
 
Signature · 1 line
1.6.5.2