Skip to contentSkip to conversation

MX31: mx31pdk: Add watchdog support

PATCH Superseded Fabio Estevam 4 participants 7 messages Mar 9, 2011 – Apr 27, 2011

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 MX31: mx31pdk: Add watchdog support

---
 board/freescale/mx31pdk/mx31pdk.c |   16 ++++++++++++++++
 include/configs/mx31pdk.h         |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
board/freescale/mx31pdk/mx31pdk.c +16 -0
index a9f0fb4..4a5d3ef 100644
@@ -28,9 +28,17 @@
 #include <netdev.h>
 #include <asm/arch/mx31.h>
 #include <asm/arch/mx31-regs.h>
+#include <watchdog.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_HW_WATCHDOG
+void hw_watchdog_reset(void)
+{
+	mxc_hw_watchdog_reset();
+}
+#endif
+
 int dram_init(void)
 {
 	/* dram_init must store complete ramsize in gd->ram_size */
@@ -68,6 +76,14 @@ int board_init(void)
 	return 0;
 }
 
+int board_late_init(void)
+{
+#ifdef CONFIG_HW_WATCHDOG
+	mxc_hw_watchdog_enable();
+#endif
+	return 0;
+}
+
 int checkboard(void)
 {
 	printf("Board: i.MX31 MAX PDK (3DS)\n");
include/configs/mx31pdk.h +1 -0
index 86c758f..1f1de46 100644
@@ -61,6 +61,7 @@
 
 #define CONFIG_MXC_UART		1
 #define CONFIG_SYS_MX31_UART1	1
+#define CONFIG_HW_WATCHDOG
 
 #define CONFIG_HARD_SPI		1
 #define CONFIG_MXC_SPI		1
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH 2/2 MX31: mx31pdk: Print the cause of reset

---
 board/freescale/mx31pdk/mx31pdk.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
board/freescale/mx31pdk/mx31pdk.c +24 -1
index 4a5d3ef..0462a22 100644
@@ -86,7 +86,30 @@ int board_late_init(void)
 
 int checkboard(void)
 {
-	printf("Board: i.MX31 MAX PDK (3DS)\n");
+	u32 cause;
+	struct clock_control_regs *ccm =
+		(struct clock_control_regs *)CCM_BASE;
+	puts("Board: MX31PDK [");
+
+	cause = ccm->rcsr & 0x03;
+	switch (cause) {
+	case 0x0000:
+		puts("POR");
+		break;
+	case 0x0001:
+		puts("RST");
+		break;
+	case 0x0002:
+		puts("WDOG");
+		break;
+	case 0x0006:
+		puts("JTAG");
+		break;
+	default:
+		puts("unknown");
+	}
+
+	puts("]\n");
 	return 0;
 }
 
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH 2/2 MX31: mx31pdk: Print the cause of reset

On Wed, 9 Mar 2011 13:35:44 -0300
Fabio Estevam <[email protected]> wrote:
...

board/freescale/mx31pdk/mx31pdk.c int board_late_init(void) · line 94

Quoted 12 lines

+++ b/board/freescale/mx31pdk/mx31pdk.c

board/freescale/mx31pdk/mx31pdk.c +6 -1
@@ -86,7 +86,30 @@ int board_late_init(void)
 
 int checkboard(void)
 {
-	printf("Board: i.MX31 MAX PDK (3DS)\n");
+	u32 cause;
+	struct clock_control_regs *ccm =
+		(struct clock_control_regs *)CCM_BASE;
+	puts("Board: MX31PDK [");
+
+	cause = ccm->rcsr & 0x03;

The mask should be 0x07, since ...

board/freescale/mx31pdk/mx31pdk.c int board_late_init(void) · line 107

Quoted 3 lines
board/freescale/mx31pdk/mx31pdk.c +3 -0
+	case 0x0006:
+		puts("JTAG");
+		break;

we check if bit 2 is set here.

Best regards,
Anatolij

#3 lore raw

PATCH 1/2 MX31: mx31pdk: Add watchdog support

In reply to Fabio Estevam

board/freescale/mx31pdk/mx31pdk.c

Quoted 8 lines · Fabio Estevam
---
 board/freescale/mx31pdk/mx31pdk.c |   16 ++++++++++++++++
 include/configs/mx31pdk.h         |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
board/freescale/mx31pdk/mx31pdk.c +0 -0
index a9f0fb4..4a5d3ef 100644

Hi Fabio,

include/configs/mx31pdk.h line 67

Quoted 12 lines
include/configs/mx31pdk.h +1 -0
index 86c758f..1f1de46 100644
@@ -61,6 +61,7 @@
 
 #define CONFIG_MXC_UART		1
 #define CONFIG_SYS_MX31_UART1	1
+#define CONFIG_HW_WATCHDOG
 
 #define CONFIG_HARD_SPI		1
 #define CONFIG_MXC_SPI		1

Applying this patch I have not found BOARD_LATE_INIT in mx31pdk.h. How can the watchdog be enabled ?

Best regards,
Stefano

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 1/2 MX31: mx31pdk: Add watchdog support

In reply to Fabio Estevam

board/freescale/mx31pdk/mx31pdk.c

Quoted 8 lines · Fabio Estevam
---
 board/freescale/mx31pdk/mx31pdk.c |   16 ++++++++++++++++
 include/configs/mx31pdk.h         |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
board/freescale/mx31pdk/mx31pdk.c +0 -0
index a9f0fb4..4a5d3ef 100644

Applied to u-boot-imx, 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
=====================================================================
#5 lore raw

PATCH 1/2 MX31: mx31pdk: Add watchdog support

Hi Stefano,

Quoted 11 lines · Fabio Estevam

board/freescale/mx31pdk/mx31pdk.c

Quoted 8 lines
---
 board/freescale/mx31pdk/mx31pdk.c |   16 ++++++++++++++++
 include/configs/mx31pdk.h         |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
board/freescale/mx31pdk/mx31pdk.c +0 -0
index a9f0fb4..4a5d3ef 100644

Applied to u-boot-imx, thanks.

Ah, obviously I'm a bit late on this. Can you please make sure that a follow-up patch according to my suggestion sent just now gets into the tree?

Thanks!
Detlev

Signature · 7 lines
The Speedo3 is very similar to other Intel network chips, that is to say
"apparently designed on a different planet".
                               -- drivers/net/eepro100.c in Linux source
--
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
#6 lore raw

PATCH 1/2 MX31: mx31pdk: Add watchdog support

Hi Detlev,

Quoted 9 lines · Detlev Zundel

Hi Stefano,

Quoted 7 lines · Fabio Estevam
Quoted 6 lines
---
 board/freescale/mx31pdk/mx31pdk.c |   16 ++++++++++++++++
 include/configs/mx31pdk.h         |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
Quoted 8 lines
Quoted 4 lines

board/freescale/mx31pdk/mx31pdk.c

Quoted 2 lines
board/freescale/mx31pdk/mx31pdk.c +0 -0
index a9f0fb4..4a5d3ef 100644

Applied to u-boot-imx, thanks.

Ah, obviously I'm a bit late on this. Can you please make sure that a follow-up patch according to my suggestion sent just now gets into the tree?

Thanks for your clarification regarding the watchdog usage.

I will send a follow-up patch soon as per your suggestion.

Regards,

Fabio Estevam