From: Dinh.Nguyen@freescale.com (Dinh.Nguyen at freescale.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv5 1/4] ARM: mx50: Add support to get the silicon revision
Date: Mon, 21 Mar 2011 16:30:35 -0500 [thread overview]
Message-ID: <1300743038-3901-1-git-send-email-Dinh.Nguyen@freescale.com> (raw)
From: Dinh Nguyen <Dinh.Nguyen@freescale.com>
For MX50, the HW_ADADIG_DIGPROG register in the ANATOP module will
have the correct silicon revision:
Major Minor Description
0x50 0x0 TO1.0
0x50 0x1 TO1.1
Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
---
arch/arm/mach-mx5/cpu.c | 39 +++++++++++++++++++++++++++++++++
arch/arm/plat-mxc/include/mach/mx50.h | 4 +++
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx5/cpu.c b/arch/arm/mach-mx5/cpu.c
index df46b5e..c205494 100644
--- a/arch/arm/mach-mx5/cpu.c
+++ b/arch/arm/mach-mx5/cpu.c
@@ -21,6 +21,7 @@
static int cpu_silicon_rev = -1;
#define IIM_SREV 0x24
+#define MX50_HW_ADADIG_DIGPROG 0xB0
static int get_mx51_srev(void)
{
@@ -107,6 +108,44 @@ int mx53_revision(void)
}
EXPORT_SYMBOL(mx53_revision);
+static int get_mx50_srev(void)
+{
+ void __iomem *anatop = ioremap(MX50_ANATOP_BASE_ADDR, SZ_8K);
+ u32 rev;
+
+ if (!anatop) {
+ cpu_silicon_rev = -EINVAL;
+ return 0;
+ }
+
+ rev = readl(anatop + MX50_HW_ADADIG_DIGPROG);
+ rev &= 0xff;
+
+ iounmap(anatop);
+ if (rev == 0x0)
+ return IMX_CHIP_REVISION_1_0;
+ else if (rev == 0x1)
+ return IMX_CHIP_REVISION_1_1;
+ return 0;
+}
+
+/*
+ * Returns:
+ * the silicon revision of the cpu
+ * -EINVAL - not a mx50
+ */
+int mx50_revision(void)
+{
+ if (!cpu_is_mx50())
+ return -EINVAL;
+
+ if (cpu_silicon_rev == -1)
+ cpu_silicon_rev = get_mx50_srev();
+
+ return cpu_silicon_rev;
+}
+EXPORT_SYMBOL(mx50_revision);
+
static int __init post_cpu_init(void)
{
unsigned int reg;
diff --git a/arch/arm/plat-mxc/include/mach/mx50.h b/arch/arm/plat-mxc/include/mach/mx50.h
index aaec2a6..5f2da75 100644
--- a/arch/arm/plat-mxc/include/mach/mx50.h
+++ b/arch/arm/plat-mxc/include/mach/mx50.h
@@ -282,4 +282,8 @@
#define MX50_INT_APBHDMA_CHAN6 116
#define MX50_INT_APBHDMA_CHAN7 117
+#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
+extern int mx50_revision(void);
+#endif
+
#endif /* ifndef __MACH_MX50_H__ */
--
1.6.0.4
next reply other threads:[~2011-03-21 21:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-21 21:30 Dinh.Nguyen at freescale.com [this message]
2011-03-21 21:30 ` [PATCHv5 2/4] ARM: mx51: Add entry for gpc_dvfs_clk Dinh.Nguyen at freescale.com
2011-03-21 21:30 ` [PATCHv5 3/4] ARM: mx51: Implement code to allow mx51 to enter WFI Dinh.Nguyen at freescale.com
2011-03-21 21:30 ` [PATCHv5 4/4] ARM: mx51: Add support for low power suspend on MX51 Dinh.Nguyen at freescale.com
2011-03-23 10:24 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300743038-3901-1-git-send-email-Dinh.Nguyen@freescale.com \
--to=dinh.nguyen@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).