U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: u-boot@lists.denx.de
Cc: conor@kernel.org, Conor Dooley <conor.dooley@microchip.com>,
	Padmarao Begari <padmarao.begari@microchip.com>,
	Cyril Jean <cyril.jean@microchip.com>,
	Tom Rini <trini@konsulko.com>
Subject: [PATCH v1 2/2] board: microchip: icicle: make both ethernets optional
Date: Wed, 15 May 2024 16:04:31 +0100	[thread overview]
Message-ID: <20240515150434.406916-3-conor@kernel.org> (raw)
In-Reply-To: <20240515150434.406916-1-conor@kernel.org>

From: Conor Dooley <conor.dooley@microchip.com>

A given AMP configuration for a board may make either one, or neither
of, the ethernet ports available to U-Boot. The Icicle's init code will
fail if mac1 is not present, so move it to the optional approach taken
for mac0.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
 board/microchip/mpfs_icicle/mpfs_icicle.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/board/microchip/mpfs_icicle/mpfs_icicle.c b/board/microchip/mpfs_icicle/mpfs_icicle.c
index 5fd0ec66a9..4d7d843dfa 100644
--- a/board/microchip/mpfs_icicle/mpfs_icicle.c
+++ b/board/microchip/mpfs_icicle/mpfs_icicle.c
@@ -79,18 +79,6 @@ int board_late_init(void)
 	char icicle_mac_addr[20];
 	void *blob = (void *)gd->fdt_blob;
 
-	node = fdt_path_offset(blob, "/soc/ethernet@20112000");
-	if (node < 0) {
-		printf("No ethernet0 path offset\n");
-		return -ENODEV;
-	}
-
-	ret = fdtdec_get_byte_array(blob, node, "local-mac-address", mac_addr, 6);
-	if (ret) {
-		printf("No local-mac-address property for ethernet@20112000\n");
-		return -EINVAL;
-	}
-
 	read_device_serial_number(device_serial_number, 16);
 
 	/* Update MAC address with device serial number */
@@ -101,10 +89,13 @@ int board_late_init(void)
 	mac_addr[4] = device_serial_number[1];
 	mac_addr[5] = device_serial_number[0];
 
-	ret = fdt_setprop(blob, node, "local-mac-address", mac_addr, 6);
-	if (ret) {
-		printf("Error setting local-mac-address property for ethernet@20112000\n");
-		return -ENODEV;
+	node = fdt_path_offset(blob, "/soc/ethernet@20112000");
+	if (node >= 0) {
+		ret = fdt_setprop(blob, node, "local-mac-address", mac_addr, 6);
+		if (ret) {
+			printf("Error setting local-mac-address property for ethernet@20112000\n");
+			return -ENODEV;
+		}
 	}
 
 	icicle_mac_addr[0] = '[';
-- 
2.43.0


  parent reply	other threads:[~2024-05-15 15:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15 15:04 [PATCH v1 0/2] Two mpfs icicle init fixes Conor Dooley
2024-05-15 15:04 ` [PATCH v1 1/2] board: microchip: icicle: correct type for node offset Conor Dooley
2024-05-30  3:11   ` Leo Liang
2024-05-15 15:04 ` Conor Dooley [this message]
2024-05-30  3:13   ` [PATCH v1 2/2] board: microchip: icicle: make both ethernets optional Leo Liang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240515150434.406916-3-conor@kernel.org \
    --to=conor@kernel.org \
    --cc=conor.dooley@microchip.com \
    --cc=cyril.jean@microchip.com \
    --cc=padmarao.begari@microchip.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox