From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 02 May 2024 09:04:39 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s2QUh-00EVkF-1c for lore@lore.pengutronix.de; Thu, 02 May 2024 09:04:39 +0200 Received: from bombadil.infradead.org ([2607:7c80:54:3::133]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s2QUc-0000KW-HG for lore@pengutronix.de; Thu, 02 May 2024 09:04:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=tsAmwai4ns1CrLtMpcx7P82Rue84qlOjQ/x8YURXLS8=; b=ipLpDBAK0g5cPjQLl4zH6uVCtP mLO+O1C7sK0obtPnTWN58nqi9SaXxHgbyP3oXR7BaPHj6zzs1AWPm01kKzVxTlCXwB5L1PiISh0SP cWTv4hGOHUj2yPcIWAD/8Tp0nhw8OKH7lrqt8qPZqE87pjzxNRZo8afIenpQTuyaWwQXCfqbg9m08 +ZGrXS1DmdpqN4zAyILYgCM8sjBVR1P4IfJHSmNyIeO/hre7IN3b37AUj4t+XvfUb16ZDt4VLdv29 9sR2fIFI9KjmCxODMwNblfxqE5Bt7Szg9fDBIIKtWPbja0HEE3qp/6w6KzRYSZRRfzFpdif0kIZWH OCjBhZug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2QTs-0000000Bjmv-1aK3; Thu, 02 May 2024 07:03:48 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2QTo-0000000BjjL-0drt for barebox@lists.infradead.org; Thu, 02 May 2024 07:03:46 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s2QTj-00008A-IR; Thu, 02 May 2024 09:03:39 +0200 Received: from [2a0a:edc0:0:1101:1d::54] (helo=dude05.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2QTj-00FTLf-5v; Thu, 02 May 2024 09:03:39 +0200 Received: from localhost ([::1] helo=dude05.red.stw.pengutronix.de) by dude05.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1s2QTj-009LxQ-0F; Thu, 02 May 2024 09:03:39 +0200 From: Ahmad Fatoum To: barebox@lists.infradead.org Cc: Ahmad Fatoum Date: Thu, 2 May 2024 09:03:28 +0200 Message-Id: <20240502070328.2218748-1-a.fatoum@pengutronix.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240502_000344_235804_959FD15E X-CRM114-Status: GOOD ( 12.42 ) X-BeenThere: barebox@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "barebox" X-SA-Exim-Connect-IP: 2607:7c80:54:3::133 X-SA-Exim-Mail-From: barebox-bounces+lore=pengutronix.de@lists.infradead.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-5.8 required=4.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Subject: [PATCH master] net: workaround NICs and MDIO busses sharing same OF node X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.whiteo.stw.pengutronix.de) v2024.04.0 broke Ethernet on the Skov IMX6 board: ERROR: KSZ8873 MDIO mdio1-dev00: can't find ethernet master device The board has an Ethernet switch controlled via a bitbanged MDIO bus and the MDIO bus of the Ethernet device is unused. The FEC node has no mdio subnode, just a fixed-link. Starting with commit ac855ffe5730 ("net: phy: fix miibus parent device of_node not matching phy node"), MDIO busses will get assigned the device tree node of their parent if none was configured. This means we have two devices competing for the same device tree node: barebox@Skov IMX6:/ devinfo 2188000.ethernet@2188000.of [...] Device node: /soc/bus@2100000/ethernet@2188000 (populated by miibus0) This has the effect that calling of_device_ensure_probed on the device tree fails with -EPROBE_DEFER because miibus0 has no driver bound and the network device itself is ignored. We probably want to rethink allowing multiple devices to share the same device tree node, especially for network drivers. But as long this is the case, fix the regression by always walking the list of registered device tree nodes. Fixes: ac855ffe5730 ("net: phy: fix miibus parent device of_node not matching phy node") Signed-off-by: Ahmad Fatoum --- net/eth.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/eth.c b/net/eth.c index 28961e868b7a..98567d8d3fc2 100644 --- a/net/eth.c +++ b/net/eth.c @@ -528,11 +528,12 @@ void led_trigger_network(enum led_trigger trigger) struct eth_device *of_find_eth_device_by_node(struct device_node *np) { struct eth_device *edev; - int ret; - ret = of_device_ensure_probed(np); - if (ret) - return NULL; + /* There may multiple devices with the same device_node, e.g. + * MII bus and Ethernet controller. Thus ignore errors and + * walk the full list of registered network devices below + */ + (void)of_device_ensure_probed(np); list_for_each_entry(edev, &netdev_list, list) if (edev->parent->of_node == np) -- 2.39.2