Q: define i2c nodes in device tree?

2 messages, 2 authors, 2009-03-26 · open the first message on its own page

Q: define i2c nodes in device tree?

From: Albrecht Dreß <hidden>
Date: 2009-03-26 19:09:26

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.

Re: Q: define i2c nodes in device tree?

From: Timur Tabi <hidden>
Date: 2009-03-26 20:02:46

2009/3/26 Albrecht Dre=DF [off-list ref]:
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help