Hello,
For Petalinux 2018.3 and Zynq board TE0715-04-15-2I with TE0701-06 , 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
This is solution from Trenz Reference_Design. On Petalinux 2019.1 petalinux-build failed. I am guessing that CONFIG_CMD_EEPROM is the reason. Using petalinux-config -c u-boot I've disabled DM_I2C becouse it is in conflict with CMD_EEPROM but this is not enought for passing petalinux-build successfuly.
How to read MAC address from eeprom on early booting stage for petalinux 2019.1 ?
Hi,
for 19.1 and newer check uboot config. -->petalinux-config -c u-boot
We will skip 19.1. Next update will be 19.2 with Vitis, there I will check if it works with uboot config.
br
John
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 should works in 19.2. Please let me know if this will help you.
Stefan
Hi,
thanks!
It works also with 19.2 --> tested on TE0820 module.
PS: instead add define in platform-top.h you can also use Uboot config: --> petalinux-config -c u-boot
But at the end it's the same :-)
br
John
Hi John,
Can you tell me what options in "petalinux-config -c u-boot" I need to activate for TE0820 to get U-Boot to read the MAC address from the EEPROM? It generates a random one by default. I use PetaLinux 2025.1.
Thanks,
Etienne
CONFIG_DM_RTC=y
CONFIG_NVMEM=y
need to be activated for uboot to pick up the mac (DM_RTC needed because of driver bug in 2023.2 as far as I know)
Hi,
Thanks M Kirberg, but I already have those enabled in project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg
#for reading mac address from eeprom via devicetree entry
CONFIG_NVMEM=y
#needed for nvmem driver because of bug in uboot
CONFIG_DM_RTC=y
However, it does not work. Every time I reboot the TE0820, U-Boot has a new random MAC address. The comment above says "via devicetree entry": is there some manual change I must make in the device tree to get this working?
Hi,
can be that petalinux sets local-mac-address that overrides the devicetree.
/delete-property/ local-mac-address;
in the gem helped in that cases
Hi,
Adding the following to project-spec\meta-user\recipes-bsp\device-tree\files\system-user.dtsi fixed it:
&gem3 {
phy-handle = <&phy0>;
nvmem-cells = <ð0_addr>;
nvmem-cell-names = "mac-address";
//required otherwise petalinux gives a static address here
/delete-property/ local-mac-address;
phy0: phy0@1 {
device_type = "ethernet-phy";
reg = <1>;
};
};
&i2c0 {
eeprom: eeprom@50 {
compatible = "microchip,24aa025", "atmel,24c02";
reg = <0x50>;
#address-cells = <1>;
#size-cells = <1>;
eth0_addr: eth-mac-addr@FA {
reg = <0xFA 0x06>;
};
};
};
Thanks.