Skip to contentSkip to conversation

ARM: MX31: Fix file name label

PATCH Superseded Fabio Estevam 3 participants 5 messages Apr 15, 2011 – Apr 18, 2011

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH v3 1/3 ARM: MX31: Fix file name label

Commit 5d2c154 (IMX: MX31: Cleanup include files and drop nasty #ifdef in drivers) renamed mx31-imx-regs.h to imx-regs.h.

Change the file label accordingly.

---
This patch series should were applied in the u-boot-arm tree. It also needs the following patch to be applied first:
[PATCH v5] ARM: mx31: Print the silicon version

 arch/arm/include/asm/arch-mx31/imx-regs.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-mx31/imx-regs.h +3 -3
index 0eeaf39..74444f2 100644
@@ -21,8 +21,8 @@
  * MA 02111-1307 USA
  */
 
-#ifndef __ASM_ARCH_MX31_REGS_H
-#define __ASM_ARCH_MX31_REGS_H
+#ifndef __ASM_ARCH_MX31_IMX_REGS_H
+#define __ASM_ARCH_MX31_IMX_REGS_H
 
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
@@ -774,4 +774,4 @@ enum iomux_pins {
 #define MXC_EHCI_IPPUE_DOWN		(1 << 8)
 #define MXC_EHCI_IPPUE_UP		(1 << 9)
 
-#endif /* __ASM_ARCH_MX31_REGS_H */
+#endif /* __ASM_ARCH_MX31_IMX_REGS_H */
Signature · 1 line
1.6.0.4
author reviewer
#1 lore raw

PATCH v3 2/3 MX31: Introduce get_reset_cause()

Introduce get_reset_cause() function to indicate the source of the reset.

---
 arch/arm/cpu/arm1136/mx31/generic.c       |   26 ++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx31/imx-regs.h |    2 ++
 2 files changed, 28 insertions(+), 0 deletions(-)
arch/arm/cpu/arm1136/mx31/generic.c +26 -0
index 9b7a7a2..ea452a9 100644
@@ -132,6 +132,32 @@ char *get_cpu_rev(void)
 		return "unknown";
 }
 
+char *get_reset_cause(void)
+{
+	/* read SRS register from CCM module */
+	struct clock_control_regs *ccm =
+		(struct clock_control_regs *)CCM_BASE;
+
+	u32 cause = readl(&ccm->rcsr) & 0x07;
+
+	switch (cause) {
+	case 0x0000:
+		return "POR";
+		break;
+	case 0x0001:
+		return "RST";
+		break;
+	case 0x0002:
+		return "WDOG";
+		break;
+	case 0x0006:
+		return "JTAG";
+		break;
+	default:
+		return "unknown reset";
+	}
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo (void)
 {
arch/arm/include/asm/arch-mx31/imx-regs.h +2 -0
index 74444f2..2b0881d 100644
@@ -27,6 +27,8 @@
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
 
+extern char *get_reset_cause(void);
+
 /* Clock control module registers */
 struct clock_control_regs {
 	u32 ccmr;
Signature · 1 line
1.6.0.4
author reviewer
#2 lore raw

PATCH v3 3/3 MX31: mx31pdk: Print the cause of reset

Print the cause of reset and also change the board name to only 'MX31PDK'.

---
 board/freescale/mx31pdk/mx31pdk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
board/freescale/mx31pdk/mx31pdk.c +1 -1
index 3f291fc..b3f2c09 100644
@@ -70,7 +70,7 @@ int board_init(void)
 
 int checkboard(void)
 {
-	printf("Board: i.MX31 MAX PDK (3DS)\n");
+	printf("Board: MX31PDK [%s]\n", get_reset_cause());
 	return 0;
 }
 
Signature · 1 line
1.6.0.4
#3 lore raw

PATCH v3 2/3 MX31: Introduce get_reset_cause()

In reply to Fabio Estevam
Quoted 8 lines · Fabio Estevam

Introduce get_reset_cause() function to indicate the source of the reset.

---
 arch/arm/cpu/arm1136/mx31/generic.c       |   26 ++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx31/imx-regs.h |    2 ++
 2 files changed, 28 insertions(+), 0 deletions(-)

Hi Fabio,

arch/arm/include/asm/arch-mx31/imx-regs.h line 31

Quoted 10 lines
arch/arm/include/asm/arch-mx31/imx-regs.h +2 -0
index 74444f2..2b0881d 100644
@@ -27,6 +27,8 @@
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
 
+extern char *get_reset_cause(void);
+

The imx-regs.h contains only defines and structures for the processor, and no prototypes. Function prototypes are then listed in sys_proto.h, not only for i.MX processor. I prefer to maintain this rule and to not add prototypes to this file.

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 v3 2/3 MX31: Introduce get_reset_cause()

Hi Fabio and Stefan,

Quoted 21 lines · Fabio Estevam
Quoted 8 lines

Introduce get_reset_cause() function to indicate the source of the reset.

---
 arch/arm/cpu/arm1136/mx31/generic.c       |   26 ++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx31/imx-regs.h |    2 ++
 2 files changed, 28 insertions(+), 0 deletions(-)

Hi Fabio,

Quoted 9 lines
arch/arm/include/asm/arch-mx31/imx-regs.h +0 -0
index 74444f2..2b0881d 100644
@@ -27,6 +27,8 @@
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
 
Quoted 7 lines

arch/arm/include/asm/arch-mx31/imx-regs.h line 31

Quoted 2 lines
arch/arm/include/asm/arch-mx31/imx-regs.h +2 -0
+extern char *get_reset_cause(void);
+

The imx-regs.h contains only defines and structures for the processor, and no prototypes. Function prototypes are then listed in sys_proto.h, not only for i.MX processor. I prefer to maintain this rule and to not add prototypes to this file.

Why can't we have this code in the cpu specific code _without_ any call from a board so _ecery_ board gets the additional information for free?

See for example arch/powerpc/cpu/mpc512x/cpu.c where this is done for RSR on 5121. I do not understand what the problem is here, can someone enlighten me please?

Cheers
Detlev

Signature · 7 lines
The X approach to device independence is to treat everything like a MicroVAX
framebuffer on acid.
                                          -- The UNIX Haters Handbook
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de