Setting MAC address from I2C EEPROM - debug / commands? (Xilinx)

David Antliff d.antliff at unsw.edu.au
Wed Nov 23 22:56:57 CET 2022


Hi Sean, thank you for your reply.

On 23 Nov 2022, Sean Anderson wrote:
> On 11/22/22 20:23, David Antliff wrote:
> > My question is - is the 'i2c' command now the accepted and best way to interact with an
> > I2C EEPROM? Or is there another command I can enable (other than "eeprom") that will
> > provide a generic interface for accessing EEPROMs and prove that U-Boot can "see" this
> > device?
> 
> I don't think such an API exists.

Ok, that's not a problem, I can use the i2c commands to retrieve/write what I need. It's mostly
for debugging at this point.

> This doesn't directly address your question, but have you tried using nvmem-cells?
[snip]
> You'll need 2022.07 for this I think. This is the same method which
> Linux uses. I added this specificly to be able to load MAC addresses
> from EEPROMs without needing to hard code stuff into Kconfig.

Thanks for the suggestion however at the moment I am stuck with an older version of
U-Boot that does not support nvmem-cells. It looks like a good approach though!

For the record, and in case it helps anyone else in a similar situation with an older U-Boot,
 was able to get U-Boot 2021.01 (part of PetaLinux 2021.2) to read the MAC address
from EEPROM with the following settings:

CONFIG_SYS_I2C_EEPROM_ADDR=0x54
CONFIG_SYS_I2C_EEPROM_BUS=6
CONFIG_SYS_EEPROM_SIZE=16384
CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET=0x23

# This is a PetaLinux config thing - has to be "invalid":
CONFIG_SUBSYSTEM_ETHERNET_PSU_ETHERNET_3_MAC="ff:ff:ff:ff:ff:ff"

# PetaLinux / yocto: meta-user/recipes-bsp/device-tree/files/system-user.dtsi
/include/ "system-conf.dtsi"
/ {
  chosen {
    xlnx,eeprom = &eeprom;
  };
};

This corresponds to an existing alias in the default PetaLinux device tree:

    eeprom = "/axi/i2c at ff030000/i2c-mux at 74/i2c at 0/eeprom at 54";

Which is already present as:

                        i2c-mux at 74 {
                                compatible = "nxp,pca9548";
                                #address-cells = <0x00000001>;
                                #size-cells = <0x00000000>;
                                reg = <0x00000074>;
                                i2c-mux-idle-disconnect;
                                i2c at 0 {
                                        #address-cells = <0x00000001>;
                                        #size-cells = <0x00000000>;
                                        reg = <0x00000000>;
                                        phandle = <0x0000006b>;
                                        eeprom at 54 {
                                                compatible = "atmel,24c128";
                                                reg = <0x00000054>;
                                                phandle = <0x0000006c>;
                                        };
                                };


I'll definitely look to use nvmem-cells when I am able to update to a newer
version of U-Boot though. Thank you for your help.

-- David.


More information about the U-Boot mailing list