From: Robin Murphy <robin.murphy@arm.com>
To: richard clark <richard.xnu.clark@gmail.com>, maz@kernel.org
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: Question about SPIs' interrupt trigger type restrictions
Date: Wed, 25 May 2022 20:14:16 +0100 [thread overview]
Message-ID: <35f95ba3-8a7b-7918-0f9d-e14274a5ffe9@arm.com> (raw)
In-Reply-To: <CAJNi4rNwPQf747UM_hiYYwL=HDxg8QnPpfFPv1PfrtN9ZP1y1g@mail.gmail.com>
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) &&
> type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
> 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
> instead of IRQ_TYPE_EDGE_FALLING?
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.
Robin.
[1] https://developer.arm.com/documentation/ihi0069/latest
[2]
https://developer.arm.com/documentation/100336/0106/components-and-configuration/spi-collator/spi-collator-wires?lang=en
next prev parent reply other threads:[~2022-05-25 19:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 10:01 richard clark
2022-05-25 19:14 ` Robin Murphy [this message]
2022-05-26 3:44 ` richard clark
2022-05-26 6:54 ` Marc Zyngier
2022-05-26 8:40 ` Robin Murphy
2022-05-26 12:30 ` richard clark
2022-05-26 13:00 ` Marc Zyngier
2022-05-26 12:09 ` richard clark
2022-05-26 12:52 ` Marc Zyngier
2022-05-30 8:40 ` Daniel Thompson
2022-06-05 12:03 ` richard clark
2022-06-06 10:08 ` Daniel Thompson
2022-06-07 1:29 ` richard clark
2022-06-07 8:47 ` Daniel Thompson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35f95ba3-8a7b-7918-0f9d-e14274a5ffe9@arm.com \
--to=robin.murphy@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=richard.xnu.clark@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®