]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
board: dhelectronics: imx: Use second Ethernet MAC also from fuse
authorChristoph Niedermaier <cniedermaier@dh-electronics.com>
Wed, 15 Apr 2026 10:12:57 +0000 (12:12 +0200)
committerFabio Estevam <festevam@gmail.com>
Tue, 21 Apr 2026 23:49:39 +0000 (20:49 -0300)
Currently, the board specific code evaluates only the first Ethernet
MAC address fuse, regardless of whether the first or second MAC
address is requested. When the function to determine the second
Ethernet MAC address is looking for the fused MAC address, it only
reads the first MAC address fuse and increment it by one to set
the second Ethernet MAC address. That is not the expected behavior
when two MAC addresses are fused, because this causes the second
fused MAC address to be ignored. Change this so that the second
fused MAC address will be used.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Reviewed-by: Marek Vasut <marex@nabladev.com>
board/dhelectronics/common/dh_imx.c
board/dhelectronics/common/dh_imx.h
board/dhelectronics/dh_imx6/dh_imx6.c
board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c

index 3d6487dd0d8c7d8757490c274c063268083bcb1f..50404a66f9d5bad98943f012f79b22d2f0c3ab34 100644 (file)
 #include <net.h>
 #include "dh_imx.h"
 
-int dh_imx_get_mac_from_fuse(unsigned char *enetaddr)
+int dh_imx_get_mac_from_fuse(unsigned char *enetaddr, int index)
 {
        /*
         * If IIM fuses contain valid MAC address, use it.
         * The IIM MAC address fuses are NOT programmed by default.
         */
-       imx_get_mac_from_fuse(0, enetaddr);
+       imx_get_mac_from_fuse(index, enetaddr);
        if (!is_valid_ethaddr(enetaddr))
                return -EINVAL;
 
index 284f8637fb8e5bffa6bae3c0bae6b55cb607aa1c..be2ff5e076c260318c81a83b47b99ab460800d4d 100644 (file)
@@ -7,6 +7,7 @@
  * dh_imx_get_mac_from_fuse - Get MAC address from fuse and write it to env
  *
  * @enetaddr: buffer where address is to be stored
+ * @index: index of MAC address in fuse (starts with 0)
  * Return: 0 if OK, other value on error
  */
-int dh_imx_get_mac_from_fuse(unsigned char *enetaddr);
+int dh_imx_get_mac_from_fuse(unsigned char *enetaddr, int index);
index 234824b38c2a54055f6e15f2e894fa788adbb6ce..c9e8107685a3c2eba29fa014e7be4c28a30a9249 100644 (file)
@@ -94,7 +94,7 @@ int dh_setup_mac_address(struct eeprom_id_page *eip)
        if (dh_get_mac_is_enabled("ethernet0"))
                return 0;
 
-       if (!dh_imx_get_mac_from_fuse(enetaddr))
+       if (!dh_imx_get_mac_from_fuse(enetaddr, 0))
                goto out;
 
        if (!dh_get_mac_from_eeprom(enetaddr, "eeprom0"))
index 3424be10936c2cc6332f7c188bdb385d9b120336..486073392e9fe2b236e1f968b1bfc5ff11627b5a 100644 (file)
@@ -47,7 +47,7 @@ static int dh_imx8_setup_ethaddr(struct eeprom_id_page *eip)
        if (dh_get_mac_is_enabled("ethernet0"))
                return 0;
 
-       if (!dh_imx_get_mac_from_fuse(enetaddr))
+       if (!dh_imx_get_mac_from_fuse(enetaddr, 0))
                goto out;
 
        if (!dh_get_value_from_eeprom_buffer(DH_MAC0, enetaddr, sizeof(enetaddr), eip))
@@ -72,8 +72,8 @@ static int dh_imx8_setup_eth1addr(struct eeprom_id_page *eip)
        if (dh_get_mac_is_enabled("ethernet1"))
                return 0;
 
-       if (!dh_imx_get_mac_from_fuse(enetaddr))
-               goto increment_out;
+       if (!dh_imx_get_mac_from_fuse(enetaddr, 1))
+               goto out;
 
        if (!dh_get_value_from_eeprom_buffer(DH_MAC1, enetaddr, sizeof(enetaddr), eip))
                goto out;