EEPROM 24cs01 devicetree declaration

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EEPROM 24cs01 devicetree declaration

837 Views
_Anthony
Contributor II

Hello,

I'm actually working with SoC i.MX6 and I would like to declare the EEPROM AT24CS01 in the devicetree. 

So, I found devicetree bindings for the driver at24.c by following this link https://elixir.bootlin.com/linux/v4.19.89/source/Documentation/devicetree/bindings/eeprom/at24.txt

Problem is: Among these components:

AT24c00
AT24c01
AT24c02
AT24c04
AT24c08
AT24c16
AT24c32
AT24c64
AT24c128
AT24c256
AT24c512
AT24c1024

We can distinguish two family of EEPROM. 

first family contains [ AT24c00 AT24c01 AT24c02 AT24c04 AT24c08 AT24c16]

and second family contains: [AT24c32 AT24c64 AT24c128 AT24c256 AT24c512 AT24c1024]

The first family of components has the particularity that each of these members needs 8 addresses to be declared on the I2C bus.
Usually these addresses take the range [0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57]
This is because the pins A0, A1, A2 of these components are not present. Unlike components of the second family
which have these pins and thus make it possible to select a single specific i2C address on the range [0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57].
For exemple, 

This is how the AT24c01 (which belongs to family 1) is seen on the i2C bus:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

whereas the AT24c32 (which belongs to family 2) is seen on the i2C bus like this:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --


So when I activate the driver by specifing this in devicetree:

I2c-1{
    eepromFamily1: eepromFamily1@50 {
        compatible = "atmel,24c01";
        reg = <0x50>;
    }; 
};
I2c-2{
    eepromFamily2: eepromFamily2@50 {
        compatible = "atmel,at24c32";
        reg = <0x50>;
    }; 
};

I have this behaviour:

For AT24c01 (which belongs to family 1) is seen on the i2C bus:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

For AT24c32 (which belongs to family 2) is seen on the i2C bus like this:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --


So in all cases, the driver load perfectly fine and create sysfs entry and access for the two family of eeprom.
But, I would like to know how to specify correctly "atmel,24c01" in devicetree to see the following thing in my I2c-1 bus.

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU UU UU UU UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --


instead of

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Is it problematic other adresses do not appears UU? The devicetree binding don't tell how to do for this type of EEPROM.

Thanks for all and best reguards, Anthony.

0 Kudos
1 Reply

833 Views
igorpadykov
NXP Employee
NXP Employee

Hi _Anthony

 

as this is general linux issue may be recommended to post it on kernel mail list

http://vger.kernel.org/vger-lists.html#devicetree

 

Best regards
igor

0 Kudos