diff mbox

[U-Boot,v2,1/2] ARM: mx25: Print the silicon revison

Message ID 1314977935-2653-1-git-send-email-fabio.estevam@freescale.com
State Accepted
Delegated to: Stefano Babic
Headers show

Commit Message

Fabio Estevam Sept. 2, 2011, 3:38 p.m. UTC
Print the silicon revison during boot.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Handle the unkown silicon revision in the same way as for mx31.

 arch/arm/cpu/arm926ejs/mx25/generic.c     |   32 +++++++++++++++++++++++++++-
 arch/arm/include/asm/arch-mx25/imx-regs.h |    3 ++
 2 files changed, 33 insertions(+), 2 deletions(-)

Comments

Fabio Estevam Sept. 9, 2011, 11:21 a.m. UTC | #1
Hi Stefano,

On Fri, Sep 2, 2011 at 12:38 PM, Fabio Estevam
<fabio.estevam@freescale.com> wrote:
> Print the silicon revison during boot.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> Changes since v1:
> - Handle the unkown silicon revision in the same way as for mx31.

Does v2 look good now?

Regards,

Fabio Estevam
Stefano Babic Sept. 9, 2011, 3:49 p.m. UTC | #2
On 09/09/2011 01:21 PM, Fabio Estevam wrote:
> Hi Stefano,
> 
> On Fri, Sep 2, 2011 at 12:38 PM, Fabio Estevam
> <fabio.estevam@freescale.com> wrote:
>> Print the silicon revison during boot.
>>
>> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>> ---
>> Changes since v1:
>> - Handle the unkown silicon revision in the same way as for mx31.
> 
> Does v2 look good now?

Sorry, no answer because I had no comments...it looks good ! I will
merge still for this release, because IMHO it is a fix.

Best regards,
Stefano Babic
Stefano Babic Sept. 9, 2011, 4 p.m. UTC | #3
On 09/02/2011 05:38 PM, Fabio Estevam wrote:
> Print the silicon revison during boot.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> Changes since v1:
> - Handle the unkown silicon revision in the same way as for mx31.
> 
>  arch/arm/cpu/arm926ejs/mx25/generic.c     |   32 +++++++++++++++++++++++++++-
>  arch/arm/include/asm/arch-mx25/imx-regs.h |    3 ++
>  2 files changed, 33 insertions(+), 2 deletions(-)
> 

Applied to u-boot-imx as a fix, thanks.

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 76e4b5c..dca8d98 100644
--- a/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -105,12 +105,40 @@  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 |= 0x8000;
+		break;
+	}
+
+	return system_rev;
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo (void)
 {
 	char buf[32];
-
-	printf ("CPU:   Freescale i.MX25 at %s MHz\n\n",
+	u32 cpurev = get_cpu_rev();
+
+	printf("CPU:   Freescale i.MX25 rev%d.%d%s at %s MHz\n\n",
+		(cpurev & 0xF0) >> 4, (cpurev & 0x0F),
+		((cpurev & 0x8000) ? " unknown" : ""),
 		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 7e34050..d0c6d00 100644
--- a/arch/arm/include/asm/arch-mx25/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx25/imx-regs.h
@@ -352,4 +352,7 @@  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
+
 #endif				/* _IMX_REGS_H */