cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
andrea@ross
Adventurer
Adventurer
1,264 Views
Registered: ‎11-26-2018

petalinux u-boot ethernet MAC address from eeprom

Hi,

I'm working with petalinux and 10G/25G ethernet sybsystem on a custom board. I would like to load the mac address during u-boot, i followed this post (https://forums.xilinx.com/t5/Embedded-Linux/u-boot-and-ethernet-MAC-address-from-eeprom/td-p/1054180) but i can't get it working, i don't get errors but it don't load the mac. I can read correctly the i2c eeprom from petalinux via i2c-tools.

In my system-user file I added this node:

 

&i2c0 {
	eeprom: eeprom@50 {
		status = "okay";
		compatible = "atmel,24c512";
		reg = <0x50>;
	};
};

 

and inside platform-top.h i added these lines:

 

#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

 

 

0 Kudos
10 Replies
auricm
Explorer
Explorer
1,171 Views
Registered: ‎06-13-2012

Hi andrea@ross 

any news?
Same problem here and no clear documentation around, only hints like "this worked for me..."
The solution proposed in your link at boot makes a read EEPROM but only the first byte, so not in the right position and not the right byte size of the MAC.

Regards

0 Kudos
andrea@ross
Adventurer
Adventurer
1,139 Views
Registered: ‎11-26-2018

I have no news, I'm always stuck at the same point as you.

0 Kudos
slocke
Observer
Observer
1,126 Views
Registered: ‎01-26-2018

I'm not sure how to do it in Petalinux, but the newer u-boots require an entry in the "chosen" node of the device tree that points to the eeprom that has a MAC address.  You can see the nuts and bolts in board/xilinx/common/board.c

The requirements are:

1. In the menuconfig for u-boot, make sure that CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET is set (you might be able to do this in your config header as well).  It is found in Device Drivers -> Multifunction device drivers -> enable driver for generic I2C-attached EEPROMS, and then set the "Set the I2C MAC offset" field to something like 0xFA

2. Add a "xlnx,eeprom" node to the chosen group in the device tree.  Something like this:

	chosen {
		bootargs = "earlyprintk";
		stdout-path = "serial0:115200n8";
		xlnx,eeprom = &mac_eeprom;

	};
...
&i2c0 {
	status = "okay";
	mac_eeprom: eeprom@50 {
		compatible = "microchip,24aa02e48";
		i2c-max-frequency = <400000>;
		reg = <0x50>;
	};
};

 This works for me on a Zynq based board using a Microchip EEPROM with EUI-48 address.

auricm
Explorer
Explorer
1,074 Views
Registered: ‎06-13-2012

Hi @slocke 

thank you for your feedback but it's what andrea@ross has already done.
I tried your solution as I use a microchip EEPROM but with that setting I don't see any EEPROM read.
With the previous setup at least I see a read of a single byte at address 0x00.

Another difference is that I'm working with a zynq ultrascale+ and I want to use only the 10GbE on PL but I don't have found any other particular setup to solve this problem

Regards

 

0 Kudos
stephenm
Xilinx Employee
Xilinx Employee
1,048 Views
Registered: ‎09-12-2007

The zcu10x boards use the Eprom for the MAC address. So maybe have a look here.

 

Also, can you try i2c utility in uboot manually to see if you can access the eeprom 

 

Finally, always worth debugging the uboot

https://forums.xilinx.com/t5/Design-and-Debug-Techniques-Blog/PetaLinux-Image-Debug-Series-Debugging-ARM-Trusted-Firmware-and/ba-p/1151076

0 Kudos
auricm
Explorer
Explorer
1,023 Views
Registered: ‎06-13-2012

Hi @stephenm 

thanks for your reply, with i2c utility I can read the eeprom properly, during the boot with a logic analyzer I can see that the eemprom is read but only one byte in the wrong position (not in the 0xFA address position).

Your link point to debug the uboot with Vitis, it means that I need to move to 2019.2 or greater, that introduces me to a lot of problems with software compatibility issues that I want to avoid as possible.

Regards

0 Kudos
stephenm
Xilinx Employee
Xilinx Employee
1,008 Views
Registered: ‎09-12-2007

The blog uses Vitis. However, the same concept will apply to SDK

0 Kudos
stephenm
Xilinx Employee
Xilinx Employee
1,005 Views
Registered: ‎09-12-2007

Can you give a screenshot of what you see in the i2c utility. 

0 Kudos
auricm
Explorer
Explorer
1,001 Views
Registered: ‎06-13-2012

Hi @stephenm ,

maybe I misunderstood your advice, for i2c utilities I meant the i2c driver so after the petalinux boot, I can send i2cget command to read a specific eeprom address.

0 Kudos
stephenm
Xilinx Employee
Xilinx Employee
997 Views
Registered: ‎09-12-2007

Ok, if the i2cget works. then at least you know the HW is working. with respect to debug, you can just enable the debug too, and see what is happening.

0 Kudos