Device tree configuration for I2C eeprom

Felix Radensky felix at embedded-sol.com
Wed Nov 5 07:04:20 EST 2008


Ayman El-Khashab wrote:
> Felix Radensky <mailto:felix at embedded-sol.com> said on Tuesday, November
> 04, 2008 10:46 AM:
>
>   
>> If you're using Denx kernel, you should add your  at24 device
>> to i2c_devices[] in drivers/i2c/busses/i2c-ibm_of.c This will
>> pass your device tree data to at24 driver.
>>     
>
> I am using the Denx kernel and I see the at24 printing out in dmesg.
> Here is 
> my latest device tree.  Further, I changed the aforementioned file by
> adding
> the following lines as shown.  The at24 driver is in i2c/chips/at24.c
>
> But I still do not see anything obvious show up that I can open to read
> and
> write the eeprom ... what am I missing.  I would have thought there must
> be
> a working example somewhere?
>
>
>
> static struct i2c_driver_device i2c_devices[] __initdata = {
>         {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",},
>         {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",},
>         {"ricoh,rv5c386",  "rtc-rs5c372", "rv5c386",},
>         {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",},
>         {"dallas,ds1307",  "rtc-ds1307",  "ds1307",},
>         {"dallas,ds1337",  "rtc-ds1307",  "ds1337",},
>         {"dallas,ds1338",  "rtc-ds1307",  "ds1338",},
>         {"dallas,ds1339",  "rtc-ds1307",  "ds1339",},
>         {"dallas,ds1340",  "rtc-ds1307",  "ds1340",},
>         {"stm,m41t00",     "rtc-ds1307",  "m41t00"},
>         {"dallas,ds1374",  "rtc-ds1374",  "rtc-ds1374",},
>         {"stm,m41t80",     "rtc-m41t80",  "m41t80",},
>         {"atmel,at24c128", "at24",        "at24c128",},
>         {"spd,at24c02",    "at24",        "at24c02",},
> };
>
>
>
>                        IIC0: i2c at ef600700 {
>                                 compatible = "ibm,iic-460ex", "ibm,iic";
>                                 reg = <0xef600700 0x00000014>;
>                                 interrupt-parent = <&UIC0>;
>                                 interrupts = <0x2 0x4>;
>                                 #address-cells = <1>;
>                                 #size-cells = <0>;
>
>                                 at24 at 50 {
>                                         compatible = "atmel,at24c128";
>                                         reg = <0x50>;
>                                 };
>                                 spd at 51 {
>                                         compatible = "spd,at24c02";
>                                         reg = <0x51>;
>                                 };
>                                 at24 at 52 {
>                                         compatible = "atmel,at24c128";
>                                         reg = <0x52>;
>                                 };
>                                 at24 at 53 {
>                                         compatible = "atmel,at24c128";
>                                         reg = <0x53>;
>                                 };
>   
The first entry in the table matches "compatible" property in device tree,
the second one - i2c driver name, and the third one - i2c device name in
the driver id table (see at24_ids[] in at24.c). So in your case it should
look like this:

{"atmel,at24c128",  "at24",   "24c128"}
{"spd,at24c02",       "at24",   "spd"}

Felix.


More information about the Linuxppc-embedded mailing list