Re: [U-Boot] i.MX6 based board does not work if watchdog support is enabled

2013-09-30 Thread Anatolij Gustschin
Hi Stefano,

On Mon, 30 Sep 2013 07:41:46 +0200
Stefano Babic  wrote:
... 
> Can you resend the patch in the usual way to ML for including into
> mainline ?

yes, I can resend it.

Thanks,

Anatolij

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] i.MX6 based board does not work if watchdog support is enabled

2013-09-29 Thread Stefano Babic
Hi Antolji,

On 29/09/2013 20:08, Otavio Salvador wrote:

>>>
>>> I am booting the board from USB loader. May it be an issue?
>>
>> No, it shouldn't be an issue. Does the attached patch help?
> 
> It does fix the issue! :-)
> 

Can you resend the patch in the usual way to ML for including into
mainline ?

Thanks,
Stefano

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] i.MX6 based board does not work if watchdog support is enabled

2013-09-29 Thread Otavio Salvador
On Sun, Sep 29, 2013 at 1:57 PM, Anatolij Gustschin  wrote:
> On Sat, 28 Sep 2013 21:19:19 -0300
> Otavio Salvador  wrote:
>
>> I am trying to add support for watchdog in one board and it is not
>> working as expected.
>>
>> I did add the:
>>
>> #define CONFIG_HW_WATCHDOG
>> #define CONFIG_IMX_WATCHDOG
>>
>> into the board config file.
>>
>> Into the board .c file, I added:
>>
>> int board_late_init(void)
>> {
>> ...
>> #ifdef CONFIG_HW_WATCHDOG
>>  hw_watchdog_init();
>> #endif
>>
>> return 0;
>> }
>>
>> and the hw_watchdog_init is indeed called.
>>
>> It starts booting and shows:
>>
>> U-Boot 2013.10-rc3-00046-gc1c2434-dirty (Sep 28 2013 - 21:12:53)
>>
>> CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
>> Reset cause: WDOG
>> Board: 
>> DRAM:  1 GiB
>> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
>> In:serial
>> Out:   serial
>> Err:   serial
>> Net:�
>>
>> and it in fact resets.
>>
>> I am booting the board from USB loader. May it be an issue?
>
> No, it shouldn't be an issue. Does the attached patch help?

It does fix the issue! :-)

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] i.MX6 based board does not work if watchdog support is enabled

2013-09-29 Thread Otavio Salvador
On Sun, Sep 29, 2013 at 5:23 AM, Michael Trimarchi
 wrote:
> On Sun, Sep 29, 2013 at 2:19 AM, Otavio Salvador
>  wrote:
>> I am trying to add support for watchdog in one board and it is not
>> working as expected.
>>
>> I did add the:
>>
>> #define CONFIG_HW_WATCHDOG
>> #define CONFIG_IMX_WATCHDOG
>>
>> into the board config file.
>>
>> Into the board .c file, I added:
>>
>> int board_late_init(void)
>> {
>> ...
>> #ifdef CONFIG_HW_WATCHDOG
>>  hw_watchdog_init();
>> #endif
>>
>> return 0;
>> }
>>
>> and the hw_watchdog_init is indeed called.
>>
>> It starts booting and shows:
>>
>> U-Boot 2013.10-rc3-00046-gc1c2434-dirty (Sep 28 2013 - 21:12:53)
>>
>> CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
>> Reset cause: WDOG
>> Board: 
>> DRAM:  1 GiB
>> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
>> In:serial
>> Out:   serial
>> Err:   serial
>> Net:�
>>
>> and it in fact resets.
>>
>> I am booting the board from USB loader. May it be an issue?
>>
>
> I have read the code and briefly compare with linux one and seems the setting
> on the register is ok and default is 128secs if CONFIG_WATCHDOG_TIMEOUT_MSECS
> is not define.
>
> are you sure that you don't change this define?

I set it originally to 1 and later to 128000 and in the end
removed it. It kept doing it wrong.

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] i.MX6 based board does not work if watchdog support is enabled

2013-09-29 Thread Anatolij Gustschin
Hi,

On Sat, 28 Sep 2013 21:19:19 -0300
Otavio Salvador  wrote:

> I am trying to add support for watchdog in one board and it is not
> working as expected.
> 
> I did add the:
> 
> #define CONFIG_HW_WATCHDOG
> #define CONFIG_IMX_WATCHDOG
> 
> into the board config file.
> 
> Into the board .c file, I added:
> 
> int board_late_init(void)
> {
> ...
> #ifdef CONFIG_HW_WATCHDOG
>  hw_watchdog_init();
> #endif
> 
> return 0;
> }
> 
> and the hw_watchdog_init is indeed called.
> 
> It starts booting and shows:
> 
> U-Boot 2013.10-rc3-00046-gc1c2434-dirty (Sep 28 2013 - 21:12:53)
> 
> CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
> Reset cause: WDOG
> Board: 
> DRAM:  1 GiB
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
> In:serial
> Out:   serial
> Err:   serial
> Net:�
> 
> and it in fact resets.
> 
> I am booting the board from USB loader. May it be an issue?

No, it shouldn't be an issue. Does the attached patch help?

Thanks,

Anatolij

>From 394344a469ea18234adc8f611925e41bc532e230 Mon Sep 17 00:00:00 2001
From: Anatolij Gustschin 
Date: Tue, 16 Apr 2013 11:01:54 +0200
Subject: [PATCH] imx_watchdog: do not soft-reset while watchdog init

Currently the driver clears WCR_SRS bit when enabling
the watchdog and this causes a software reset. Do not
clear WCR_SRS.

Signed-off-by: Anatolij Gustschin 
---
 drivers/watchdog/imx_watchdog.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c
index 50e602a..d5993b4 100644
--- a/drivers/watchdog/imx_watchdog.c
+++ b/drivers/watchdog/imx_watchdog.c
@@ -19,6 +19,7 @@ struct watchdog_regs {
 #define WCR_WDBG	0x02
 #define WCR_WDE		0x04	/* WDOG enable */
 #define WCR_WDT		0x08
+#define WCR_SRS		0x10
 #define WCR_WDW		0x80
 #define SET_WCR_WT(x)	(x << 8)
 
@@ -45,7 +46,7 @@ void hw_watchdog_init(void)
 #define CONFIG_WATCHDOG_TIMEOUT_MSECS 128000
 #endif
 	timeout = (CONFIG_WATCHDOG_TIMEOUT_MSECS / 500) - 1;
-	writew(WCR_WDZST | WCR_WDBG | WCR_WDE | WCR_WDT |
+	writew(WCR_WDZST | WCR_WDBG | WCR_WDE | WCR_WDT | WCR_SRS |
 		WCR_WDW | SET_WCR_WT(timeout), &wdog->wcr);
 	hw_watchdog_reset();
 }
-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] i.MX6 based board does not work if watchdog support is enabled

2013-09-29 Thread Michael Trimarchi
Hi

On Sun, Sep 29, 2013 at 2:19 AM, Otavio Salvador
 wrote:
> Hello,
>
> I am trying to add support for watchdog in one board and it is not
> working as expected.
>
> I did add the:
>
> #define CONFIG_HW_WATCHDOG
> #define CONFIG_IMX_WATCHDOG
>
> into the board config file.
>
> Into the board .c file, I added:
>
> int board_late_init(void)
> {
> ...
> #ifdef CONFIG_HW_WATCHDOG
>  hw_watchdog_init();
> #endif
>
> return 0;
> }
>
> and the hw_watchdog_init is indeed called.
>
> It starts booting and shows:
>
> U-Boot 2013.10-rc3-00046-gc1c2434-dirty (Sep 28 2013 - 21:12:53)
>
> CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
> Reset cause: WDOG
> Board: 
> DRAM:  1 GiB
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
> In:serial
> Out:   serial
> Err:   serial
> Net:�
>
> and it in fact resets.
>
> I am booting the board from USB loader. May it be an issue?
>

I have read the code and briefly compare with linux one and seems the setting
on the register is ok and default is 128secs if CONFIG_WATCHDOG_TIMEOUT_MSECS
is not define.

are you sure that you don't change this define?

CONFIG_WATCHDOG_TIMEOUT_MSECS

Michael



> --
> Otavio Salvador O.S. Systems
> http://www.ossystems.com.brhttp://code.ossystems.com.br
> Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot