Device tree configuration for I2C eeprom

Felix Radensky felix at embedded-sol.com
Wed Nov 5 03:45:58 EST 2008


Ayman El-Khashab wrote:
>
> Ok, here is what I used.  I see the nodes created in /sys/bus/i2c/... 
> but I see four of them at address 0x50,0x51,0x52,0x53.  That surprised
> me since I only have 3 of them in the device tree.  However, in any case
> I did not see a way to read or write them.  In one case I was able to
> cat the file "eeprom", but it was only 256 bytes and did not exist for
> the other 3 devices.  Here is the section of my device tree ... I do 
> see the controller being initialized in dmesg, it is just the read and
> write that is eluding me.
>
> One question I did have was within another sample device tree, there was
> a comment that "this makes address 0x50 and 0x51"?  Does that mean that
> large eeproms are spread over several nodes?  I searched around but
> could
> not find an example of how to use this at24 to access my E2 from
> userspace.
>
> Thanks
> Ayman
>
>
>                         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 = "at24,at24c128";
>                                         reg = <0x50>;
>                                 };
>                                 at24 at 52 {
>                                         compatible = "at24,at24c128";
>                                         reg = <0x52>;
>                                 };
>                                 at24 at 53 {
>                                         compatible = "at24,at24c128";
>                                         reg = <0x53>;
>                                 };
> 				}
>
>
>   
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.

Felix.


More information about the Linuxppc-embedded mailing list