[U-Boot] Watchdog and u-boot command prompt

Hi,
I have enabled 'watchdog' in u-boot using flag 'CONFIG_WATCHDOG'. I wonder how the 'watchdog' gets reset when the cursor is waiting for user input.
As per my understanding the 'WATCHDOG_RESET()' gets called in 'readline()' prior calling 'getc()'. In our case, the 'getc()' has been mapped to 'serial_getc_dev()' of 'cpu/ppc4xx/serial.c'. The code of 'serial_getc_dev()' executes in continous loop till user presses a key. The good thing is that the boad doesn't get reboot even if user doesn't enter any key. In 'serial_getc_dev()', I don't see any call to reset the watchdog .
Can you help me to find out the how Watchdog is taken care (gets reset) whicle executing a infinite loop (if user doesn't press any key) ? ( Note: I am not using 'CONFIG_HW_WATCHDOG' flag)
Regards, Sachin Rane

Dear Sachin,
In message 73FA539107892C4C8C7A5ACA10C161C85BE0E3@MX2.AlphionCorp.local you wrote:
I have enabled 'watchdog' in u-boot using flag 'CONFIG_WATCHDOG'. I wonder how the 'watchdog' gets reset when the cursor is waiting for user input.
As per my understanding the 'WATCHDOG_RESET()' gets called in 'readline()' prior calling 'getc()'. In our case, the 'getc()' has been mapped to 'serial_getc_dev()' of 'cpu/ppc4xx/serial.c'.
There is no such file in U-Boot.
The code of 'serial_getc_dev()' executes in continous loop till user presses a key. The good thing is that the boad doesn't get reboot even if user doesn't enter any key. In 'serial_getc_dev()', I don't see any call to reset the watchdog .
Hmmm... I don't know where you are looking. You say this is on ppc4xx, so I check "cpu/ppc4xx/4xx_uart.c" - and what do I see?
480 int serial_getc_dev (unsigned long base) 481 { 482 unsigned char status = 0; 483 484 while (1) { 485 #if defined(CONFIG_HW_WATCHDOG) 486 WATCHDOG_RESET (); /* Reset HW Watchdog, if needed */ 487 #endif /* CONFIG_HW_WATCHDOG */ 488 489 status = in_8((u8 *)base + UART_LSR); ...
Looks pretty much as if it was an explicit call to trigger the watchdog...
Can you help me to find out the how Watchdog is taken care (gets reset) whicle executing a infinite loop (if user doesn't press any key) ? ( Note: I am not using 'CONFIG_HW_WATCHDOG' flag)
You are not? Hmmm... What makes you think you are using a watchdog then?
Which sort of watchdog device is used on your board?
Best regards,
Wolfgang Denk

Hi,
'cpu/ppc4xx/serial.c'.
There is no such file in U-Boot.
The version of the u-boot being used is 1.1.4. The latest version of the u-boot (u-boot-2008.10) has '4xx_uart.c' instead of 'serial.c'
Which sort of watchdog device is used on your board?
I am using Software version of Watchdog (CONFIG_WATCHDOG). The routines which are related to CONFIG_WATCHDOG are available in 'cpu/ppc4xx/cpu.c'.
In the file 'include/watchdog.h', it has been mentioned that: 8<---------------------------------------------------------- #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG) # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together." #endif ---------------------------------------------------------->8
It means I can't enable flags CONFIG_HW_WATCHDOG & CONFIG_WATCHDOG together.
Am I missing out something?
Regards, Sachin
-----Original Message----- From: Wolfgang Denk [mailto:wd@denx.de] Sent: Tuesday, January 13, 2009 12:44 AM To: Sachin Rane Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] Watchdog and u-boot command prompt
Dear Sachin,
In message 73FA539107892C4C8C7A5ACA10C161C85BE0E3@MX2.AlphionCorp.local you wrote:
I have enabled 'watchdog' in u-boot using flag 'CONFIG_WATCHDOG'. I wonder how the 'watchdog' gets reset when the cursor is waiting for user input.
As per my understanding the 'WATCHDOG_RESET()' gets called in 'readline()' prior calling 'getc()'. In our case, the 'getc()' has been mapped to 'serial_getc_dev()' of 'cpu/ppc4xx/serial.c'.
There is no such file in U-Boot.
The code of 'serial_getc_dev()' executes in continous loop till user presses a key. The good thing is that the boad doesn't get reboot even if user doesn't enter any key. In 'serial_getc_dev()', I don't see any call to reset the watchdog .
Hmmm... I don't know where you are looking. You say this is on ppc4xx, so I check "cpu/ppc4xx/4xx_uart.c" - and what do I see?
480 int serial_getc_dev (unsigned long base) 481 { 482 unsigned char status = 0; 483 484 while (1) { 485 #if defined(CONFIG_HW_WATCHDOG) 486 WATCHDOG_RESET (); /* Reset HW Watchdog, if needed */ 487 #endif /* CONFIG_HW_WATCHDOG */ 488 489 status = in_8((u8 *)base + UART_LSR); ...
Looks pretty much as if it was an explicit call to trigger the watchdog...
Can you help me to find out the how Watchdog is taken care (gets reset) whicle executing a infinite loop (if user doesn't press any
key) ?
( Note: I am not using 'CONFIG_HW_WATCHDOG' flag)
You are not? Hmmm... What makes you think you are using a watchdog then?
Which sort of watchdog device is used on your board?
Best regards,
Wolfgang Denk

Dear "Sachin Rane",
In message 73FA539107892C4C8C7A5ACA10C161C85BE0E4@MX2.AlphionCorp.local you wrote:
'cpu/ppc4xx/serial.c'.
There is no such file in U-Boot.
The version of the u-boot being used is 1.1.4.
...
It means I can't enable flags CONFIG_HW_WATCHDOG & CONFIG_WATCHDOG together.
Am I missing out something?
Well, it makes little sens to discuss obsolete code. Please use a reasonable recent version instead.
And please don't top post / full quote. Read http://www.netmeister.org/news/learn2quote.html
Best regards,
Wolfgang Denk

Hello Sir,
Please use a reasonable recent version instead.
For following discussion I am referring to the latest version of u-boot source code i.e. 'u-boot-2008.10'.
I am asking a question to improve my knowledge about the Watchdog implementation in U-Boot.
In the file 'include/watchdog.h', it has been mentioned that: 8<---------------------------------------------------------- #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG) #error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together." #endif ---------------------------------------------------------->8
It means I can't enable flags CONFIG_HW_WATCHDOG & CONFIG_WATCHDOG together. Am I right? I want to use Software version of Watchdog (CONFIG_WATCHDOG). If yes then what make the Watchdog resets inside 'serial_getc_dev()' while the code is being being executed in infinite loop. (The loop appears infinite if user doesn't press any key)
The routines which are related to CONFIG_WATCHDOG are available in 'cpu/ppc4xx/cpu.c'
Thanks and Regards, Sachin

On Wednesday 14 January 2009 01:40:29 Sachin Rane wrote:
In the file 'include/watchdog.h', it has been mentioned that: 8<---------------------------------------------------------- #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG) #error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together." #endif ---------------------------------------------------------->8
It means I can't enable flags CONFIG_HW_WATCHDOG & CONFIG_WATCHDOG together.
CONFIG_WATCHDOG -> software watchdog CONFIG_HW_WATCHDOG -> hardware watchdog
it makes no sense to enable both -mike

Dear Mike Frysinger,
In message 200901140639.44315.vapier@gentoo.org you wrote:
It means I can't enable flags CONFIG_HW_WATCHDOG & CONFIG_WATCHDOG together.
CONFIG_WATCHDOG -> software watchdog CONFIG_HW_WATCHDOG -> hardware watchdog
Wrong. There is no such thing as a "software watchdog" in U-Boot. Please see the README what CONFIG_WATCHDOG actually means.
Best regards,
Wolfgang Denk

On Wednesday 14 January 2009 11:01:43 Wolfgang Denk wrote:
In message 200901140639.44315.vapier@gentoo.org you wrote:
It means I can't enable flags CONFIG_HW_WATCHDOG & CONFIG_WATCHDOG together.
CONFIG_WATCHDOG -> software watchdog CONFIG_HW_WATCHDOG -> hardware watchdog
Wrong. There is no such thing as a "software watchdog" in U-Boot. Please see the README what CONFIG_WATCHDOG actually means.
too bad watchdog documentation is non-existent to useless. ive asked on the list in the past for more info on how it works with no response. CONFIG_HW_WATCHDOG is documented nowhere and doesnt jive with CONFIG_WATCHDOG. -mike

Dear Mike Frysinger,
In message 200901141137.37144.vapier@gentoo.org you wrote:
too bad watchdog documentation is non-existent to useless. ive asked on the list in the past for more info on how it works with no response. CONFIG_HW_WATCHDOG is documented nowhere and doesnt jive with CONFIG_WATCHDOG.
This is a community project. If it itchez, please feel free to scratchez. Contributions to the documentation have always been welcome.
Best regards,
Wolfgang Denk

On Wednesday 14 January 2009 17:40:34 Wolfgang Denk wrote:
In message 200901141137.37144.vapier@gentoo.org you wrote:
too bad watchdog documentation is non-existent to useless. ive asked on the list in the past for more info on how it works with no response. CONFIG_HW_WATCHDOG is documented nowhere and doesnt jive with CONFIG_WATCHDOG.
This is a community project. If it itchez, please feel free to scratchez. Contributions to the documentation have always been welcome.
i cant document what i dont understand. that's why i asked for clarification in the past (but got none). -mike

Dear Sachin,
In message 73FA539107892C4C8C7A5ACA10C161C85BE0E6@MX2.AlphionCorp.local you wrote:
In the file 'include/watchdog.h', it has been mentioned that: 8<---------------------------------------------------------- #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG) #error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together." #endif ---------------------------------------------------------->8
It means I can't enable flags CONFIG_HW_WATCHDOG & CONFIG_WATCHDOG together. Am I right?
Yes, you are reading the C code correctly.
I want to use Software version of Watchdog (CONFIG_WATCHDOG).
There is no such thing as a "Software version of Watchdog" in U-Boot.
CONFIG_WATCHDOG is exlained in the README. It refers to a platform specific watchdog that is part of the processor itself.
CONFIG_HW_WATCHDOG (I admit that the name is a bit misleading) refers to using an external watchdowg, i. e. implemented using (additional) hardware.
If yes then what make the Watchdog resets inside 'serial_getc_dev()' while the code is being being executed in infinite loop. (The loop appears infinite if user doesn't press any key)
Nothing... Seems you spotted a potential problem. Potential, as so far no 4xx system uses CONFIG_WATCHDOG.
I suggest you submit a patch?
Best regards,
Wolfgang Denk

Hi,
I have studied the u-boot code for 'watchdog' timer feature. As per my understanding 'Decrementer' interrupt has been used to reset the Watchdog timer. The 'timer_interrupt()' of 'lib_ppc/interrupts.c' gets called whenever the 'Decrement' inetterupt occurs. The 'Decrement Timer' has been initiallized in 'interrupt_init()' of 'lib_ppc/interrupts.c'.
So the 'Decrement Timer' interrupt handler ensures that the 'WATCHDOG_RESET' gets called when user doesn't press key on u-boot prompt for long time.
As the relevant code is already there I don't think we have to add the patch.
Thanks everyone for helping me to solve this riddle.
Regards, Sachin
-----Original Message----- From: Sachin Rane Sent: Thursday, January 15, 2009 6:45 PM To: 'Wolfgang Denk' Cc: u-boot@lists.denx.de Subject: RE: [U-Boot] Watchdog and u-boot command prompt
Hi,
I suggest you submit a patch?
I am doing some kind of stress tetsing of the code to test the 'CONFIG_WATCHDOG' feature. Once I am done I will definitely give the patch for the 'missing' code.
Thanks.
Regards, Sachin
participants (3)
-
Mike Frysinger
-
Sachin Rane
-
Wolfgang Denk