[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] microblaze interrupts



Hi,
I think it makes sense and seems to work for me.

P.S. Here are the patches against CVS version

Regards,
Claudio Lanconelli

George Smith wrote:

>hi
> This also seems to fix a problem with the clock running 2x faster. The
>timer is a level interrupt so handling as an edge should be causing 2
>interrupts instead of one.
> At the moment I'm not working from TOT so here's the changes I made.
>
> to: include/asm-microblaze/microblaze_intc.h
>/* Test if an IRQ is edge or level sensitive */
>#define IRQ_LEVEL_SENSITIVE(irq,IRQ_KINDOFINTR)			\
>        (!((1 << irq) & IRQ_KINDOFINTR))
>
>#define IRQ_EDGE_SENSITIVE(irq,IRQ_KINDOFINTR)			\
>        (((1 << irq) & IRQ_KINDOFINTR))
>
> to: arch/microblaze/microblaze_intc.c
>void microblaze_intc_end(unsigned irq)
>{
>  if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
>    /* Level sensitive interrupts are acked after handling */
>    if(IRQ_LEVEL_SENSITIVE(irq,CONFIG_XILINX_INTC_0_KIND_OF_INTR))
>      microblaze_intc_ack_irq(irq);
>
>    microblaze_intc_enable_irq(irq);
>  }
>}
>
>
>On Thu, 2005-09-29 at 21:34, John Williams wrote:
>  
>
>>Hi George,
>>
>>George Smith wrote:
>>
>>    
>>
>>> Seems that the macro's in microblaze_intc.h are incorrect:
>>>      
>>>
>>[snip]
>>
>> > Also the interrupt end routine:
>>    
>>
>>[snip]
>>
>>    
>>
>>> Shouldn't one ack the existing interrupt before enabling the irq's
>>>again. 
>>> Thoughts???
>>>      
>>>
>>I think you are onto something here.  I've just had an email exchange on
>>this same matter with someone soon to pop up on the list.  Between the
>>two of you it seems that this problem might be licked once and for all.
>>
>>Can I ask that you combine your efforts to produce a patch against
>>current CVS head, so we can distribute it for testing?
>>
>>Thanks for your efforts, it's greatly appreciated.
>>
>>Regards,
>>
>>John
>>
>>
>>
>>___________________________
>>microblaze-uclinux mailing list
>>microblaze-uclinux@itee.uq.edu.au
>>Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
>>Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
>>    
>>

Index: microblaze_intc.c
===================================================================
RCS file: /var/cvs/uClinux-2.4.x/arch/microblaze/kernel/microblaze_intc.c,v
retrieving revision 1.7
diff -u -r1.7 microblaze_intc.c
--- microblaze_intc.c	17 Aug 2005 23:39:27 -0000	1.7
+++ microblaze_intc.c	30 Sep 2005 17:56:24 -0000
@@ -280,37 +280,23 @@
 
 */
    
-#define MAKES_NO_SENSE_BUT_WORKS 1
-
 void microblaze_intc_disable_and_ack_irq(unsigned irq)
 {
 	microblaze_intc_disable_irq(irq);
 
-#if MAKES_NO_SENSE_BUT_WORKS
-	/* Acknowledge level sensitive interrupts immediately */
-	if(IRQ_LEVEL_SENSITIVE(irq,CONFIG_XILINX_INTC_0_KIND_OF_INTR))
-		microblaze_intc_ack_irq(irq);
-#else
 	/* Acknowledge edge sensitive interrupts immediately */
 	if(IRQ_EDGE_SENSITIVE(irq,CONFIG_XILINX_INTC_0_KIND_OF_INTR))
 		microblaze_intc_ack_irq(irq);
-#endif
 }
 
 void microblaze_intc_end(unsigned irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
-		microblaze_intc_enable_irq(irq);
 
-#if MAKES_NO_SENSE_BUT_WORKS
-		/* Edge sensitive interrupts are acked after handling */
-		if(IRQ_EDGE_SENSITIVE(irq,CONFIG_XILINX_INTC_0_KIND_OF_INTR))
-			microblaze_intc_ack_irq(irq);
-#else
 		/* Level sensitive interrupts are acked after handling */
 		if(IRQ_LEVEL_SENSITIVE(irq,CONFIG_XILINX_INTC_0_KIND_OF_INTR))
 			microblaze_intc_ack_irq(irq);
-#endif
+
+		microblaze_intc_enable_irq(irq);
 	}
 }
-
Index: microblaze_intc.h
===================================================================
RCS file: /var/cvs/uClinux-2.4.x/include/asm-microblaze/microblaze_intc.h,v
retrieving revision 1.4
diff -u -r1.4 microblaze_intc.h
--- microblaze_intc.h	1 Nov 2004 05:43:19 -0000	1.4
+++ microblaze_intc.h	30 Sep 2005 17:57:24 -0000
@@ -26,10 +26,10 @@
 
 /* Test if an IRQ is edge or level sensitive */
 #define IRQ_LEVEL_SENSITIVE(irq,IRQ_KINDOFINTR)			\
-	((1 << irq) & IRQ_KINDOFINTR)
+	( ((1 << irq) & IRQ_KINDOFINTR) == 0 )
 
 #define IRQ_EDGE_SENSITIVE(irq,IRQ_KINDOFINTR)			\
-	(!IRQ_LEVEL_SENSITIVE(irq,IRQ_KINDOFINTR))
+	( ((1 << irq) & IRQ_KINDOFINTR) != 0 )
 
 /* What sort of edge sensitive IRQ? */
 #define IRQ_RISING_EDGE(irq,IRQ_KINDOFEDGE) 			\