* GPIO/IRQ expander cannot map interrupt
@ 2011-11-25 10:45 Thierry Reding
[not found] ` <20111125104511.GA16748-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2011-11-25 10:45 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]
Hi,
The following is an extract from a device tree of a Tegra2-based board I'm
working on:
i2c@7000c000 {
clock-frequency = <400000>;
keypad1: sx8634@2b {
compatible = "sx8634";
reg = <0x2b>;
interrupt-parent = <&gpioext>;
interrupts = <2>;
};
gpioext: gpio-ad8p@41 {
compatible = "gpio-ad8p";
reg = <0x41>;
interrupts = <320>; /* gpio PU0 */
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <1>;
};
};
i2c@7000c400 {
clock-frequency = <400000>;
keypad2: sx8634@2b {
compatible = "sx8634";
reg = <0x2b>;
interrupt-parent = <&gpioext>;
interrupts = <3>;
};
};
So basically I have a GPIO/IRQ expander on the first I2C bus (gpioext) to
which the two keypad (sx8634) chips are connected. They use GPIOs 2 and 3 of
the expander as interrupts.
This all seems to work partially: the gpioext is properly detected as parent
for both keypad controllers during I2C device registration. Within the
gpio-ad8p driver I register an IRQ domain (using irq_domain_add_simple()) in
order to allow the OF code to properly map the IRQs for the controller's
children.
The problem, however, is that the keypad I2C devices are registered before the
gpioext device is probed, which results in a situation where the IRQs cannot
be mapped because the gpioext device hasn't had a chance to register the IRQ
domain yet.
Is there anything I can do to make this work? Perhaps the OF code needs to be
patched to ensure that devices which have the gpio-/interrupt-controller
properties are always probed before other devices are registered?
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: GPIO/IRQ expander cannot map interrupt
[not found] ` <20111125104511.GA16748-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
@ 2011-11-28 20:01 ` Stephen Warren
[not found] ` <74CDBE0F657A3D45AFBB94109FB122FF174FDAF8B7-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Warren @ 2011-11-28 20:01 UTC (permalink / raw)
To: Thierry Reding,
Grant Likely (grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org)
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Thierry Reding wrote at Friday, November 25, 2011 3:45 AM:
> The following is an extract from a device tree of a Tegra2-based board I'm
> working on:
>
[swarren: Abbreviated the DT during quoting]
> i2c@7000c000 {
> keypad1: sx8634@2b {
> interrupt-parent = <&gpioext>;
> interrupts = <2>;
> gpioext: gpio-ad8p@41 {
> gpio-controller;
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <1>;
> i2c@7000c400 {
> keypad2: sx8634@2b {
> interrupt-parent = <&gpioext>;
> interrupts = <3>;
>
> So basically I have a GPIO/IRQ expander on the first I2C bus (gpioext) to
> which the two keypad (sx8634) chips are connected. They use GPIOs 2 and 3 of
> the expander as interrupts.
>
> This all seems to work partially: the gpioext is properly detected as parent
> for both keypad controllers during I2C device registration. Within the
> gpio-ad8p driver I register an IRQ domain (using irq_domain_add_simple()) in
> order to allow the OF code to properly map the IRQs for the controller's
> children.
>
> The problem, however, is that the keypad I2C devices are registered before the
> gpioext device is probed, which results in a situation where the IRQs cannot
> be mapped because the gpioext device hasn't had a chance to register the IRQ
> domain yet.
I believe this is something that the forthcoming "deferred probing"
mechanism will solve. This isn't in place yet. I /think/ it's one of the
things that Grant Likely is working on getting going during his sabattical,
so hopefully there will be some patches you can try out soon.
--
nvpublic
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GPIO/IRQ expander cannot map interrupt
[not found] ` <74CDBE0F657A3D45AFBB94109FB122FF174FDAF8B7-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
@ 2011-11-29 6:59 ` Thierry Reding
[not found] ` <20111129065926.GA5044-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2011-11-29 6:59 UTC (permalink / raw)
To: Stephen Warren
Cc: Grant Likely (grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org),
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
[-- Attachment #1: Type: text/plain, Size: 2912 bytes --]
* Stephen Warren wrote:
> Thierry Reding wrote at Friday, November 25, 2011 3:45 AM:
> > The following is an extract from a device tree of a Tegra2-based board I'm
> > working on:
> >
> [swarren: Abbreviated the DT during quoting]
> > i2c@7000c000 {
> > keypad1: sx8634@2b {
> > interrupt-parent = <&gpioext>;
> > interrupts = <2>;
> > gpioext: gpio-ad8p@41 {
> > gpio-controller;
> > #gpio-cells = <2>;
> > interrupt-controller;
> > #interrupt-cells = <1>;
> > i2c@7000c400 {
> > keypad2: sx8634@2b {
> > interrupt-parent = <&gpioext>;
> > interrupts = <3>;
> >
> > So basically I have a GPIO/IRQ expander on the first I2C bus (gpioext) to
> > which the two keypad (sx8634) chips are connected. They use GPIOs 2 and 3 of
> > the expander as interrupts.
> >
> > This all seems to work partially: the gpioext is properly detected as parent
> > for both keypad controllers during I2C device registration. Within the
> > gpio-ad8p driver I register an IRQ domain (using irq_domain_add_simple()) in
> > order to allow the OF code to properly map the IRQs for the controller's
> > children.
> >
> > The problem, however, is that the keypad I2C devices are registered before the
> > gpioext device is probed, which results in a situation where the IRQs cannot
> > be mapped because the gpioext device hasn't had a chance to register the IRQ
> > domain yet.
>
> I believe this is something that the forthcoming "deferred probing"
> mechanism will solve. This isn't in place yet. I /think/ it's one of the
> things that Grant Likely is working on getting going during his sabattical,
> so hopefully there will be some patches you can try out soon.
I've seen some patches floating around, but I'm not sure that, in the current
form, deferred probing will solve this issue. Or at least not solve it in the
most efficient way. From what I understand, deferred probing is merely a sort
of hook that allows the driver to specify at probe time that some resources
are still missing and is used for cases where there is no explicit dependency
information and thus the driver core doesn't know in which order devices need
to be probed.
However, for this particular case we actually have this explicit dependency
information because the devices specify an interrupt and/or GPIO parent.
Moreover it's not really the probing that is the issue here, but rather the
device instantiation. The OF core instantiates the I2C slaves much too early
(i.e. together with the interrupt parent) and therefore requires access to
the IRQ domain mapping at the time of the instantiation already.
Using deferred probing in this case would require the driver to repeat the
complete IRQ mapping sequence that is already done when OF populates the
device tree. Perhaps in addition to deferred probing we also need deferred
*instantiation*.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GPIO/IRQ expander cannot map interrupt
[not found] ` <20111129065926.GA5044-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
@ 2011-11-29 11:48 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2011-11-29 11:48 UTC (permalink / raw)
To: Thierry Reding
Cc: Stephen Warren,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
On Tue, Nov 29, 2011 at 07:59:26AM +0100, Thierry Reding wrote:
> of hook that allows the driver to specify at probe time that some resources
> are still missing and is used for cases where there is no explicit dependency
> information and thus the driver core doesn't know in which order devices need
> to be probed.
The intention is to use it at all times and just not bother with
explicit ordering information as this is going to be more robust
especially given the need to sort out things like driver registration
ordering.
> However, for this particular case we actually have this explicit dependency
> information because the devices specify an interrupt and/or GPIO parent.
> Moreover it's not really the probing that is the issue here, but rather the
> device instantiation. The OF core instantiates the I2C slaves much too early
> (i.e. together with the interrupt parent) and therefore requires access to
> the IRQ domain mapping at the time of the instantiation already.
That's a separate issue though.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-29 11:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-25 10:45 GPIO/IRQ expander cannot map interrupt Thierry Reding
[not found] ` <20111125104511.GA16748-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2011-11-28 20:01 ` Stephen Warren
[not found] ` <74CDBE0F657A3D45AFBB94109FB122FF174FDAF8B7-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-11-29 6:59 ` Thierry Reding
[not found] ` <20111129065926.GA5044-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2011-11-29 11:48 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox