
Hi Michal,
On 23 Nov 2022, Michal Simek wrote:
On 11/23/22 04:14, Sean Anderson wrote:
On 11/22/22 20:23, David Antliff wrote: Hi,
I'm looking to extract the board's MAC address from serial I2C EEPROM at boot time, so I'm trying to work out how I can tell if U-Boot is actually able to communicate with this EEPROM, outside of manual i2c commands.
I have set CONFIG_ZYNQ_MAC_IN_EEPROM and CONFIG_ZYNQ_MAC_IN_EEPROM however I'm not completely sure that this is working with UltraScale+ Zynq MPSoC boards - I'm using a ZCU208. There's no log message on the U-Boot console to say that there was an attempt to read the MAC address, and with ethaddr unset, this variable is set by U-Boot to the value taken from the device tree rather than EEPROM:
That was the old way how to this was achieve and based on DTS in the mainline it is not used on any existing board because none defined xlnx,eeprom property.
I just sent the patch to remove also Kconfig entries which we forget to clean up.
But the way how it is working now is that eeprom is referenced by nvmem alias. You can find conversion here 531abcb71e60 ("xilinx: Convert xlnx,eeprom property to nvmem alias")
Then you have nvmem link to eeprom which can be used.
In board_init() you can see calling xilinx_read_eeprom() which reads this link.
This structure was added for FRU format decoding also with supporting legacy format used on zcu1xx boards.
IIRC zcu208 is not using legacy format used on zcu1xx boards xilinx_read_eeprom_legacy() and there is one more legacy format which is not currently supported by this code. But it shouldn't be that complicated to add support for it because it is pretty much just different layout.
That's why I am suggesting you to create that nvmem0 link and take a look at that format to support.
Then mac address is saved to environment variables and used by ethernet driver.
Thank you for your advice - if I were using a newer version of U-Boot I would certainly look into this. Please see my reply to Sean for what I ended up doing, which is obviously prior to any nvmem-cells support, and uses the old Kconfig options and xlnx,eeprom.
I'm using PetaLinux 2021.2, but I note that in the 2022.1 changelog there is this:
U-Boot: Added support for reading MAC address from multi-record FRU data in EEPROM
Unfortunately until I have a chance to update my version of PetaLinux, I am unable to test or contribute to the head of U-Boot. Thank you for your help though. This all adds context to what I'm doing, and makes me think I really should figure out how to update to a newer version of U-Boot sooner rather than later.
-- David.