Device tree configuration for I2C eeprom

Sebastian Siewior linuxppc-embedded at ml.breakpoint.cc
Fri Sep 19 08:13:35 EST 2008


* Ayman El-Khashab | 2008-09-18 14:44:44 [-0500]:

>Here is a snippet from the dts file, and I assume I need something like
>what I've added:
> 
>                        IIC0: i2c at ef600700 {
>                                compatible = "ibm,iic-460ex", "ibm,iic";
>                                reg = <ef600700 14>;
>                                interrupt-parent = <&UIC0>;
>                                interrupts = <2 4>;
>                                #address-cells = <1>;
>                                #size-cells = <0>;
>                                rtc at 68 {
>                                        compatible = "stm,m41t80";
>                                        reg = <68>;
>                                };
>                                eeprom at 50 {
>                                        compatible = "?????";
> 						    something
>                                        something;
>                                };

This should look like:
|                        IIC0: i2c at ef600700 {
|                                compatible = "ibm,iic-460ex", "ibm,iic";
|                                reg = <ef600700 14>;
|                                interrupt-parent = <&UIC0>;
|                                interrupts = <2 4>;
|                                #address-cells = <1>;
|                                #size-cells = <0>;
|                                rtc at 68 {
|                                        compatible = "m41t80";
|                                        reg = <68>;
|                                };
|                                eeprom at 50 {
|                                        compatible = "eeprom";
|                                        reg = <50>;
|                                };

Compatible is the ID of the driver. You can find it in the driver
itself: if you look in ./drivers/rtc/rtc-m41t80.c you will find a struct
m41t80_id which contains the ids. The same applies to the eeprom driver.
You might want to update your dts from current kernel tree which
contains the "/dts-v1/" tag at the beginning and then your field must
contain an 0x prefix.

>Once I do all that, how does one use the eeprom driver to read and write
>this part?
The eeprom driver should create an eeprom file somewhere in /sys I am
not sure where exactly. The help entry in Kconfig says that is module
provides only RO access to the eeprom.

Sebastian


More information about the Linuxppc-embedded mailing list