[U-Boot] Watchdog timer and booting in Linux kernel

Hi,
I am using u-boot and linux kernel on our custom PPC440gx board. The board was booting without any issue.
The board started rebooting while booting in linux kernel after enabled the watchdog timer in u-boot by defining 'CONFIG_WATCHDOG'. I have observed that the board gets reset while booting in Linux.
I followed the discussion available on: http://osdir.com/ml/boot-loaders.u-boot/2001-07/msg00121.html
I modified the code given in above link to run it on ppc440gx processor. I have written a function 'reset_watchdog()' in kernel which will reset the Watchdog Timer (same as available in u-boot) and called in 'timer_interrupt()' of /arch/ppc/kernel/time.c' But the function is not giving any effect. The board is still getting rebooted.
8<-------------------------arch/ppc/kernel/time.c ------------------------------------
unsigned long sched_watchdog_counter = 0;
void reset_watchdog() { unsigned long val = 0; char buff[20]; local_irq_disable(); val = mfspr(0x150); mtspr(0x150, !(val) | 0x40000000); val = mfspr(0x150); sprintf(buff,"val = %x\n",val); local_irq_enable(); }
void timer_interrupt(struct pt_regs * regs) { : : : reset_watchdog();
irq_exit(); }
8<-------------------------arch/ppc/kernel/time.c ------------------------------------
Can you help me to boot the board in Linux kernel with watchdog enabled in u-boot?
Regards, Sachin

Dear Sachin Rane,
In message 73FA539107892C4C8C7A5ACA10C161C85BE107@MX2.AlphionCorp.local you wrote:
I am using u-boot and linux kernel on our custom PPC440gx board. The board was booting without any issue.
The board started rebooting while booting in linux kernel after enabled the watchdog timer in u-boot by defining 'CONFIG_WATCHDOG'.
That is to be expected unless you have working watchdog support in your Linux kernel, too.
I have observed that the board gets reset while booting in Linux.
Yes, the watchdog is supposed to do exactly that. So everything is indeed working as expected.
I followed the discussion available on: http://osdir.com/ml/boot-loaders.u-boot/2001-07/msg00121.html
Ouch. That is a *bit* old, it deems.
I modified the code given in above link to run it on ppc440gx processor.
Why don't you use the existing code for example for 440EPx from our kernel tree?
I have written a function 'reset_watchdog()' in kernel which will reset the Watchdog Timer (same as available in u-boot) and called in 'timer_interrupt()' of /arch/ppc/kernel/time.c' But the function is not giving any effect. The board is still getting rebooted.
arch/ppc/ ? arch/ppc/ is dead. It has been removed from the Linux kernel tree a long time ago.
Best regards,
Wolfgang Denk

Hi,
Thanks for the reply.
Why don't you use the existing code for example for 440EPx from our
kernel tree?
Are you pointing to the code which comes under 'CONFIG_BOOKE_WDT' in 'arch/powerpc/kernel/traps.c'? If not, can you give me the location of the 'example' code in kerenl code?
Regards, Sachin

Dear "Sachin Rane",
In message 73FA539107892C4C8C7A5ACA10C161C85BE10D@MX2.AlphionCorp.local you wrote:
Why don't you use the existing code for example for 440EPx from our
kernel tree?
Are you pointing to the code which comes under 'CONFIG_BOOKE_WDT' in 'arch/powerpc/kernel/traps.c'? If not, can you give me the location of the 'example' code in kerenl code?
See drivers/watchdog/wd.c plus Documentation/watchdog/wdt_chain.txt and drivers/watchdog/wdt_chains.c
Best regards,
Wolfgang Denk

Hi,
We able to integrate u-boot with Linux along with Watchdog enabled for PPC440gx processor. Here I am giving the modification we did to make it work.
The intention to write this mail is to provide a reference code for the people who wants to use Watchdog feature with PPC440gx.
We have used u-boot-1.1.4 and Linux Kernel of version 2.6.16 on PPC440gx processor.
Steps that we have taken: 1. Enabled 'CONFIG_WATCHDOG' flag code in u-boot code.
2. Modified the 'kernel-2.6.16.1-ts.amcc440gx.basic.1\arch\ppc\kernel\time.c' (Modified code starts with 'Sachin' tag)
void reset_watchdog(void) { /* Sachin: Resetting Bit#0 and Bit#1 mtspr(SPRN_TSR, 0xc0000000); /*Sachin: added - end */ }
void timer_interrupt(struct pt_regs * regs) { int next_dec; unsigned long cpu = smp_processor_id(); unsigned jiffy_stamp = last_jiffy_stamp(cpu); extern void do_IRQ(struct pt_regs *);
/* Sachin: Reset the Watchdog timer */ reset_watchdog(); /*Sachin: added - end */
: : : : if (ppc_md.heartbeat && !ppc_md.heartbeat_count--) ppc_md.heartbeat();
irq_exit(); }
3. Modified the 'kernel-2.6.16.1-ts.amcc440gx.basic.1\arch\ppc\syslib\ibm44x_common.c':
void __init ibm44x_calibrate_decr(unsigned int freq) { unsigned long value; tb_ticks_per_jiffy = freq / HZ; tb_to_us = mulhwu_scale_factor(freq, 1000000); : : :
/*Sachin: added - start */ value = mfspr(SPRN_TCR); value |= TCR_DIE; mtspr(SPRN_TCR, value); /*Sachin: added - end */
//mtspr(SPRN_TCR, TCR_DIE); }
Thanks.
Regards, Sachin Rane
participants (2)
-
Sachin Rane
-
Wolfgang Denk