public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support
@ 2011-04-10 18:17 Fabio Estevam
  2011-04-10 18:17 ` [U-Boot] [PATCH v2 2/2] MX31: mx31pdk: Print the cause of reset Fabio Estevam
  2011-04-26  0:54 ` [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2011-04-10 18:17 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- define BOARD_LATE_INIT in /mx31pdk.h

 board/freescale/mx31pdk/mx31pdk.c |   16 ++++++++++++++++
 include/configs/mx31pdk.h         |    3 +++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
index 3f291fc..4ef548f 100644
--- a/board/freescale/mx31pdk/mx31pdk.c
+++ b/board/freescale/mx31pdk/mx31pdk.c
@@ -28,9 +28,17 @@
 #include <netdev.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-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");
diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h
index d4c6d16..f5d3ee7 100644
--- a/include/configs/mx31pdk.h
+++ b/include/configs/mx31pdk.h
@@ -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
@@ -98,6 +99,8 @@
  */
 #undef CONFIG_CMD_IMLS
 
+#define BOARD_LATE_INIT
+
 #define CONFIG_BOOTDELAY	3
 
 #define	CONFIG_EXTRA_ENV_SETTINGS					\
-- 
1.6.0.4

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

* [U-Boot] [PATCH v2 2/2] MX31: mx31pdk: Print the cause of reset
  2011-04-10 18:17 [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support Fabio Estevam
@ 2011-04-10 18:17 ` Fabio Estevam
  2011-04-13 11:08   ` Detlev Zundel
  2011-04-26  0:54 ` [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support Fabio Estevam
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2011-04-10 18:17 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Use 3 bits for rcsr mask

 board/freescale/mx31pdk/mx31pdk.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
index 4ef548f..5fc6319 100644
--- a/board/freescale/mx31pdk/mx31pdk.c
+++ b/board/freescale/mx31pdk/mx31pdk.c
@@ -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 & 0x07;
+	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;
 }
 
-- 
1.6.0.4

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

* [U-Boot] [PATCH v2 2/2] MX31: mx31pdk: Print the cause of reset
  2011-04-10 18:17 ` [U-Boot] [PATCH v2 2/2] MX31: mx31pdk: Print the cause of reset Fabio Estevam
@ 2011-04-13 11:08   ` Detlev Zundel
  0 siblings, 0 replies; 5+ messages in thread
From: Detlev Zundel @ 2011-04-13 11:08 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> Changes since v1:
> - Use 3 bits for rcsr mask
>
>  board/freescale/mx31pdk/mx31pdk.c |   25 ++++++++++++++++++++++++-
>  1 files changed, 24 insertions(+), 1 deletions(-)
>
> diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
> index 4ef548f..5fc6319 100644
> --- a/board/freescale/mx31pdk/mx31pdk.c
> +++ b/board/freescale/mx31pdk/mx31pdk.c
> @@ -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 & 0x07;
> +	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;
>  }

Didn't we agree to move this into CPU specific code so other i.MX31
boards will profit from it as well?  Can you remind me why this does not
happen?

Cheers
  Detlev

-- 
Don't trust everything you read, and don't assume every poster in
a thread is actually relevant to the problem.
        -- Stefan Monnier <jwvlj1gk44h.fsf-monnier+emacs@gnu.org>
--
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

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

* [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support
  2011-04-10 18:17 [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support Fabio Estevam
  2011-04-10 18:17 ` [U-Boot] [PATCH v2 2/2] MX31: mx31pdk: Print the cause of reset Fabio Estevam
@ 2011-04-26  0:54 ` Fabio Estevam
  2011-04-27 11:35   ` Detlev Zundel
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2011-04-26  0:54 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

Ping?

Regards,

Fabio Estevam

On 4/10/2011 3:17 PM, Fabio Estevam wrote:
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> Changes since v1:
> - define BOARD_LATE_INIT in /mx31pdk.h
> 
>  board/freescale/mx31pdk/mx31pdk.c |   16 ++++++++++++++++
>  include/configs/mx31pdk.h         |    3 +++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
> index 3f291fc..4ef548f 100644
> --- a/board/freescale/mx31pdk/mx31pdk.c
> +++ b/board/freescale/mx31pdk/mx31pdk.c
> @@ -28,9 +28,17 @@
>  #include <netdev.h>
>  #include <asm/arch/clock.h>
>  #include <asm/arch/imx-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");
> diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h
> index d4c6d16..f5d3ee7 100644
> --- a/include/configs/mx31pdk.h
> +++ b/include/configs/mx31pdk.h
> @@ -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
> @@ -98,6 +99,8 @@
>   */
>  #undef CONFIG_CMD_IMLS
>  
> +#define BOARD_LATE_INIT
> +
>  #define CONFIG_BOOTDELAY	3
>  
>  #define	CONFIG_EXTRA_ENV_SETTINGS					\

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

* [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support
  2011-04-26  0:54 ` [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support Fabio Estevam
@ 2011-04-27 11:35   ` Detlev Zundel
  0 siblings, 0 replies; 5+ messages in thread
From: Detlev Zundel @ 2011-04-27 11:35 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

> Ping?
>
> Regards,
>
> Fabio Estevam
>
> On 4/10/2011 3:17 PM, Fabio Estevam wrote:
>> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>> ---
>> Changes since v1:
>> - define BOARD_LATE_INIT in /mx31pdk.h
>> 
>>  board/freescale/mx31pdk/mx31pdk.c |   16 ++++++++++++++++
>>  include/configs/mx31pdk.h         |    3 +++
>>  2 files changed, 19 insertions(+), 0 deletions(-)
>> 
>> diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
>> index 3f291fc..4ef548f 100644
>> --- a/board/freescale/mx31pdk/mx31pdk.c
>> +++ b/board/freescale/mx31pdk/mx31pdk.c
>> @@ -28,9 +28,17 @@
>>  #include <netdev.h>
>>  #include <asm/arch/clock.h>
>>  #include <asm/arch/imx-regs.h>
>> +#include <watchdog.h>
>>  
>>  DECLARE_GLOBAL_DATA_PTR;
>>  
>> +#ifdef CONFIG_HW_WATCHDOG
>> +void hw_watchdog_reset(void)
>> +{
>> +	mxc_hw_watchdog_reset();
>> +}
>> +#endif
>> +

I was just discussing this with Wolfgang again and actually you should
use CONFIG_WATCHDOG for this.  The latter was meant for CPU internal
watchdog functionality, whereas CONFIG_HW_WATCHDOG was for external
(i.e. i2c or other) separate watchdog chips.  I'm working on a patch to
README to make this more widely known.

>>  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");
>> diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h
>> index d4c6d16..f5d3ee7 100644
>> --- a/include/configs/mx31pdk.h
>> +++ b/include/configs/mx31pdk.h
>> @@ -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
>> @@ -98,6 +99,8 @@
>>   */
>>  #undef CONFIG_CMD_IMLS
>>  
>> +#define BOARD_LATE_INIT
>> +
>>  #define CONFIG_BOOTDELAY	3
>>  
>>  #define	CONFIG_EXTRA_ENV_SETTINGS					\

Why cannot we put the code into i.mx31 specific code and only keep the
config board specific?  In this patch there is (again) zero board
dependency, so all i.MX31 boards should be able to profit from the work.

Thanks
  Detlev

-- 
So maybe I lost track of my point.  But if I left a mark, C-x C-x should be
all I need.
      -- David Kastrup, emacs-devel.gnu.org <87hbj37v4x.fsf@lola.goethe.zz>
--
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

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

end of thread, other threads:[~2011-04-27 11:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-10 18:17 [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support Fabio Estevam
2011-04-10 18:17 ` [U-Boot] [PATCH v2 2/2] MX31: mx31pdk: Print the cause of reset Fabio Estevam
2011-04-13 11:08   ` Detlev Zundel
2011-04-26  0:54 ` [U-Boot] [PATCH v2 1/2] MX31: mx31pdk: Add watchdog support Fabio Estevam
2011-04-27 11:35   ` Detlev Zundel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox