Subject: Re: mpc5200 timer3 Interrupts stopped working

From: bennett78 <[email-masked]>
Date: Fri, 24 Feb 2006 15:49:26 -0700

bennett78 wrote:

> Help, how do I debug timer3 Interrupts?  My driver was working and 
> then interrupts

Never mind H/W problem...the J27 jumper on the 5200Lite was missing.  I 
did get a change to
review arch/ppc/kernel/mpc5xxx-pic.c & my interrupt masks settings!

Sorry for the thread interrupt!

Frank Bennett

> stopped coming (most likely blocked).  I have a driver that is very 
> similar to
>      linuxppc_2_4_devel/drivers/char/pp01_ad64.c
> I have attached the complete driver (et.c)
>
> / # insmod et
> ET Display Driver v0.1 loaded ET_TIN irq 16
>
> et_init 00 intr->per_mask  1bfffc00
> et_init 10 intr->ctrl      00c01001
> et_init 14 intr->main_mask 00010e00
> et_init 24 intr->enc_stat  00000001
> et_init 28 intr->crit_stat 00000000
> et_init 2c intr->main_stat 00002000
> et_init 30 intr->per_stat  00000000
> et_init 38 intr->per_error 00000000
>
> / # cat /proc/interrupts
>            CPU0
>  16:          0  MPC5xxx Edge      et Trubine
>  23:       1049  MPC5xxx Edge      eth_xmit
>  24:       2468  MPC5xxx Edge      eth_recv
>  39:         51  MPC5xxx Edge      serial
>  40:          0  MPC5xxx Edge      serial
>  43:         69  MPC5xxx Edge      eth_err
> BAD:          0
>
> with a pulse train on timer3 input "et_interrupt" no longer gets
> called.
>
> code snippets
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> #define ET_TIN         3   // Turbine PULSE IN
>
> static void et_interrupt (int irq, void *dev_id, struct pt_regs * regs)
> {
>     int port = ET_IRQ_TO_PORT(irq);
>     unsigned long stat;
>
>     printk(KERN_INFO "et_interrupt IRQ %d port %d main_stat %x gpt.sr 
> %x \n",
>                         irq, port, intr->main_status, gpt[port].sr );
>
>     if( port == ET_TIN ) {
>         // Clear pending interrupt
>         stat = in_be32(&gpt[port].sr) & 0xffff;
>         out_be32(&gpt[port].sr,  MPC5xxx_GPT_SR_CAPT);
>         printk(KERN_INFO "et_int irq=%d port=%d stat %0lx \n", irq, 
> port, stat);
>         // wake_up_interruptible(&et_wait);
>     } else {
>         printk(KERN_ERR ET_MSG "Unexpected IRQ %d received", irq);
>     }
>     spin_lock (&et_lock);
>     turbine_per = in_be32(&gpt[port].sr) >> 16;
>     spin_unlock (&et_lock);
> }
>
>
> static int __init et_init (void)
> ....
> if (request_irq(ET_PORT_TO_IRQ(ET_TIN), et_interrupt, 0, "et Trubine", 
> NULL)) {
>             printk(KERN_ERR ET_MSG "couldn't register interrupts\n");
>             goto abort_remove_proc;
>     }
> out_be32(&gpt[ET_TIN].cir, (   66<<16) | 1 );  /* prescale(16), 
> period(16)  */
> out_be32(&gpt[ET_TIN].emsr,
>         MPC5xxx_GPT_EMSR_INP_CAPTURE
>       | MPC5xxx_GPT_EMSR_ICT_FALLING
>       | MPC5xxx_GPT_EMSR_INT_ENABLE);
> ...
> printk(KERN_INFO "ET Display Driver v%s loaded ET_TIN irq %d\n",
>         ET_VERSION, ET_PORT_TO_IRQ(ET_TIN) );
>
>     //broke with or without the following
>     intr->main_mask &= ~(0x000000ff);   /* enable timer ints */
>
>     printk(KERN_INFO "et_init 00 intr->per_mask  %08x\n", intr->per_mask);
>     printk(KERN_INFO "et_init 10 intr->ctrl      %08x\n", intr->ctrl);
>     printk(KERN_INFO "et_init 14 intr->main_mask %08x\n", 
> intr->main_mask);
>     printk(KERN_INFO "et_init 24 intr->enc_stat  %08x\n", 
> intr->enc_status);
>     printk(KERN_INFO "et_init 28 intr->crit_stat %08x\n", 
> intr->crit_status);
>     printk(KERN_INFO "et_init 2c intr->main_stat %08x\n", 
> intr->main_status);
>     printk(KERN_INFO "et_init 30 intr->per_stat  %08x\n", 
> intr->per_status);
>     printk(KERN_INFO "et_init 38 intr->per_error %08x\n", 
> intr->per_error);
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> thanks in advance for any help,
>
> Frank Bennett
>