imx8mp ddr4 get mac value in uboot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8mp ddr4 get mac value in uboot

472 Views
xjy198903
Contributor III

How do I automatically set the MAC value of the NIC in the uboot environment variables of the imx8mp ddr4 board, like the imx8mp-lpddr4-evk development board does, and do I need to add certain macro definitions in the imx8mp-ddr4-evk-defconfig file

0 Kudos
3 Replies

443 Views
brian14
NXP TechSupport
NXP TechSupport

Hi @xjy198903

To properly set the MAC address variable, you will need to enter the Uboot Environment Variables by pressing any key on the first part of booting process. Then, you will need to change the Uboot variable "ethaddr" as follows:

1. Print the actual MAC address

Uboot > printenv ethaddr

Output example

00:04:9f:07:07:65

2. Set your new MAC address

Uboot > setenv ethaddr <new-MAC-address>

3. Save the environment

Uboot > saveenv

After this process Uboot always will use the MAC address previously configured.

If you will need another approach to read the MAC address from other devices such QSPI, you can refer to this useful post.

Tux Engineering, Inc. - U-Boot handling MAC address

Have a great day!

0 Kudos

430 Views
xjy198903
Contributor III

Hi,bibarra

I don't want to manually set the MAC address. I want to directly use the values from the fuse, just like the u-boot on the imx8mp-lpddr4-evk development board does. It automatically sets the MAC address environment variable, which I assume comes from the fuse. Now the question is, how can I make my imx8mp-ddr4 board automatically read the values from the fuse and set the environment variable?

0 Kudos

422 Views
Mestkim
Contributor III

If you read the uboot source, you can easily find the mac from fuse is set automatically.

It doesn't matter it is imx8mp-lpddr4-evk or imx8mp-ddr4 board, actually the code is for fec accrossing all i.MX using fec including such as i.MX6, i.MX8M family, etc.

 

 

 

uboot-imx/drivers/net/fec_mxc.c


if (fec_get_hwaddr(fec->dev_id, ethaddr) == 0) {
debug("got MAC%d address from fuse: %pM\n", fec->dev_id, ethaddr);
memcpy(edev->enetaddr, ethaddr, 6);
if (fec->dev_id)
sprintf(mac, "eth%daddr", fec->dev_id);
else
strcpy(mac, "ethaddr");
if (!env_get(mac))
eth_env_set_enetaddr(mac, ethaddr);
}
return ret;

static int fec_get_hwaddr(int dev_id, unsigned char *mac)
{
imx_get_mac_from_fuse(dev_id, mac);
return !is_valid_ethaddr(mac);
}

0 Kudos