Skip to contentSkip to conversation

board: microchip: mpfs_generic: Allow serial number read failures

PATCH In review Bin Meng 2 participants 2 messages Oct 5 – Nov 2

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 board: microchip: mpfs_generic: Allow serial number read failures

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.

---

 board/microchip/mpfs_generic/mpfs_generic.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
board/microchip/mpfs_generic/mpfs_generic.c +9 -2
index f57f5f4046b..c100a522888 100644
@@ -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

Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Bin Meng

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.

Quoted 5 lines

---

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