U-boot and ethernet MAC address from eeprom

Hello,
For PYNQ 2.4 (Petalinux 2018.3) and custom Zynq borad , reading MAC address from EEPROM works perfect using:
in project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h
#define CONFIG_ZYNQ_EEPROM
#ifdef CONFIG_ZYNQ_EEPROM
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
#define CONFIG_CMD_EEPROM
#define CONFIG_ZYNQ_EEPROM_BUS 0
#define CONFIG_ZYNQ_GEM_EEPROM_ADDR 0x50
#define CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET 0xFA
#endif
but PYNQ 2.5 uses Petalinux 2019.1 and u-boot i2c driver in this version was changed to cadence. I’ve found eeprom mac address support for ZCU104 ZynqMP in PYNQ sources. Using this settings with proper addresses for Zynq is not working. What I should I change for Zynq support and mac address stored in eeprom? I have no I2C mux or switch - 24AA025E48T-I/OT is directly connected to PS.
Stefan

1 Like

I’v got the solution. For PetaLinux 2019.1

/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h

added:

#define CONFIG_I2C_EEPROM
#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
#define CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW 0x0
#define CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET 0xFA

/project-spec/meta-user/recipes-bsp/device-tree/file/system-user.dtsi

/include/ “system-conf.dtsi”
/ {
chosen {
bootargs = “earlycon”;
stdout-path = “serial0:115200n8”;
xlnx,eeprom = &eeprom;
};
};

&i2c1 {
eeprom: eeprom@50 { /* u88 */
compatible = “atmel,24c08”;
reg = <0x50>;
};
};

Now MAC is taken from EEPROM. This solution may be easily merge in custom board files for PYNQ.

Stefan

3 Likes

Thanks for reporting this.

I suggest you do a PR with this change, it will be good to have a contribution from the community and also if a PR comes from an external resource, it will trigger a review process and discussion within the team.

2 Likes