Skip to contentSkip to conversation

Q: define i2c nodes in device tree?

DISCUSSION Albrecht Dre� 3 participants 3 messages Mar 27, 2009

lore
Share & tools
lore
#0 lore raw

Hi Timur:

Quoted 1 line

You need to have a "gpio I2C" device driver that registers the same name =

as what's in the DTS, like this:

Thanks, that did the trick; a proper naming is apparently

pca8575:gpio@20 {
        compatible =3D "nxp,pca8575";
        device_type =3D "gpio";
        reg =3D <0x20 1>;
};

Now the driver is called, but complains that no platform data is present. = Still have to figure out how to pass that... :-/

An other confusing thing: although the probe function fails with error -EIN= VAL, the device gets registered:

<7>[    0.801814] i2c 1-0020: uevent
<7>[    0.802213] pcf857x 1-0020: probe
<7>[    0.802236] pcf857x 1-0020: no platform data
<4>[    0.802265] pcf857x: probe of 1-0020 failed with error -22
<7>[    0.807980] i2c-adapter i2c-1: client [pca8575] registered with bus i=

d 1-0020

# ls -al /sys/devices/f0000000.soc5200/f0003d40.i2c/i2c-adapter/i2c-1/
drwxr-xr-x    6 0        0               0 Jan  1 00:00 .
drwxr-xr-x    3 0        0               0 Jan  1 00:00 ..
drwxr-xr-x    2 0        0               0 Jan  1 00:00 1-0020
drwxr-xr-x    2 0        0               0 Jan  1 00:00 1-0021
drwxr-xr-x    2 0        0               0 Jan  1 00:00 1-0022
[...]

Is this the intended behaviour?

Thanks, Albrecht.

Zerrei=DFen Sie die Netze der Phisher, Hacker und Betr=FCger! Ihre Internet-Sicherheits-Seiten auf Arcor.de bieten alle Infos und Hilfsmi= ttel, die Sie zum sicheren Surfen brauchen! Play it safe!
http://www.arcor.de/footer-sicherheit/

#1 lore raw
Quoted 1 line · On Fri, Mar 27, 2009 at 8:05 AM, Albrecht Dre=DF <[email protected]> =…

Now the driver is called, but complains that no platform data is present.=

=A0Still have to figure out how to pass that... :-/

I believe there was code added recently to i2c-mpc.c to put DTS properties into the platform device, but I don't see it right now.

Quoted 2 lines
# ls -al /sys/devices/f0000000.soc5200/f0003d40.i2c/i2c-adapter/i2c-1/
drwxr-xr-x =A0 =A06 0 =A0 =A0 =A0 =A00 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 Jan =

=A01 00:00 .

Quoted 1 line

drwxr-xr-x =A0 =A03 0 =A0 =A0 =A0 =A00 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 Jan =

=A01 00:00 ..

Quoted 1 line

drwxr-xr-x =A0 =A02 0 =A0 =A0 =A0 =A00 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 Jan =

=A01 00:00 1-0020

Quoted 1 line

drwxr-xr-x =A0 =A02 0 =A0 =A0 =A0 =A00 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 Jan =

=A01 00:00 1-0021

Quoted 1 line

drwxr-xr-x =A0 =A02 0 =A0 =A0 =A0 =A00 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 Jan =

=A01 00:00 1-0022

Quoted 3 lines

[...]

Is this the intended behaviour?

I think the entries in /sys/devices/f0000000.soc5200 are from the device tree directly. They're not related to any device driver. I believe you'll find those entries still there even if your driver isn't loaded at all.

--=20
Timur Tabi
Linux kernel developer at Freescale

#2 lore raw
In reply to Albrecht Dre�
Quoted 9 lines · Albrecht Dre�

Hi Timur:

Quoted 1 line

You need to have a "gpio I2C" device driver that registers the same name as what's in the DTS, like this:

Thanks, that did the trick; a proper naming is apparently

pca8575:gpio@20 {
        compatible = "nxp,pca8575";
        device_type = "gpio";

There shouldn't be device_type here, though.

Quoted 2 lines
        reg = <0x20 1>;
};
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson