ARM: MX3: fix CPU revision number detection
Subsystems (3)
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
@@ -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
@@ -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
@@ -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
PATCH 1/1 ARM: MX3: fix CPU revision number detection
Quoted 11 lines · Daniel Mack
arch/arm/mach-mx3/cpu.c new file +5
-0@@ -0,0 +1,57 @@ +/* +* MX3 CPU type detection +* +* Copyright (c) 2009 Daniel Mack <[email protected]> +*
arch/arm/mach-mx3/cpu.c line 15
Quoted 10 lines
arch/arm/mach-mx3/cpu.c new file +10
-0+* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +#include <linux/module.h> +#include <mach/hardware.h> +#include <mach/iim.h> +#include <asm/io.h>
I see red. linux/io.h please.
PATCH 1/1 ARM: MX3: fix CPU revision number detection
Quoted 16 lines · Russell King - ARM Linux
Quoted 15 lines · Daniel Mack
arch/arm/mach-mx3/cpu.c new file +9
-0@@ -0,0 +1,57 @@ +/* +* MX3 CPU type detection +* +* Copyright (c) 2009 Daniel Mack <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version.
Quoted 8 lines
arch/arm/mach-mx3/cpu.c line 15
Quoted 6 lines
arch/arm/mach-mx3/cpu.c new file +6
-0+*/ + +#include <linux/module.h> +#include <mach/hardware.h> +#include <mach/iim.h> +#include <asm/io.h> I see red.
linux/io.hplease.
Oops. See below.
Daniel
PATCH 1/1 ARM: MX3: fix CPU revision number detection
Quoted 33 lines · Daniel Mack
From
5e080a57b92a7e5e9f08286fc140aebb6ea356c4Mon Sep 17 00:00:00 2001
From: Daniel Mack <[email protected]>
Date: Sat, 21 Nov 2009 15:15:02 +0100
Subject: [PATCH] ARM: MX3: fix CPU revision number detectionThe macro
mx31_revision()used to take the global variablesystem_revto 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 frommx31_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 onmx31_revision()returning the right thing.Signed-off-by Daniel Mack <[email protected]>--- 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.carch/arm/mach-mx3/Makefile +0
-0
arch/arm/mach-mx3/Makefile line 8
Quoted 6 lines
arch/arm/mach-mx3/Makefile +1
-1@@ -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/
So you are working on the SDMA code? Nice. We all hope to see patches soon ;)
Anyway, please make sure that your patches are based on mainline or mxc-master.
Applied to mxc-master.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH 1/1 ARM: MX3: fix CPU revision number detection
In reply to Russell King - ARM LinuxQuoted 16 lines · Russell King - ARM Linux
Quoted 15 lines · Daniel Mack
arch/arm/mach-mx3/cpu.c new file +9
-0@@ -0,0 +1,57 @@ +/* +* MX3 CPU type detection +* +* Copyright (c) 2009 Daniel Mack <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version.
Quoted 8 lines
arch/arm/mach-mx3/cpu.c line 15
Quoted 6 lines
arch/arm/mach-mx3/cpu.c new file +6
-0+*/ + +#include <linux/module.h> +#include <mach/hardware.h> +#include <mach/iim.h> +#include <asm/io.h> I see red.
linux/io.hplease.
BTW, as a reminder, the reason I pick up on these soo much is because I've configured my mail client (mutt) to highlight them:
color body white red "\\+.*(#include <(asm|mach)/(gp)?io\.h>|return -1|default n)"
which matches new uses of 'asm/io.h', 'mach/io.h', 'asm/gpio.h', 'mach/gpio.h', 'return -1' and 'default n' in patches.
PATCH 1/1 ARM: MX3: fix CPU revision number detection
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines · Russell King - ARM Linux
Quoted 1 line · Daniel Mack
+#include <
asm/io.h>I see red.
linux/io.hplease.
Quoted 7 lines
BTW, as a reminder, the reason I pick up on these soo much is because I've configured my mail client (mutt) to highlight them:
color body white red "\\+.*(#include <(asm|mach)/(gp)?io\.h>|return -1|default n)"
which matches new uses of '
asm/io.h', 'mach/io.h', 'asm/gpio.h', 'mach/gpio.h', 'return -1' and 'default n' in patches.
That is quite handy, but when my own patches are parsed by mutt, it's usually too late ;) I'll hack a git-pre-commit script to prevent that in the future. Or does anyone have that ready yet?
Daniel