Subject: Re: Edge Interrupts (Virtex-II Pro)

From: Andrei Konovalov <[email-masked]>
Date: Fri, 04 Feb 2005 14:31:51 +0300

Joshua Lamorie wrote:
> Gidday there,
> 
> Is there a cleaner way to specify that an interrupt is edge triggered 
> other than directly accessing irq_desc_t irq_desc []?

In case of ML300 (which is the only Virtex-II Pro board in the linux-2.5
tree so far) this is done in platforms/xilinx_ml300.c:ml300_init_irq()
based on XPAR_INTC_0_KIND_OF_INTR value defined in the xparameters.h:

         for (i = 0; i < NR_IRQS; i++) {
                 if (XPAR_INTC_0_KIND_OF_INTR & (0x80000000 >> i))
                         irq_desc[i].status &= ~IRQ_LEVEL;
                 else
                         irq_desc[i].status |= IRQ_LEVEL;
         }

As this code is not board specific at all,
I would move it to arch/ppc/syslib/xilinx_pic.c:ppc4xx_pic_init().
Does it sound reasonable (I'll prepare the patch this weekend then)?

Hmm...
Looks like I've forgotten to change the irq numbering here...
Must be
   if (XPAR_INTC_0_KIND_OF_INTR & (0x00000001 << i))
I think...
Will check.

Thanks,
Andrei

P.S.
Just in case you use 2.4.
2.4 kernel is almost the same to 2.6 in this sense.
But the irq numbering is different.

> In my module, when I request_irq, if it succeeds I do the following.
> 
>      irq_desc[iIRQ].status &= ~(IRQ_LEVEL);
> 
> Is there a better way?
>
> Thanks in advance
> 
> Joshua
>