summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/anatop.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2013-08-13 08:59:43 +0200
committerShawn Guo <shawn.guo@linaro.org>2013-10-21 03:13:12 +0200
commitf1c6f314727c7595e249c7da3933ba2bc6219e58 (patch)
tree8e2550fbc365162f7914cb4410118207118005c7 /arch/arm/mach-imx/anatop.c
parentARM: imx6q: use common soc revision helpers (diff)
downloadlinux-f1c6f314727c7595e249c7da3933ba2bc6219e58.tar.xz
linux-f1c6f314727c7595e249c7da3933ba2bc6219e58.zip
ARM: imx: add a common function to initialize revision from anatop
The patch creates a common function imx_init_revision_from_anatop() by merging imx6q_init_revision() and imx_anatop_get_digprog(), so that any SoC that encodes revision info in anatop can use it to initialize revision. Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch/arm/mach-imx/anatop.c')
-rw-r--r--arch/arm/mach-imx/anatop.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c
index ad3b755abb78..b2d600f14937 100644
--- a/arch/arm/mach-imx/anatop.c
+++ b/arch/arm/mach-imx/anatop.c
@@ -16,6 +16,7 @@
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include "common.h"
+#include "hardware.h"
#define REG_SET 0x4
#define REG_CLR 0x8
@@ -76,21 +77,35 @@ static void imx_anatop_usb_chrg_detect_disable(void)
BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B);
}
-u32 imx_anatop_get_digprog(void)
+void __init imx_init_revision_from_anatop(void)
{
struct device_node *np;
void __iomem *anatop_base;
- static u32 digprog;
-
- if (digprog)
- return digprog;
+ unsigned int revision;
+ u32 digprog;
np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
anatop_base = of_iomap(np, 0);
WARN_ON(!anatop_base);
digprog = readl_relaxed(anatop_base + ANADIG_DIGPROG);
+ iounmap(anatop_base);
+
+ switch (digprog & 0xff) {
+ case 0:
+ revision = IMX_CHIP_REVISION_1_0;
+ break;
+ case 1:
+ revision = IMX_CHIP_REVISION_1_1;
+ break;
+ case 2:
+ revision = IMX_CHIP_REVISION_1_2;
+ break;
+ default:
+ revision = IMX_CHIP_REVISION_UNKNOWN;
+ }
- return digprog;
+ mxc_set_cpu_type(digprog >> 16 & 0xff);
+ imx_set_soc_revision(revision);
}
void __init imx_anatop_init(void)