[lkml]   [2022]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Question about SPIs' interrupt trigger type restrictions
On 2022-05-25 11:01, richard clark wrote:
> Hi Marc,
> For below code snippet about SPI interrupt trigger type:
> static int gic_set_type(struct irq_data *d, unsigned int type)
> {
> ...
> /* SPIs have restrictions on the supported types */
> if ((range == SPI_RANGE || range == ESPI_RANGE) &&
> return -EINVAL;
> ...
> }
> We have a device at hand whose interrupt type is SPI, Falling edge
> will trigger the interrupt. But the request_irq(50, handler,
> IRQ_TYPE_EDGE_FALLING, ...) will return -EINVAL.
> The question is, why must the SPI interrupt use IRQ_TYPE_EDGE_RISING

Because that's what the GIC architecture[1] says. From section 1.2.1
"Interrupt Types":

"An interrupt that is edge-triggered has the following property:
• It is asserted on detection of a rising edge of an interrupt signal
and then, regardless of the state of the signal, remains asserted until
the interrupt is acknowledged by software."

External signals with the wrong polarity may need external logic to
invert them (which might even be offered by the GIC implementation
itself, e.g. [2]), but the programmer's model neither knows nor cares
about such details, it only knows notions of "edge-triggered" and
"level-sensitive", where from its point of view the asserted states are
rising and high respectively.



 \ /
  Last update: 2022-05-25 21:17    [W:0.070 / U:2.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site