All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <fabio.estevam@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] ARM: mx25: Print the silicon revison
Date: Tue, 30 Aug 2011 10:54:09 -0300	[thread overview]
Message-ID: <1314712450-571-1-git-send-email-fabio.estevam@freescale.com> (raw)

Print the silicon revison during boot.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/cpu/arm926ejs/mx25/generic.c     |   32 ++++++++++++++++++++++++++++-
 arch/arm/include/asm/arch-mx25/imx-regs.h |    4 +++
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 76e4b5c..a4e8c14 100644
--- a/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -105,12 +105,42 @@ ulong imx_get_perclk (int clk)
 	return lldiv (fref, div);
 }
 
+
+u32 get_cpu_rev(void)
+{
+	u32 srev;
+	u32 system_rev = 0x25000;
+
+	/* read SREV register from IIM module */
+	struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
+	srev = readl(&iim->iim_srev);
+
+	switch (srev) {
+	case 0x00:
+		system_rev |= CHIP_REV_1_0;
+		break;
+	case 0x01:
+		system_rev |= CHIP_REV_1_1;
+		break;
+	default:
+		system_rev |= CHIP_REV_UNKNOWN;
+		break;
+	}
+
+	return system_rev;
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo (void)
 {
 	char buf[32];
+	u32 cpurev;
+
+	cpurev = get_cpu_rev();
 
-	printf ("CPU:   Freescale i.MX25 at %s MHz\n\n",
+	printf("CPU:   Freescale i.MX25 rev%d.%d at %s MHz\n\n",
+		(cpurev & 0x000F0) >> 4,
+		(cpurev & 0x0000F) >> 0,
 		strmhz (buf, imx_get_armclk ()));
 	return 0;
 }
diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h b/arch/arm/include/asm/arch-mx25/imx-regs.h
index 9e30f7c..92b58be 100644
--- a/arch/arm/include/asm/arch-mx25/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx25/imx-regs.h
@@ -351,4 +351,8 @@ struct aips_regs {
 #define GPIO3_BASE_ADDR		IMX_GPIO3_BASE
 #define GPIO4_BASE_ADDR		IMX_GPIO4_BASE
 
+#define CHIP_REV_1_0		0x10
+#define CHIP_REV_1_1		0x11
+#define CHIP_REV_UNKNOWN	0xFF
+
 #endif				/* _IMX_REGS_H */
-- 
1.7.1

             reply	other threads:[~2011-08-30 13:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30 13:54 Fabio Estevam [this message]
2011-08-30 13:54 ` [U-Boot] [PATCH 2/2] ARM: mx25: Print the source of reset Fabio Estevam
2011-09-02  7:50   ` Stefano Babic
2011-09-02  7:38 ` [U-Boot] [PATCH 1/2] ARM: mx25: Print the silicon revison Stefano Babic

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=1314712450-571-1-git-send-email-fabio.estevam@freescale.com \
    --to=fabio.estevam@freescale.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.