Sv: GPIO level IRQ fires twice each time.

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

 



> On Fri, Jan 21, 2022 at 09:03:43AM +0000, Markus Mirevik wrote:
> > I have a problem with a custom bord based on SoC am335x and a driver
> utilizing a GPIO line for interrupts.
> >
> > I have two mcp2518fd chip connected on one SPI line and everything
> works, but it's hogs a lot of CPU.
> > In the current setup only one chip is connected and it only receives packets.
> >
> > The mcp2518fd is connected with 2 interrupt lines one "main" and one for
> rx frames.
> >
> > The problem is that for every frame received the interrupt handler is run
> twice, which is kind of expensive since it's a SPI call to the chip to check
> interrupt registers.
> >
> > To me it looks like the interrupt is fired again as soon as it's unmasked.
> Either because it's queued? or maybe not cleared internally?
> > I have scoped the interrupt signal and its real good without any glitches.
> >
> > I'm currently running a yocto build:
> > Linux botekcc 5.10.79-yocto-tiny #1 SMP Tue Nov 16 03:57:43 UTC 2021
> > armv7l armv7l armv7l GNU/Linux
> >
> > But the mcp251xfd driver is from net-next/master
> >
> > mcp251xfd_irq is the irqhandler for the mcp2518fd and is added like this:
> > err = request_threaded_irq(spi->irq, NULL, mcp251xfd_irq,
> >                                    IRQF_SHARED | IRQF_ONESHOT,
> >                                    dev_name(&spi->dev), priv);
> >
> 
> You haven't set a IRQF_TRIGGER flag, so you are getting the "as-already-
> configured" behaviour, which on your setup is both edges?
> Try adding IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING,
> IRQF_TRIGGER_HIGH or IRQF_TRIGGER_LOW, as appropriate to your use
> case, to your flags.
> 
> Cheers,
> Kent.

I have tried with the IRQF_TRIGGGER_LOW flag as well. With same result. i.e the interrupt is fired again as soon as the handler is ready. Even if the interrupt line is deactivated. 
However if I change the trigger to edge falling the interrupt will only fire once. But his will inevitably lead to a missed edge eventually.

Regards
Markus 











[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux