I can access (read/write) EEPROM using i2ctransfer, but can't instantiate as an eeprom file

Hi,
I have 2 Atmel EEPROMs - 24c128 - at addresses 0x0A and 0x0B.

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

I can read/write using i2c commands:

$ sudo i2ctransfer -y -f 1 w4@0x0a 0 0 123 22 
$ sudo i2ctransfer -y -f 1 w2@0x0a 0 0 r10
0x7b 0x16 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff

I can’t figure out how to see the eeprom as a file in order to be able to open, seek, write, read using file commands:

/sys/bus/i2c/devices/i2c-1/1-000a$ ll
total 0
drwxr-xr-x  3 root root    0 Mar 14 13:51 ./
drwxr-xr-x 15 root root    0 Mar 14 13:51 ../
-r--r--r--  1 root root 4096 Mar 14 14:56 modalias
-r--r--r--  1 root root 4096 Mar 14 14:56 name
lrwxrwxrwx  1 root root    0 Mar 14 14:56 of_node -> '../../../../firmware/devicetree/base/i2c@c240000/ub960@3C/link@2/ub953@42/sc9732cam_EEP@A'/
drwxr-xr-x  2 root root    0 Mar 14 14:56 power/
lrwxrwxrwx  1 root root    0 Mar 14 13:51 subsystem -> ../../../../bus/i2c/
-rw-r--r--  1 root root 4096 Mar 14 13:51 uevent
/sys/bus/i2c/devices/i2c-1$ sudo echo 24c128 0xa > new_device 
-bash: new_device: Permission denied
root@mechi:/sys/devices/c240000.i2c/i2c-1# sudo echo 24c128 0xa > new_device
echo: write error: Invalid argument

In the dtsi file:

 EEP_NODE: EEP_NODE_NAME {
  status = "okay";
  compatible = "24c128","at24";
  address-width = <16>;
  #address-cells = <1>;
  #size-cells = <0>;
  reg = <0x0A>;
  physical-addr = <0x52>;
  pagesize = <64>;
  size = <16384>;
  has-eeprom = "1";  /* Enable EEPROM support */
  node_name_alias = "EEP";

};

Any ideas would be appreciated.
Thanks,
Mechi

hello mechi.fendel,

I don’t understand your question clearly, may I know what’s the real use-case here?

Hi Jerry,
At the moment we’re using the Jetson Xavier RTOS with a proprietary board based on the D3’s interface card that supports 16 FDPLink-III cameras.
For each DES (UB960) there are 4 cameras - each with its own SER (UB953).
In addition, on each proprietary camera board there is an EEPROM AT24c128.

We’ve assigned alias addresses to each of the cameras and to each of the EEPROMs.
I’m currently working with 2 cameras - they appear as video0 and video1.
They are all on I2C bus 1.

As mentioned in the previous post, I can access the eeprom using i2ctransfer - I can read and write to it.
What I haven’t been successful in doing is to add a new_device. With the D3 board, I was able to build the new_device and saw an eeprom file.
The best solution, of course, would be that the eeprom file is build from the dtsi when the board loads.

I changed the hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-eeprom-manager-p2888-0000.dtsi file**:**

> #define CONFIG_EEPROM_SIZE (16384)
> 
> / {
>   eeprom-manager {
>      data-size = <CONFIG_EEPROM_SIZE>;
>      bus@0 {
>                     i2c-bus = <&gen2_i2c>;
>                     eeprom@0 {
>                                         **reg = <0xa>;**
>                                         physical-addr = <0x52>;
>                                         label = "eeprom";
>                                         status = "okay";
>                                         has-eeprom = "1"; /* Enable EEPROM support */
>                     };
>                     eeprom@1 {
>                                         **reg = <0xb>;**
>                                         physical-addr = <0x52>;
>                                         label = "eeprom";
>                                         status = "okay";
>                                         has-eeprom = "1"; /* Enable EEPROM support */
>                     };
>      };
>   };
> };

I know that this is probably not a good idea.

I may have found a solution - I enabled the row in the kernel/d3/d3_defconfig file:

CONFIG_EEPROM_AT24 = y

I will try this and let you know.

Any ideas why the “manual” adding of a new_device was blocked would be appreciated.
Thanks,
Mechi

CONFIDENTIALITY: The content of this email message and any files transmitted with it is confidential and/or privileged and is intended for the recipient(s) specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.

The problem was that I relied on the d3_defconfig file.
I used the sudo make linux-menuconfig and chose in Device Drivers/Misc./EEPROM the i2c option.
Now it worked,

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.