From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32719C433F5 for ; Mon, 14 Feb 2022 10:36:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4906083BED; Mon, 14 Feb 2022 11:36:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="vJFQRPET"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A58783BB9; Mon, 14 Feb 2022 11:35:26 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DB1F083BD4 for ; Mon, 14 Feb 2022 11:35:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AFE2061357; Mon, 14 Feb 2022 10:35:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01B7CC340E9; Mon, 14 Feb 2022 10:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644834900; bh=j+DMcb//PybkOKyGE4khZsZBWMsXWg6Yu4Y2SNARhso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJFQRPETtDf1aN76ZFGwCVzZ9agA+V4lw5jpX7dmm2L9gkVc/bVWbLYqnznhXFtn8 07efjMENjgP56AioPKw0rBrCTEJoJvHvIoLlIKUBQealIICfbZj2cSbq1laUuonXHP sQPLzt4WDB4NQPJWCfswfYxxYdsRl3NjtZF+A2k0/TcWXvPgfVuBv1o13DfhpQh2in btSUav8szdMnmJbtvi2h3/IIdlA8o2XjaZqqXLsb0CGKq3ndWyWJPPS9hJzYSJFIoz TnvClWL9ZNAj+q4hRCPgcBOHCFd7zAWrBFfnZhbIt3MKQSycXkQ6kiywcdUScWwKBl T+oDUOv8di3uA== Received: by pali.im (Postfix) id AE3A6CAA; Mon, 14 Feb 2022 11:34:59 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese , Konstantin Porotchkin , Marek Behun , Vladimir Vid , Luka Perkov , Luis Torres , Scott Roberts , Paul Arola 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 Message-Id: <20220214103430.24242-6-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220214103430.24242-1-pali@kernel.org> References: <20220214103430.24242-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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 --- 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