mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Eric Bénard" <eric@eukrea.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/7] i.MX53: add silicn revision functions
Date: Tue, 21 Feb 2012 01:27:35 +0100	[thread overview]
Message-ID: <1329784059-6006-3-git-send-email-eric@eukrea.com> (raw)
In-Reply-To: <1329784059-6006-1-git-send-email-eric@eukrea.com>

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/mach-imx/imx53.c                   |   45 +++++++++++++++++++++++++++
 arch/arm/mach-imx/include/mach/imx53-regs.h |    5 +++
 2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-imx/imx53.c b/arch/arm/mach-imx/imx53.c
index 4f7d1cb..acb9d49 100644
--- a/arch/arm/mach-imx/imx53.c
+++ b/arch/arm/mach-imx/imx53.c
@@ -37,6 +37,51 @@ void *imx_gpio_base[] = {
 
 int imx_gpio_count = ARRAY_SIZE(imx_gpio_base) * 32;
 
+#define SI_REV 0x48
+
+static u32 mx53_silicon_revision;
+static char *mx53_rev_string = "unknown";
+
+int imx_silicon_revision(void)
+{
+	return mx53_silicon_revision;
+}
+
+static int query_silicon_revision(void)
+{
+	void __iomem *rom = MX53_IROM_BASE_ADDR;
+	u32 rev;
+
+	rev = readl(rom + SI_REV);
+	switch (rev) {
+	case 0x10:
+		mx53_silicon_revision = MX53_CHIP_REV_1_0;
+		mx53_rev_string = "1.0";
+		break;
+	case 0x20:
+		mx53_silicon_revision = MX53_CHIP_REV_2_0;
+		mx53_rev_string = "2.0";
+		break;
+	case 0x21:
+		mx53_silicon_revision = MX53_CHIP_REV_2_1;
+		mx53_rev_string = "2.1";
+		break;
+	default:
+		mx53_silicon_revision = 0;
+	}
+
+	return 0;
+}
+core_initcall(query_silicon_revision);
+
+static int imx53_print_silicon_rev(void)
+{
+	printf("detected i.MX53 rev %s\n", mx53_rev_string);
+
+	return 0;
+}
+device_initcall(imx53_print_silicon_rev);
+
 static int imx53_init(void)
 {
 	add_generic_device("imx_iim", 0, NULL, MX53_IIM_BASE_ADDR, SZ_4K,
diff --git a/arch/arm/mach-imx/include/mach/imx53-regs.h b/arch/arm/mach-imx/include/mach/imx53-regs.h
index 8fefc54..065bf08 100644
--- a/arch/arm/mach-imx/include/mach/imx53-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx53-regs.h
@@ -135,5 +135,10 @@
 #define MX53_CS2_96MB_BASE_ADDR		0xF6000000
 #define MX53_CS3_BASE_ADDR		0xF6000000
 
+/* silicon revisions specific to i.MX53 */
+#define MX53_CHIP_REV_1_0	0x10
+#define MX53_CHIP_REV_2_0	0x20
+#define MX53_CHIP_REV_2_1	0x21
+
 #endif /* __MACH_IMX53_REGS_H */
 
-- 
1.7.7.6


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-02-21  0:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21  0:27 [PATCH 1/7] add i2c clock support Eric Bénard
2012-02-21  0:27 ` [PATCH 2/7] mfd: add mc34708 driver Eric Bénard
2012-02-21  3:48   ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21  7:03     ` Eric Bénard
2012-02-21 13:03       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21 13:22         ` Eric Bénard
2012-02-21 14:10           ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21 15:35             ` Eric Bénard
2012-02-21 15:38               ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21 20:45                 ` Sascha Hauer
2012-02-21 21:09                   ` Marc Reilly
2012-02-21  0:27 ` Eric Bénard [this message]
2012-02-22  7:33   ` [PATCH 3/7] i.MX53: add silicn revision functions Sascha Hauer
2012-02-27  8:20     ` [PATCH v2 1/7] add i2c clock support Eric Bénard
2012-02-27  8:20       ` [PATCH v2 2/7] mfd: add mc34708 driver Eric Bénard
2012-02-27  8:20       ` [PATCH v2 3/7] i.MX53: add silicon revision functions Eric Bénard
2012-02-27  8:20       ` [PATCH v2 4/7] i.MX53: enable pull up on I2C0 pins Eric Bénard
2012-02-27  8:20       ` [PATCH v2 5/7] mx53-loco: add i2c support Eric Bénard
2012-02-27  8:20       ` [PATCH v2 6/7] mx53-loco: add board revision support Eric Bénard
2012-02-27 15:40         ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-27 18:58           ` Sascha Hauer
2012-02-27  8:20       ` [PATCH v2 7/7] mx53-loco: update defconfig Eric Bénard
2012-02-27 18:59       ` [PATCH v2 1/7] add i2c clock support Sascha Hauer
2012-02-21  0:27 ` [PATCH 4/7] i.MX53: enable pull up on I2C0 pins Eric Bénard
2012-02-21  0:27 ` [PATCH 5/7] mx53-loco: add i2c support Eric Bénard
2012-02-21  0:27 ` [PATCH 6/7] mx53-loco: add board revision support Eric Bénard
2012-02-21  3:50   ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21  0:27 ` [PATCH 7/7] mx53-loco: update defconfig Eric Bénard

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=1329784059-6006-3-git-send-email-eric@eukrea.com \
    --to=eric@eukrea.com \
    --cc=barebox@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