Re: [U-Boot] Watchdog timer and booting in Linux kernel
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, 0xc000); /*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, 100); : : : /*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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Watchdog timer and booting in Linux kernel
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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[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) | 0x4000); 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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Watchdog and u-boot command prompt
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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Watchdog and u-boot command prompt
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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Watchdog and u-boot command prompt
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:w...@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 <73fa539107892c4c8c7a5aca10c161c85be...@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: w...@denx.de I don't want to be young again, I just don't want to get any older. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot