public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Software watchdog on mpc8247
@ 2005-08-25  5:46 Mike Rapoport
  2005-08-25  7:04 ` Wolfgang Denk
  2005-08-25 11:40 ` Jerry Van Baren
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Rapoport @ 2005-08-25  5:46 UTC (permalink / raw)
  To: u-boot

Hello,

I have a custom board with mpc8247 processor. I'd like to use it's
internal watchdog capability in u-boot (and linux).
I've tried to use the folliwing defines in my board config file
(include/configs/my_board.h):

#define CONFIG_WATCHDOG   1
#if defined(CONFIG_WATCHDOG)
#define CFG_SYPCR       (SYPCR_SWTC|SYPCR_BMT|SYPCR_PBME|SYPCR_LBME|\
           SYPCR_SWRI|SYPCR_SWP|SYPCR_SWE)
#else
#define CFG_SYPCR       (SYPCR_SWTC|SYPCR_BMT|SYPCR_PBME|SYPCR_LBME|\
           SYPCR_SWRI|SYPCR_SWP)
#endif /* CONFIG_WATCHDOG */

but the board does not boot when the watchdog is enabled.
I use u-boot 1.1.3 release.

--
Sincerely yours,
Mike Rapoport

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

* [U-Boot-Users] Software watchdog on mpc8247
  2005-08-25  5:46 [U-Boot-Users] Software watchdog on mpc8247 Mike Rapoport
@ 2005-08-25  7:04 ` Wolfgang Denk
  2005-08-25 10:42   ` Mike Rapoport
  2005-08-25 11:40 ` Jerry Van Baren
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2005-08-25  7:04 UTC (permalink / raw)
  To: u-boot

In message <f870da180508242246126ce433@mail.gmail.com> you wrote:
> 
> but the board does not boot when the watchdog is enabled.
> I use u-boot 1.1.3 release.

How far does it get, and what exactly happens? "Does not boot" is not
exactly a precise description...

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There are always alternatives.
	-- Spock, "The Galileo Seven", stardate 2822.3

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

* [U-Boot-Users] Software watchdog on mpc8247
  2005-08-25  7:04 ` Wolfgang Denk
@ 2005-08-25 10:42   ` Mike Rapoport
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Rapoport @ 2005-08-25 10:42 UTC (permalink / raw)
  To: u-boot

On 8/25/05, Wolfgang Denk <wd@denx.de> wrote:
> 
> How far does it get, and what exactly happens? "Does not boot" is not
> exactly a precise description...
> 
> Best regards,
> 
> Wolfgang Denk
> 
Unfortunately I don't have BDI so the only "debug" available is
on-board led and scope.
Using this I determined that u-boot starts initialization sequence in
board_init_f (lib_ppc/board.c) and then restarts.

-- 
	Sincerely Yours,
		Mike.

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

* [U-Boot-Users] Software watchdog on mpc8247
  2005-08-25  5:46 [U-Boot-Users] Software watchdog on mpc8247 Mike Rapoport
  2005-08-25  7:04 ` Wolfgang Denk
@ 2005-08-25 11:40 ` Jerry Van Baren
  2005-08-25 12:35   ` Mike Rapoport
  1 sibling, 1 reply; 8+ messages in thread
From: Jerry Van Baren @ 2005-08-25 11:40 UTC (permalink / raw)
  To: u-boot

Mike Rapoport wrote:
> Hello,
> 
> I have a custom board with mpc8247 processor. I'd like to use it's
> internal watchdog capability in u-boot (and linux).
> I've tried to use the folliwing defines in my board config file
> (include/configs/my_board.h):
> 
> #define CONFIG_WATCHDOG   1
> #if defined(CONFIG_WATCHDOG)
> #define CFG_SYPCR       (SYPCR_SWTC|SYPCR_BMT|SYPCR_PBME|SYPCR_LBME|\
>            SYPCR_SWRI|SYPCR_SWP|SYPCR_SWE)
> #else
> #define CFG_SYPCR       (SYPCR_SWTC|SYPCR_BMT|SYPCR_PBME|SYPCR_LBME|\
>            SYPCR_SWRI|SYPCR_SWP)
> #endif /* CONFIG_WATCHDOG */
> 
> but the board does not boot when the watchdog is enabled.
> I use u-boot 1.1.3 release.
> 
> --
> Sincerely yours,
> Mike Rapoport

What did you set the SYPCR to (actual values, preferably from a 
disassembly/dump)?  What is your bus clock?  What do you figure your 
timeout to be?  Do you write to the SYPCR only once to set up the WDT 
(only the first write to the SYPCR "works").

gvb

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

* [U-Boot-Users] Software watchdog on mpc8247
  2005-08-25 11:40 ` Jerry Van Baren
@ 2005-08-25 12:35   ` Mike Rapoport
  2005-08-25 12:51     ` Jerry Van Baren
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Rapoport @ 2005-08-25 12:35 UTC (permalink / raw)
  To: u-boot

On 8/25/05, Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com> wrote:
> 
> What did you set the SYPCR to (actual values, preferably from a
> disassembly/dump)?  

Here's the output of "objdump -dS u-boot" :
/* Initialise the SYPCR early, and reset the watchdog (if req)  */
/*--------------------------------------------------------------*/

        lis     r3, (CFG_IMMR+IM_REGBASE)@h
fff03198:       3c 60 f0 01     lis     r3,-4095
#if !defined(CONFIG_COGENT)
        lis     r4, CFG_SYPCR at h
fff0319c:       3c 80 ff ff     lis     r4,-1
        ori     r4, r4, CFG_SYPCR at l
fff031a0:       60 84 ff c3     ori     r4,r4,65479
        stw     r4, IM_SYPCR at l(r3)
fff031a4:       90 83 00 04     stw     r4,4(r3)
#endif /* !CONFIG_COGENT */
#if defined(CONFIG_WATCHDOG)
        li      r4, 21868               /* = 0x556c */
        sth     r4, IM_SWSR at l(r3)
        li      r4, -21959              /* = 0xaa39 */
        sth     r4, IM_SWSR at l(r3)

Actual SYPCR setting is 0xFFFFFFC7
I verified that this code is executed.

I've tried to add WATCHDOG_RESET() call in board_init_f just before
the initialization sequence was run, but it didn't change anything.

> What is your bus clock?  

66MHz

> What do you figure your  timeout to be?  

2 sec

> Do you write to the SYPCR only once to set up the WDT
> (only the first write to the SYPCR "works").

Yes


-- 
	Sincerely Yours,
		Mike.

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

* [U-Boot-Users] Software watchdog on mpc8247
  2005-08-25 12:35   ` Mike Rapoport
@ 2005-08-25 12:51     ` Jerry Van Baren
  2005-08-25 13:55       ` Mike Rapoport
  0 siblings, 1 reply; 8+ messages in thread
From: Jerry Van Baren @ 2005-08-25 12:51 UTC (permalink / raw)
  To: u-boot

Mike Rapoport wrote:
> On 8/25/05, Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com> wrote:
> 
>>What did you set the SYPCR to (actual values, preferably from a
>>disassembly/dump)?  
> 
> 
> Here's the output of "objdump -dS u-boot" :
> /* Initialise the SYPCR early, and reset the watchdog (if req)  */
> /*--------------------------------------------------------------*/
> 
>         lis     r3, (CFG_IMMR+IM_REGBASE)@h
> fff03198:       3c 60 f0 01     lis     r3,-4095
> #if !defined(CONFIG_COGENT)
>         lis     r4, CFG_SYPCR at h
> fff0319c:       3c 80 ff ff     lis     r4,-1
>         ori     r4, r4, CFG_SYPCR at l
> fff031a0:       60 84 ff c3     ori     r4,r4,65479
>         stw     r4, IM_SYPCR at l(r3)
> fff031a4:       90 83 00 04     stw     r4,4(r3)
> #endif /* !CONFIG_COGENT */
> #if defined(CONFIG_WATCHDOG)
>         li      r4, 21868               /* = 0x556c */
>         sth     r4, IM_SWSR at l(r3)
>         li      r4, -21959              /* = 0xaa39 */
>         sth     r4, IM_SWSR at l(r3)
> 
> Actual SYPCR setting is 0xFFFFFFC7
> I verified that this code is executed.
> 
> I've tried to add WATCHDOG_RESET() call in board_init_f just before
> the initialization sequence was run, but it didn't change anything.
> 
>>What is your bus clock?  
> 
> 66MHz
> 
>>What do you figure your  timeout to be?  
> 
> 2 sec
> 
>>Do you write to the SYPCR only once to set up the WDT
>>(only the first write to the SYPCR "works").
> 
> Yes

Pointing out the obvious... looking at the disassembly, it isn't 
enabling the watchdog (SWE).  I'm guessing that you disassembled code 
where you had the watchdog disabled?

I see you have PBME and LBME enabled (I'm looking at an 8260 manual, 
assuming the 8247 is the same - feel free to correct me :-).  Do you 
have a 60x bus and a local bus?  Is it possible you are having an 
inadvertant bus error?  This wouldn't explain why it only happens when 
you enable the WDT, however.  Puzzling.

gvb

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

* [U-Boot-Users] Software watchdog on mpc8247
  2005-08-25 12:51     ` Jerry Van Baren
@ 2005-08-25 13:55       ` Mike Rapoport
  2005-08-25 14:40         ` Jerry Van Baren
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Rapoport @ 2005-08-25 13:55 UTC (permalink / raw)
  To: u-boot

On 8/25/05, Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com> wrote:
>
> 
> Pointing out the obvious... looking at the disassembly, it isn't
> enabling the watchdog (SWE).  I'm guessing that you disassembled code
> where you had the watchdog disabled?

The instruction
fff031a0:       60 84 ff c3     ori     r4,r4,65479 
actually enables watchdog (65479 dec = ffc7 hex) and SWE is bit 29 of SYPCR.
 
> I see you have PBME and LBME enabled (I'm looking at an 8260 manual,
> assuming the 8247 is the same - feel free to correct me :-).  Do you
> have a 60x bus and a local bus?  Is it possible you are having an
> inadvertant bus error?  This wouldn't explain why it only happens when
> you enable the WDT, however.  Puzzling.

The 8247 does not have local bus, only 60x, but setting/clearing LBME
does not affect the operation. If I don't enable the watchdog the
system works fine.

Another thing I've noticed, most or even all 8260 based systems have
#undef CONFIG_WATCHDOG
in their config 

-- 
	Sincerely Yours,
		Mike.

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

* [U-Boot-Users] Software watchdog on mpc8247
  2005-08-25 13:55       ` Mike Rapoport
@ 2005-08-25 14:40         ` Jerry Van Baren
  0 siblings, 0 replies; 8+ messages in thread
From: Jerry Van Baren @ 2005-08-25 14:40 UTC (permalink / raw)
  To: u-boot

Mike Rapoport wrote:
> On 8/25/05, Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com> wrote:
> 
>>
>>Pointing out the obvious... looking at the disassembly, it isn't
>>enabling the watchdog (SWE).  I'm guessing that you disassembled code
>>where you had the watchdog disabled?
> 
> 
> The instruction
> fff031a0:       60 84 ff c3     ori     r4,r4,65479 
> actually enables watchdog (65479 dec = ffc7 hex) and SWE is bit 29 of SYPCR.

Well... yes and no.  65479 == 0xFFC7 as you point out, however the 
instruction has 0xFFC3 in it.  That's pretty odd.  Compiler problem?

>>I see you have PBME and LBME enabled (I'm looking at an 8260 manual,
>>assuming the 8247 is the same - feel free to correct me :-).  Do you
>>have a 60x bus and a local bus?  Is it possible you are having an
>>inadvertant bus error?  This wouldn't explain why it only happens when
>>you enable the WDT, however.  Puzzling.
> 
> 
> The 8247 does not have local bus, only 60x, but setting/clearing LBME
> does not affect the operation. If I don't enable the watchdog the
> system works fine.
> 
> Another thing I've noticed, most or even all 8260 based systems have
> #undef CONFIG_WATCHDOG
> in their config 

Well, they are a real pain, generally more than they are worth.  My 
co-worker says we had it working on our 8260 board at one point, but 
Things Changed and it stopped working (it was a never-ending battle to 
sprinkle enough kick-the-dogs in the start up code) and so it ended up 
turned off.  He said it worked fine once we got through initialization 
and the was kernel running...

gvb

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

end of thread, other threads:[~2005-08-25 14:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-25  5:46 [U-Boot-Users] Software watchdog on mpc8247 Mike Rapoport
2005-08-25  7:04 ` Wolfgang Denk
2005-08-25 10:42   ` Mike Rapoport
2005-08-25 11:40 ` Jerry Van Baren
2005-08-25 12:35   ` Mike Rapoport
2005-08-25 12:51     ` Jerry Van Baren
2005-08-25 13:55       ` Mike Rapoport
2005-08-25 14:40         ` Jerry Van Baren

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