2010-12-09 07:33:55     clear pending interrupts in bfin_gpio_unmask_irq?

Document created by Aaronwu Employee on Aug 25, 2013
Version 1Show Document
  • View in full screen mode

2010-12-09 07:33:55     clear pending interrupts in bfin_gpio_unmask_irq?

Rutger Hofman (NETHERLANDS)

Message: 96590   

 

Good morning forum,

 

arch/blackfin/mach-commin/ints-priority.c, function bfin_gpio_unmask_irq() #ifdef CONFIG_BF54x, line 869 in my current git clone, has:

 

    pint[bank]->request = pintbit;

 

This clears any pending interrupts at the moment a GPIO interrupt is unmasked. This gives me problems when the interrupt is edge-type, and the edge occurred during a period that this interrupt is masked. It happened in my ethernet driver transmit (ax88796 which is a NE2000 so it uses lib8390): that function masks interrupts, sends out, then unmasks. If the 'sent' interrupt is flagged before interrupts are unmasked, the interrupt is lost, and everything grinds to a halt.

 

Is there a reason to clear this interrupt, or is it a bug?

 

OTOH, the Blackfin HRM suggests to clear any pending interrupts when an interrupt is configured, so I would expect this statement somewhere in bfin_gpio_irq_type() in the same file. Same question.

 

Rutger Hofman, VU Amsterdam

QuoteReplyEditDelete

 

 

2010-12-09 15:05:16     Re: clear pending interrupts in bfin_gpio_unmask_irq?

Mike Frysinger (UNITED STATES)

Message: 96592   

 

my understanding is that the mask/unmask irqchip funcs should be doing only that.  they shouldnt be implicitly acking the interrupt.  i'll double check with Michael since he wrote the code.

 

where exactly in the HRM do you see the suggestion you mention ?

QuoteReplyEditDelete

 

 

2010-12-10 07:38:29     Re: clear pending interrupts in bfin_gpio_unmask_irq?

Rutger Hofman (NETHERLANDS)

Message: 96629   

 

On clearing pending latches when configuring an interrupt: a quick search in HRM bf54x rev-1.0 for 'history' shows 3 places:

 

    Figure 9-6. GPIO Programming Model Flow (Part 3): the box where the arrows merge again

    Listing 9-3, page 9-70

    Listing 9-5, page 9-73

 

Right now, I don't see it in the text itself.

 

Rutger

QuoteReplyEditDelete

 

 

2010-12-10 13:50:04     Re: clear pending interrupts in bfin_gpio_unmask_irq?

Mike Frysinger (UNITED STATES)

Message: 96636   

 

i think figure (1) is more of a "this is the first bring up of the pin" rather than "you have to clear it every time".  it's designed as a primer for people rather than "this is the exact order things must be done in order to make things work".

 

same goes for the coding examples.  notice how they configure pretty much everything from an unconfigured state.  which is not what Linux is ;).

 

i talked to Michael (since this has been around since the first merge he wrote) and he agrees it looks incorrect.  so i'll remove it in svn.

Attachments

    Outcomes