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

Sachin Rane SRane at alphion.com
Wed Mar 4 08:42:09 CET 2009


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



More information about the U-Boot mailing list