0
votes

I have some linux kernel & SFP/I2C driver issue.

I am using a buildroot linux kernel for an embedded board.

I need to be able to read the eeprom file of the SFP i2c device.

1. working case:

When SFP module is inserted in my development unit board from the start (before the kernel loads up) then when startup completed i can see and read the eeprom file in the path: /sys/class/i2c-adapter/i2c-1/1-0050/eeprom

eeprom file exists

  • kernel prints on startup the i2c device scan result:

enter image description here

2. not working case:

If there is no SFP module inserted on startup,and kernel completes the boot procces, then when i'm inserting the SFP module in,i observe that the path:

/sys/class/i2c-adapter/i2c-1/1-0050/ DOESN'T include the eeprom file.

eeprom file missing

  • The device tree part of the sfp-eeprom code:

enter image description here

My guess is the SFP driver is responsible for that trigger that should happen once the SFP module is inserted, and should trigger the creation of eeprom file.

Would like to ask you what am i missing ? some binding code from sfp driver to trigger the i2c scan or something?

Any suggestion?

Thanks in advance.

1
Can you check your logs for non working case and grep it for informations from driver "at24"? - Krzysztof Adamski
The only thing that is printed is the 1-0052 device that was scanned and added by the i2c. As my scrennshot of "kernel prints on startup the i2c device scan result:" shows just without the needed 1-0050 line... - rozmanro
I think the probe function (at24_probe in "drivers/misc/eeprom/at24.c" is being called because the device is listed in the device tree. But at24_probe tests whether the EEPROM is actually present on the I2C bus and returns a -ENODEV error if it is not detected. If some operating system trigger (e.g. in UDEV) occurs when you insert the SFP module, you could use that to load a device tree overlay containing the EEPROM device. - Ian Abbott
I2C is not a hotpluggable bus. Though you may try Device Tree overlay technique or reprobe manually via bind file in sysfs. - 0andriy

1 Answers

0
votes

A possible workaround for this issue was found.

to use the ethtool -m interface.

from ethtool man page:

-m --dump-module-eeprom Retrieves and if possible decodes the EEPROM from plugin modules, e.g SFP+, QSFP