The device serial number is only needed to derive the Ethernet MAC
addresses. Failing to read it should not halt boot.

Warn on failure and skip the MAC updates while still processing device
tree overlays. Track whether the MAC address was derived successfully
so ft_board_setup() also preserves existing addresses on failure.

Signed-off-by: Bin Meng <[email protected]>

---

 board/microchip/mpfs_generic/mpfs_generic.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/board/microchip/mpfs_generic/mpfs_generic.c 
b/board/microchip/mpfs_generic/mpfs_generic.c
index f57f5f4046b..c100a522888 100644
--- a/board/microchip/mpfs_generic/mpfs_generic.c
+++ b/board/microchip/mpfs_generic/mpfs_generic.c
@@ -19,6 +19,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define PERIPH_RESET_VALUE             0x1e8u
 
 static unsigned char mac_addr[6];
+static bool mac_addr_valid;
 
 #if defined(CONFIG_MULTI_DTB_FIT)
 int board_fit_config_name_match(const char *name)
@@ -140,8 +141,8 @@ int board_late_init(void)
 
        ret = mpfs_syscontroller_read_sernum(sys_serv_priv, 
device_serial_number);
        if (ret) {
-               printf("Cannot read device serial number\n");
-               return -EINVAL;
+               printf("Warning: Cannot read device serial number\n");
+               goto out;
        }
 
        /* Update MAC address with device serial number */
@@ -172,6 +173,9 @@ int board_late_init(void)
                }
        }
 
+       mac_addr_valid = true;
+
+out:
        mpfs_syscontroller_process_dtbo(sys_serv_priv);
 
        return 0;
@@ -182,6 +186,9 @@ int ft_board_setup(void *blob, struct bd_info *bd)
        u32 ret;
        int node;
 
+       if (!mac_addr_valid)
+               return 0;
+
        node = fdt_path_offset(blob, "/soc/ethernet@20110000");
        if (node >= 0) {
                ret = fdt_setprop(blob, node, "local-mac-address", mac_addr, 6);
---
base-commit: a6ab6a66146ed0bf1420db0ee858b49005783222
branch: polarfire

-- 
2.53.0

Reply via email to