Re: I2C OF IRQ parsing issue due to probe ordering

Ezequiel Garcia
2014-10-30T12:00:11Z

[-- Attachment #1: Type: text/plain, Size: 1816 bytes --]

Hi Laurent,

On 10/25/2014 07:13 PM, Laurent Pinchart wrote:
> Hello,
>
> I recently ran into an issue with the OF IRQ parsing code in the I2C core
> (of_i2c_register_devices in drivers/i2c/i2c-core.c).
>
> My DT contains the following nodes.
>
> gpio1: gpio@e6051000 {
> ...
> #interrupt-cells = <2>;
> interrupt-controller;
> clocks = <&mstp9_clks R8A7790_CLK_GPIO1>;
> };
>
> iic2: i2c@e6520000 {
> #address-cells = <1>;
> #size-cells = <0>;
> ...
> hdmi@39 {
> compatible = "adi,adv7511w";
> reg = <0x39>;
> interrupt-parent = <&gpio1>;
> interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
> ...
> };
> };
>
> mstp9_clks: mstp9_clks@e6150994 {
> ...
> };
>
> The i2c@e6520000 node is probed before the gpio@e6051000 node. The
> of_i2c_register_devices() function tries to register all children, including
> hdmi@39. It tries to parse and map the I2C client IRQ by calling
> irq_of_parse_and_map(), which returns 0 as the interrupt controller isn't
> probed yet. The adv7511 driver later probes the hdmi@39 device and gets
> client->irq set to 0.
>
> We can't control the probe order.

Maybe I'm missing something, but I think your i2c adapter is probed with
a subsys_initcall (as many other adapters). Otherwise, I can't see why
it would be probed before the the gpio controller.

I think this initcall is your problem. Have you tried just using
platform_driver's probe?

--
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]