linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: Q: define i2c nodes in device tree?
@ 2009-03-27 13:05 Albrecht Dreß
  2009-03-27 22:07 ` Timur Tabi
  2009-03-27 23:06 ` David Gibson
  0 siblings, 2 replies; 5+ messages in thread
From: Albrecht Dreß @ 2009-03-27 13:05 UTC (permalink / raw)
  To: linuxppc-dev

Hi Timur:

> 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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Q: define i2c nodes in device tree?
  2009-03-27 13:05 Q: define i2c nodes in device tree? Albrecht Dreß
@ 2009-03-27 22:07 ` Timur Tabi
  2009-03-27 23:06 ` David Gibson
  1 sibling, 0 replies; 5+ messages in thread
From: Timur Tabi @ 2009-03-27 22:07 UTC (permalink / raw)
  To: Albrecht Dreß; +Cc: linuxppc-dev

On Fri, Mar 27, 2009 at 8:05 AM, Albrecht Dre=DF <albrecht.dress@arcor.de> =
wrote:

> 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.

> # 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 .
> drwxr-xr-x =A0 =A03 0 =A0 =A0 =A0 =A00 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 Jan =
=A01 00:00 ..
> drwxr-xr-x =A0 =A02 0 =A0 =A0 =A0 =A00 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 Jan =
=A01 00:00 1-0020
> drwxr-xr-x =A0 =A02 0 =A0 =A0 =A0 =A00 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 Jan =
=A01 00:00 1-0021
> drwxr-xr-x =A0 =A02 0 =A0 =A0 =A0 =A00 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 Jan =
=A01 00:00 1-0022
> [...]
>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Q: define i2c nodes in device tree?
  2009-03-27 13:05 Q: define i2c nodes in device tree? Albrecht Dreß
  2009-03-27 22:07 ` Timur Tabi
@ 2009-03-27 23:06 ` David Gibson
  1 sibling, 0 replies; 5+ messages in thread
From: David Gibson @ 2009-03-27 23:06 UTC (permalink / raw)
  To: Albrecht Dre�; +Cc: linuxppc-dev

On Fri, Mar 27, 2009 at 02:05:04PM +0100, Albrecht Dre� wrote:
> Hi Timur:
> 
> > 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.

>         reg = <0x20 1>;
> };

-- 
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Q: define i2c nodes in device tree?
  2009-03-26 18:44 Albrecht Dreß
@ 2009-03-26 20:02 ` Timur Tabi
  0 siblings, 0 replies; 5+ messages in thread
From: Timur Tabi @ 2009-03-26 20:02 UTC (permalink / raw)
  To: Albrecht Dreß; +Cc: Linux PPC Development

2009/3/26 Albrecht Dre=DF <albrecht.dress@arcor.de>:

> and some other like "gpio-controller" instead of "gpio" but (surprise) it
> doesn't work - dmesg says that the driver is registered, but nothing else
> shows up. =A0Unfortunately, I couldn't find documentation about the namin=
g
> conventions of the i2c child nodes.

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

cs4270:codec@4f {
	compatible =3D "cirrus,cs4270";
	reg =3D <0x4f>;
	/* MCLK source is a stand-alone oscillator */
	clock-frequency =3D <12288000>;
};

...

static struct i2c_device_id cs4270_id[] =3D {
	{"cs4270", 0},
	{}
};
MODULE_DEVICE_TABLE(i2c, cs4270_id);

> As I actually want to use the chips as parallel io (not separate gpio's) =
and
> thus would need to write my own driver I wonder if I really have to decla=
re
> it in the device tree? =A0Would the simple way -just load the kernel modu=
le as
> with arm/intel- also work? =A0Would it be possible to use additional reso=
urces
> like an interrupt pin on the '5200 without the device tree?

No, the only acceptable way to do this is on PowerPC is with a device
tree entry and a driver that registers itself properly.

--=20
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Q: define i2c nodes in device tree?
@ 2009-03-26 18:44 Albrecht Dreß
  2009-03-26 20:02 ` Timur Tabi
  0 siblings, 1 reply; 5+ messages in thread
From: Albrecht Dreß @ 2009-03-26 18:44 UTC (permalink / raw)
  To: Linux PPC Development

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

Hi all,

I have some probably dumb questions regarding the definition of i2c  
slaves in the of device tree file...

My test system is a lite5200b board to which I attached two pca8575 io  
expander chips at i2c addresses 0x20 and 0x21.  Using the stock kernel  
2.6.29, I added the driver from the GPIO section, but I couldn't figure  
out how to add them to the dts file.  I tried e.g.

<snip>
i2c@3d40 {
	[...]
         compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
         [...]

         gpio@20 {
                 compatible = "pcf857x";
                 device_type = "gpio";
                 reg = <0x20 1>;
	};
};
</snip>

and some other like "gpio-controller" instead of "gpio" but (surprise)  
it doesn't work - dmesg says that the driver is registered, but nothing  
else shows up.  Unfortunately, I couldn't find documentation about the  
naming conventions of the i2c child nodes.

As I actually want to use the chips as parallel io (not separate  
gpio's) and thus would need to write my own driver I wonder if I really  
have to declare it in the device tree?  Would the simple way -just load  
the kernel module as with arm/intel- also work?  Would it be possible  
to use additional resources like an interrupt pin on the '5200 without  
the device tree?

Any information about a proper approach would be really helpful!

Thanks in advance, Albrecht.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-27 23:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-27 13:05 Q: define i2c nodes in device tree? Albrecht Dreß
2009-03-27 22:07 ` Timur Tabi
2009-03-27 23:06 ` David Gibson
  -- strict thread matches above, loose matches on Subject: below --
2009-03-26 18:44 Albrecht Dreß
2009-03-26 20:02 ` Timur Tabi

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).