From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Alexandre Courbot <gnurou@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-pcmcia@lists.infradead.org,
Haojian Zhuang <haojian.zhuang@gmail.com>,
linux-gpio@vger.kernel.org,
Kristoffer Ericson <kristoffer.ericson@gmail.com>,
linux-arm-kernel@lists.infradead.org,
Daniel Mack <daniel@zonque.org>
Subject: Re: [PATCH 05/33] gpio: add generic single-register fixed-direction GPIO driver
Date: Sat, 3 Sep 2016 00:34:27 +0100 [thread overview]
Message-ID: <20160902233427.GH1041@n2100.armlinux.org.uk> (raw)
In-Reply-To: <87zinqj8vr.fsf@belgarion.home>
On Fri, Sep 02, 2016 at 11:21:12PM +0200, Robert Jarzmik wrote:
> Ah I think I know what happens. The trick is that when this
> irq_set_chained_handler_and_data() is called, the irq_desc for irq 305 is not
> yet allocated (ie. is NULL). And it is not allocated because
> pxa_cplds_irqs.cplds_probe() was not yet called, and had not allocated the irq
> descriptors.
Grr.
> I would bet that on neponset the input interrupt to the SA1111 is within
> 0..NR_IRQS, which is not the case on lubbock anymore since the pxa_cplds_irqs
> conversion.
It's not, but it's guaranteed to be allocated, because the SA1111 is
declared by neponset after ensuring that the resources are setup.
> It looks that I have an ordering problem :
> - I want gpio-pxa.probe() to be called at device initcall time
> - pxa_cplds_irqs.probe() cannot complete before gpio-pxa.probe() because it
> needs GPIO0 as its interrupt source
> => it might need to honor -EPROBE_DEFER
> - sa1111.sa1111_probe() cannot complete before pxa_cplds_irqs.probe() because
> it needs IRQ305 as its source
> => it might need to honor -EPROBE_DEFER
>
> I fail to see how the "optimized" irq chained handler can be used in a
> device-tree type build, where I don't think the probe ordering is guaranteed.
In a DT environment, platform_get_irq uses of_irq_get() to obtain its
interrupt, which uses irq_find_host() and irq_create_of_mapping() to
get the interrupt number. The IRQ domain for this must exist.
In a DT build, the SA1111 platform device should be declared in the
DT using the normal IRQ properties, and that should cause
platform_get_irq() to return -EPROBE_DEFER if pxa_cplds_irqs hasn't
initialised. So I think in general we're fine - where we're not is
we're not propagating the platform_get_irq() error code back (which
is an easy fix.)
The problem is then what to do with non-DT PXA builds to make sure
this works - the current order really doesn't work, and there's no
way afaics to find out whether an interrupt number passed through
as a platform resource is currently setup with handlers etc. Even
can_request_irq() doesn't tell us that.
We could mess about with the init order to make sure the pxa cplds
stuff initialises earlier (eg, moving it to arch_initcall() rather
than being at device_initcall() time.)
I'm not willing to give up on the current interrupt handling structure
in SA1111 - it's the way it is with good reason, and with a great deal
of experience in getting it working right. The SA1111 has some
behaviours to make it correctly work in an edge-triggered interrupt
environment that need proper handling of the upper levels of the
interrupt hierachy.
We _used_ to take this "request_irq" approach on ARM prior to my rewrite
of the ARM IRQ subsystem, and we had massive problems with lost SA1111
interrupts - particularly PCMCIA card interrupts. That's actually the
whole reason why I rewrote the ARM interrupt code to have these chained
interrupt handlers, which is one of the basis of tglx's genirq code that
we now have. They exist to allow not only a balanced, equal priority
IRQ handling (so any one IRQ can't starve all others if the handlers
are implemented correctly) but also to ensure that IRQs don't get lost,
while avoiding having lots of unnecessary interrupts caused by badly
handled edge IRQs.
The SA1111 is a device designed to be connected to an edge IRQ input,
and it will pulse its interrupt output whenever there's any active
interrupts and _either_ of the interrupt status/clear registers are
written.
The only way to achieve no lost interrupts and no spurious interrupts
is to have SA1111 as a chained interrupt handler and control the
parent at the appropriate points during SA1111 interrupt processing.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2016-09-02 23:34 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160829100232.GC1041@n2100.armlinux.org.uk>
2016-08-29 10:23 ` [RFC PATCH 00/33] SA11x0/PXA GPIO rework (Core + PCMCIA only) Russell King - ARM Linux
2016-08-29 10:24 ` [PATCH 01/33] gpio: sa1100: fix irq probing for ucb1x00 Russell King
2016-09-07 22:25 ` Linus Walleij
2016-08-29 10:24 ` [PATCH 02/33] gpio: sa1100: use sa11x0_gpio_set_wake() Russell King
2016-08-29 10:24 ` [PATCH 03/33] gpio: sa1100: convert to use IO accessors Russell King
2016-08-29 10:24 ` [PATCH 04/33] gpio: sa1100: implement get_direction method Russell King
2016-08-29 10:24 ` [PATCH 05/33] gpio: add generic single-register fixed-direction GPIO driver Russell King
2016-08-29 19:39 ` Robert Jarzmik
2016-08-29 23:12 ` Russell King - ARM Linux
2016-08-30 6:08 ` Alexander Shiyan
2016-08-30 7:41 ` Russell King - ARM Linux
2016-08-30 9:18 ` Russell King - ARM Linux
2016-08-30 16:42 ` Robert Jarzmik
2016-08-30 18:46 ` Russell King - ARM Linux
2016-08-30 21:32 ` Robert Jarzmik
2016-08-31 8:49 ` Russell King - ARM Linux
2016-08-31 10:27 ` Russell King - ARM Linux
2016-09-01 7:19 ` Robert Jarzmik
2016-09-01 9:27 ` Russell King - ARM Linux
2016-09-01 21:58 ` Robert Jarzmik
2016-09-01 23:02 ` Russell King - ARM Linux
2016-09-02 17:50 ` Robert Jarzmik
2016-09-02 18:56 ` Russell King - ARM Linux
2016-09-02 21:21 ` Robert Jarzmik
2016-09-02 23:34 ` Russell King - ARM Linux [this message]
2016-09-03 9:15 ` Russell King - ARM Linux
2016-09-03 9:09 ` Russell King - ARM Linux
2016-09-03 10:25 ` Russell King - ARM Linux
2016-09-03 11:31 ` Robert Jarzmik
2016-09-04 19:04 ` Robert Jarzmik
2016-09-04 20:18 ` Russell King - ARM Linux
2016-09-05 9:06 ` Linus Walleij
2016-09-05 12:26 ` Russell King - ARM Linux
2016-09-08 13:21 ` Linus Walleij
2016-09-14 8:50 ` Linus Walleij
2016-08-30 21:25 ` Linus Walleij
2016-08-30 21:42 ` Russell King - ARM Linux
2016-08-30 21:47 ` Linus Walleij
2016-09-02 17:00 ` Russell King - ARM Linux
2016-09-04 20:53 ` Linus Walleij
2016-08-29 10:24 ` [PATCH 06/33] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register Russell King
2016-08-29 19:57 ` Robert Jarzmik
2016-08-29 22:58 ` Russell King - ARM Linux
2016-08-29 10:24 ` [PATCH 07/33] ARM: sa1100/assabet: add BCR/BSR GPIO driver Russell King
2016-08-29 10:24 ` [PATCH 08/33] ARM: sa1100/neponset: add GPIO drivers for control and modem registers Russell King
2016-08-29 10:24 ` [PATCH 09/33] ARM: sa1111: implement a gpio_chip for SA1111 GPIOs Russell King
2016-08-29 10:24 ` [PATCH 10/33] pcmcia: soc_common: switch to using gpio_descs Russell King
2016-09-14 11:29 ` Linus Walleij
2016-09-14 12:10 ` Russell King - ARM Linux
2016-08-29 10:25 ` [PATCH 11/33] pcmcia: soc_common: request legacy detect GPIO with active low Russell King
2016-08-29 10:25 ` [PATCH 12/33] pcmcia: soc_common: add support for reset and bus enable GPIOs Russell King
2016-08-29 10:25 ` [PATCH 13/33] pcmcia: soc_common: restore previous socket state on error Russell King
2016-08-29 10:25 ` [PATCH 14/33] pcmcia: soc_common: add CF socket state helper Russell King
2016-08-29 10:25 ` [PATCH 15/33] pcmcia: soc_common: add support for Vcc and Vpp regulators Russell King
2016-08-29 10:25 ` [PATCH 16/33] pcmcia: soc_common: switch to a per-socket cpufreq notifier Russell King
2016-08-29 10:25 ` [PATCH 17/33] pcmcia: soc_common: constify pcmcia_low_level ops pointer Russell King
2016-08-29 10:25 ` [PATCH 18/33] pcmcia: sa1100: provide generic CF support Russell King
2016-09-14 8:52 ` Linus Walleij
2016-09-14 9:06 ` Russell King - ARM Linux
2016-09-14 11:13 ` Linus Walleij
2016-08-29 10:25 ` [PATCH 19/33] pcmcia: sa1111: add driver-data pointer Russell King
2016-08-29 10:25 ` [PATCH 20/33] pcmcia: add MAX1600 driver Russell King
2016-08-29 10:25 ` [PATCH 21/33] ARM: sa1100: provide infrastructure to support generic CF sockets Russell King
2016-08-29 10:25 ` [PATCH 22/33] ARM: sa1100/assabet: convert to " Russell King
2016-08-29 10:26 ` [PATCH 23/33] ARM: sa1100/cerf: " Russell King
2016-08-29 10:26 ` [PATCH 24/33] ARM: sa1100/h3xxx: switch h3xxx PCMCIA to use gpiod APIs Russell King
2016-08-29 10:26 ` [PATCH 25/33] ARM: sa1100/nanoengine: convert to generic CF sockets Russell King
2016-08-29 10:26 ` [PATCH 26/33] ARM: sa1100/shannon: switch shannon PCMCIA to use gpiod APIs Russell King
2016-08-29 10:26 ` [PATCH 27/33] ARM: sa1100/simpad: switch simpad CF " Russell King
2016-08-29 10:26 ` [PATCH 28/33] ARM: sa1100/neponset: add GPIOs for PCMCIA Russell King
2016-08-29 10:26 ` [PATCH 29/33] pcmcia: sa1111/neponset: convert to use MAX1600 power driver Russell King
2016-08-29 10:26 ` [PATCH 30/33] ARM: sa1100/jornada720: switch jornada720 PCMCIA to gpiod APIs Russell King
2016-08-29 10:26 ` [PATCH 31/33] ARM: pxa/lubbock: convert PCMCIA to use MAX1600 driver Russell King
2016-08-29 10:26 ` [PATCH 32/33] pcmcia: sa1100*: remove redundant bvd1/bvd2 setting Russell King
2016-08-29 10:26 ` [PATCH 33/33] ARM: sa1111: remove legacy GPIO interfaces Russell King
2016-08-30 21:31 ` [RFC PATCH 00/33] SA11x0/PXA GPIO rework (Core + PCMCIA only) Linus Walleij
2016-09-01 15:34 ` Russell King - ARM Linux
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=20160902233427.GH1041@n2100.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=daniel@zonque.org \
--cc=gnurou@gmail.com \
--cc=haojian.zhuang@gmail.com \
--cc=kristoffer.ericson@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-pcmcia@lists.infradead.org \
--cc=robert.jarzmik@free.fr \
/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;
as well as URLs for NNTP newsgroup(s).