Skip to contentSkip to conversation

ARM: mx25: Print the silicon revison

PATCH New Fabio Estevam 3 participants 6 messages Sep 2, 2011 – Sep 9, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ARM: mx25: Print the silicon revison

Print the silicon revison during boot.

---
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(-)
arch/arm/cpu/arm926ejs/mx25/generic.c +30 -2
index 76e4b5c..dca8d98 100644
@@ -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;
 }
arch/arm/include/asm/arch-mx25/imx-regs.h +3 -0
index 7e34050..d0c6d00 100644
@@ -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 */
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 2/2 ARM: mx25: Print the source of reset

Print the source of reset during boot.

---
Changes since v1:
- Fix the logic for detecting the reset cause

 arch/arm/cpu/arm926ejs/mx25/generic.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
arch/arm/cpu/arm926ejs/mx25/generic.c +24 -1
index dca8d98..ed4b3e0 100644
@@ -105,6 +105,28 @@ ulong imx_get_perclk (int clk)
 	return lldiv (fref, div);
 }
 
+static char *get_reset_cause(void)
+{
+	/* read RCSR register from CCM module */
+	struct ccm_regs *ccm =
+		(struct ccm_regs *)IMX_CCM_BASE;
+
+	u32 cause = readl(&ccm->rcsr) & 0x0f;
+
+	if (cause == 0)
+		return "POR";
+	else if (cause == 1)
+		return "RST";
+	else if ((cause & 2) == 2)
+		return "WDOG";
+	else if ((cause & 4) == 4)
+		return "SW RESET";
+	else if ((cause & 8) == 8)
+		return "JTAG";
+	else
+		return "unknown reset";
+
+}
 
 u32 get_cpu_rev(void)
 {
@@ -136,10 +158,11 @@ int print_cpuinfo (void)
 	char buf[32];
 	u32 cpurev = get_cpu_rev();
 		
-	printf("CPU:   Freescale i.MX25 rev%d.%d%s at %s MHz\n\n",
+	printf("CPU:   Freescale i.MX25 rev%d.%d%s at %s MHz\n",
 		(cpurev & 0xF0) >> 4, (cpurev & 0x0F),
 		((cpurev & 0x8000) ? " unknown" : ""),
 		strmhz (buf, imx_get_armclk ()));
+	printf("Reset cause: %s\n\n", get_reset_cause());
 	return 0;
 }
 #endif
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 2/2 ARM: mx25: Print the source of reset

Quoted 10 lines · Fabio Estevam

Print the source of reset during boot.

---
Changes since v1:
- Fix the logic for detecting the reset cause

 arch/arm/cpu/arm926ejs/mx25/generic.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#4 lore raw

PATCH v2 1/2 ARM: mx25: Print the silicon revison

Quoted 4 lines · Fabio Estevam

Hi Stefano,

On Fri, Sep 2, 2011 at 12:38 PM, Fabio Estevam
<[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines

Print the silicon revison during boot.

---
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

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#5 lore raw

PATCH v2 1/2 ARM: mx25: Print the silicon revison

In reply to Fabio Estevam
Quoted 11 lines · Fabio Estevam

Print the silicon revison during boot.

---
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

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================