public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>,
	Konstantin Porotchkin <kostap@marvell.com>,
	Marek Behun <marek.behun@nic.cz>,
	Vladimir Vid <vladimir.vid@sartura.hr>,
	Luka Perkov <luka.perkov@sartura.hr>,
	Luis Torres <luis.torres@methode.com>,
	Scott Roberts <scott.roberts@telus.com>,
	Paul Arola <paul.arola@telus.com>
Cc: u-boot@lists.denx.de
Subject: [PATCH u-boot-marvell 5/9] arm: mvebu: turris_mox: Remove hardcoded ethernet node names
Date: Mon, 14 Feb 2022 11:34:26 +0100	[thread overview]
Message-ID: <20220214103430.24242-6-pali@kernel.org> (raw)
In-Reply-To: <20220214103430.24242-1-pali@kernel.org>

Armada 3720 DTS files in upstream kernel use ethernet nodes named
'ethernet@30000' and 'ethernet@40000'. U-Boot have them named 'neta@30000'
and 'neta@40000'. To have Turris Mox U-Boot board code independent of
ethernet node names, find ethernet node via alias.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 board/CZ.NIC/turris_mox/turris_mox.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index f0c5aa6a520b..8888a2dcabcd 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -375,8 +375,22 @@ static void mox_phy_leds_start_blinking(void)
 {
 	struct phy_device *phydev;
 	struct mii_dev *bus;
+	const char *node_name;
+	int node;
+
+	node = fdt_path_offset(gd->fdt_blob, "ethernet0");
+	if (node < 0) {
+		printf("Cannot get eth0!\n");
+		return;
+	}
 
-	bus = miiphy_get_dev_by_name("neta@30000");
+	node_name = fdt_get_name(gd->fdt_blob, node, NULL);
+	if (!node_name) {
+		printf("Cannot get eth0 node name!\n");
+		return;
+	}
+
+	bus = miiphy_get_dev_by_name(node_name);
 	if (!bus) {
 		printf("Cannot get MDIO bus device!\n");
 		return;
@@ -623,8 +637,12 @@ int last_stage_init(void)
 	 */
 	if (peridot || topaz) {
 		struct mii_dev *bus;
+		const char *node_name;
+		int node;
 
-		bus = miiphy_get_dev_by_name("neta@30000");
+		node = fdt_path_offset(gd->fdt_blob, "ethernet0");
+		node_name = (node >= 0) ? fdt_get_name(gd->fdt_blob, node, NULL) : NULL;
+		bus = node_name ? miiphy_get_dev_by_name(node_name) : NULL;
 		if (!bus) {
 			printf("Cannot get MDIO bus device!\n");
 		} else {
-- 
2.20.1


  parent reply	other threads:[~2022-02-14 10:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 10:34 [PATCH u-boot-marvell 0/9] arm: a37xx: Fix code and update DTS files to upstream version Pali Rohár
2022-02-14 10:34 ` [PATCH u-boot-marvell 1/9] rtc: ds1307: Add bindings for microchip, mcp7940x Pali Rohár
2022-02-15  9:23   ` [PATCH u-boot-marvell 1/9] rtc: ds1307: Add bindings for microchip,mcp7940x Stefan Roese
2022-02-14 10:34 ` [PATCH u-boot-marvell 2/9] phy: marvell: a3700: Update compatible string to official DT bindings Pali Rohár
2022-02-15  9:23   ` Stefan Roese
2022-02-14 10:34 ` [PATCH u-boot-marvell 3/9] usb: ehci: ehci-marvell: " Pali Rohár
2022-02-15  9:24   ` Stefan Roese
2022-02-14 10:34 ` [PATCH u-boot-marvell 4/9] watchdog: armada_37xx: Convert " Pali Rohár
2022-02-15  9:25   ` Stefan Roese
2022-02-14 10:34 ` Pali Rohár [this message]
2022-02-15  9:27   ` [PATCH u-boot-marvell 5/9] arm: mvebu: turris_mox: Remove hardcoded ethernet node names Stefan Roese
2022-02-14 10:34 ` [PATCH u-boot-marvell 6/9] arm: a37xx: Update sdhci pointers to official DT bindings Pali Rohár
2022-02-15  9:28   ` Stefan Roese
2022-02-15  9:32     ` Pali Rohár
2022-02-14 10:34 ` [PATCH u-boot-marvell 7/9] arm: a37xx: espressobin: Move U-Boot specific partitions node to -u-boot.dtsi Pali Rohár
2022-02-15  9:28   ` Stefan Roese
2022-02-14 10:34 ` [PATCH u-boot-marvell 8/9] arm: a37xx: espressobin: Explicitly enable eMMC node in -u-boot.dtsi Pali Rohár
2022-02-15  9:29   ` Stefan Roese
2022-02-14 10:34 ` [PATCH u-boot-marvell 9/9] arm: a37xx: Update DTS files to version from upstream Linux kernel Pali Rohár
2022-02-15  9:31   ` Stefan Roese
2022-02-17 15:37 ` [PATCH u-boot-marvell 0/9] arm: a37xx: Fix code and update DTS files to upstream version Stefan Roese

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=20220214103430.24242-6-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=kostap@marvell.com \
    --cc=luis.torres@methode.com \
    --cc=luka.perkov@sartura.hr \
    --cc=marek.behun@nic.cz \
    --cc=paul.arola@telus.com \
    --cc=scott.roberts@telus.com \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=vladimir.vid@sartura.hr \
    /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