SoC (Cyclone V) Ethernet MAC Address Assignment


#1

I would like to know what solutions exist for Ethernet MAC address assignment. (dev board is DE1-SoC).

I would like to be able to read an IC (such as 25AA02E48T, or I2C version) at the U-BOOT stage and set the MAC address there. Has anyone been able to achieve this?

Alternatives exist such as setting the MAC address in Linux but I feel U-BOOT is the clean way to do it.

It would be great to hear how others have solved this problem.


#2

If it’s OK for you, then you can invoke u-boot commends:
setenv ethaddr 00:11:22:33:44:55
saveenv


#3

Hi all,
I had the same problem. I would store the MAC address on an I2C EEPROM. (So I have one Image for different Hardware and de Hardware specific information is stored directly on the Hardware)

I adapted the u-boot sources and used the int board_late_init(void) function to set the MAC address.
The sequence which I added in socfpga_common.c is the following:

#defineEEPROM_ADDR 0x51
u8 mac[6];
char mstr[20];
char* str;

if (i2c_probe(EEPROM_ADDR) != 0) {
printf(“Couldn’t find i2c eeprom.\n”);
return;
}

if (i2c_read(EEPROM_ADDR, 50, 2, mac, 6))
printf(“i2c_read failed\n”);

sprintf(mstr, “%0X:%0X:%0X:%0X:%0X:%0X”,mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
setenv(“ethaddr”, mstr);
str = getenv(“ethaddr”);
if(str) {
printf(“ETH0 MAC: %s\n”, str);
}
else {
printf(“ETH0 MAC: not set! - ERROR\n”);
}

Cheers


#4

Uboot can use the CPU serial number that most arm SOC vendors support. It would be nice if something similar were available to the Cyclone V. I’m new to the FPGA side, but in my limited research, I think there is an IP block that can be added to the project to read the FPGA ID. Not sure on it though.


#5

Look here:
Chip ID Intel FPGA IP Cores User Guide