public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Watchdog and u-boot command prompt
@ 2009-01-12 16:20 Sachin Rane
  2009-01-12 19:13 ` Wolfgang Denk
  0 siblings, 1 reply; 13+ messages in thread
From: Sachin Rane @ 2009-01-12 16:20 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-12 16:20 [U-Boot] Watchdog and u-boot command prompt Sachin Rane
@ 2009-01-12 19:13 ` Wolfgang Denk
  2009-01-13  7:45   ` Sachin Rane
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2009-01-12 19:13 UTC (permalink / raw)
  To: u-boot

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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I don't want to be young again, I just don't want to get any older.

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-12 19:13 ` Wolfgang Denk
@ 2009-01-13  7:45   ` Sachin Rane
  2009-01-13 21:31     ` Wolfgang Denk
  0 siblings, 1 reply; 13+ messages in thread
From: Sachin Rane @ 2009-01-13  7:45 UTC (permalink / raw)
  To: u-boot

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 at denx.de] 
Sent: Tuesday, January 13, 2009 12:44 AM
To: Sachin Rane
Cc: u-boot at 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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I
don't want to be young again, I just don't want to get any older.

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-13  7:45   ` Sachin Rane
@ 2009-01-13 21:31     ` Wolfgang Denk
  2009-01-14  6:40       ` Sachin Rane
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2009-01-13 21:31 UTC (permalink / raw)
  To: u-boot

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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is dangerous to be sincere unless you are also stupid.
                                                - George Bernard Shaw

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-13 21:31     ` Wolfgang Denk
@ 2009-01-14  6:40       ` Sachin Rane
  2009-01-14 11:39         ` Mike Frysinger
  2009-01-14 16:00         ` Wolfgang Denk
  0 siblings, 2 replies; 13+ messages in thread
From: Sachin Rane @ 2009-01-14  6:40 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-14  6:40       ` Sachin Rane
@ 2009-01-14 11:39         ` Mike Frysinger
  2009-01-14 16:01           ` Wolfgang Denk
  2009-01-14 16:00         ` Wolfgang Denk
  1 sibling, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2009-01-14 11:39 UTC (permalink / raw)
  To: u-boot

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090114/4b91cbf5/attachment.pgp 

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-14  6:40       ` Sachin Rane
  2009-01-14 11:39         ` Mike Frysinger
@ 2009-01-14 16:00         ` Wolfgang Denk
  2009-01-15 13:14           ` Sachin Rane
  2009-01-23 10:37           ` Sachin Rane
  1 sibling, 2 replies; 13+ messages in thread
From: Wolfgang Denk @ 2009-01-14 16:00 UTC (permalink / raw)
  To: u-boot

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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is common sense to take a method and try it. If it fails, admit it
frankly and try another. But above all, try something.
                                              - Franklin D. Roosevelt

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-14 11:39         ` Mike Frysinger
@ 2009-01-14 16:01           ` Wolfgang Denk
  2009-01-14 16:37             ` Mike Frysinger
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2009-01-14 16:01 UTC (permalink / raw)
  To: u-boot

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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is surely a great calamity for  a  human  being  to  have  no  ob-
sessions.                                                - Robert Bly

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-14 16:01           ` Wolfgang Denk
@ 2009-01-14 16:37             ` Mike Frysinger
  2009-01-14 22:40               ` Wolfgang Denk
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2009-01-14 16:37 UTC (permalink / raw)
  To: u-boot

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090114/3de83fb7/attachment.pgp 

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-14 16:37             ` Mike Frysinger
@ 2009-01-14 22:40               ` Wolfgang Denk
  2009-01-15  2:27                 ` Mike Frysinger
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2009-01-14 22:40 UTC (permalink / raw)
  To: u-boot

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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Remember, Information is not knowledge;  Knowledge  is  not  Wisdom;
Wisdom is not truth; Truth is not beauty; Beauty is not love; Love is
not music; Music is the best."                          - Frank Zappa

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-14 22:40               ` Wolfgang Denk
@ 2009-01-15  2:27                 ` Mike Frysinger
  0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2009-01-15  2:27 UTC (permalink / raw)
  To: u-boot

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090114/2a7d76c0/attachment.pgp 

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-14 16:00         ` Wolfgang Denk
@ 2009-01-15 13:14           ` Sachin Rane
  2009-01-23 10:37           ` Sachin Rane
  1 sibling, 0 replies; 13+ messages in thread
From: Sachin Rane @ 2009-01-15 13:14 UTC (permalink / raw)
  To: u-boot

 
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

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

* [U-Boot] Watchdog and u-boot command prompt
  2009-01-14 16:00         ` Wolfgang Denk
  2009-01-15 13:14           ` Sachin Rane
@ 2009-01-23 10:37           ` Sachin Rane
  1 sibling, 0 replies; 13+ messages in thread
From: Sachin Rane @ 2009-01-23 10:37 UTC (permalink / raw)
  To: u-boot

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 at 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

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

end of thread, other threads:[~2009-01-23 10:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-12 16:20 [U-Boot] Watchdog and u-boot command prompt Sachin Rane
2009-01-12 19:13 ` Wolfgang Denk
2009-01-13  7:45   ` Sachin Rane
2009-01-13 21:31     ` Wolfgang Denk
2009-01-14  6:40       ` Sachin Rane
2009-01-14 11:39         ` Mike Frysinger
2009-01-14 16:01           ` Wolfgang Denk
2009-01-14 16:37             ` Mike Frysinger
2009-01-14 22:40               ` Wolfgang Denk
2009-01-15  2:27                 ` Mike Frysinger
2009-01-14 16:00         ` Wolfgang Denk
2009-01-15 13:14           ` Sachin Rane
2009-01-23 10:37           ` Sachin Rane

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