All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison
@ 2011-09-02 15:38 Fabio Estevam
  2011-09-02 15:38 ` [U-Boot] [PATCH v2 2/2] ARM: mx25: Print the source of reset Fabio Estevam
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fabio Estevam @ 2011-09-02 15:38 UTC (permalink / raw)
  To: u-boot

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

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 */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 2/2] ARM: mx25: Print the source of reset
  2011-09-02 15:38 [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison Fabio Estevam
@ 2011-09-02 15:38 ` Fabio Estevam
  2011-09-09 16:01   ` Stefano Babic
  2011-09-09 11:21 ` [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison Fabio Estevam
  2011-09-09 16:00 ` Stefano Babic
  2 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2011-09-02 15:38 UTC (permalink / raw)
  To: u-boot

Print the source of reset during boot.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
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(-)

diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
index dca8d98..ed4b3e0 100644
--- a/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -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
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison
  2011-09-02 15:38 [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison Fabio Estevam
  2011-09-02 15:38 ` [U-Boot] [PATCH v2 2/2] ARM: mx25: Print the source of reset Fabio Estevam
@ 2011-09-09 11:21 ` Fabio Estevam
  2011-09-09 15:49   ` Stefano Babic
  2011-09-09 16:00 ` Stefano Babic
  2 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2011-09-09 11:21 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison
  2011-09-09 11:21 ` [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison Fabio Estevam
@ 2011-09-09 15:49   ` Stefano Babic
  0 siblings, 0 replies; 6+ messages in thread
From: Stefano Babic @ 2011-09-09 15:49 UTC (permalink / raw)
  To: u-boot

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison
  2011-09-02 15:38 [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison Fabio Estevam
  2011-09-02 15:38 ` [U-Boot] [PATCH v2 2/2] ARM: mx25: Print the source of reset Fabio Estevam
  2011-09-09 11:21 ` [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison Fabio Estevam
@ 2011-09-09 16:00 ` Stefano Babic
  2 siblings, 0 replies; 6+ messages in thread
From: Stefano Babic @ 2011-09-09 16:00 UTC (permalink / raw)
  To: u-boot

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 2/2] ARM: mx25: Print the source of reset
  2011-09-02 15:38 ` [U-Boot] [PATCH v2 2/2] ARM: mx25: Print the source of reset Fabio Estevam
@ 2011-09-09 16:01   ` Stefano Babic
  0 siblings, 0 replies; 6+ messages in thread
From: Stefano Babic @ 2011-09-09 16:01 UTC (permalink / raw)
  To: u-boot

On 09/02/2011 05:38 PM, Fabio Estevam wrote:
> Print the source of reset during boot.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> 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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-09 16:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02 15:38 [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison Fabio Estevam
2011-09-02 15:38 ` [U-Boot] [PATCH v2 2/2] ARM: mx25: Print the source of reset Fabio Estevam
2011-09-09 16:01   ` Stefano Babic
2011-09-09 11:21 ` [U-Boot] [PATCH v2 1/2] ARM: mx25: Print the silicon revison Fabio Estevam
2011-09-09 15:49   ` Stefano Babic
2011-09-09 16:00 ` Stefano Babic

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.