From patchwork Mon Apr 29 09:46:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 13646521 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B80E3C4345F for ; Mon, 29 Apr 2024 09:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=dXRzeI0KumYpKWNBz7NVqNp+vAitEezOAoZaHVqs3cA=; b=0PZdMzdGnkuf/KQ48kMluy7l9H YBPUZMmh3lT83jAU9xm2UNCRn6fngD0cg+OAX1V7Pmbg3FAUdw3jG0hgAlIkR/0bgPVlnVjRGt/pz kS3zBsOuAHihbRV4QcUSBjO8TPESYA0OHYTXtmxeDuMz9dKDz2DVHg+bn+nz523/YJZ7RvSo7AfXl W8gCmrVt3kRr+eaQ0zRO886pk1+NaRHxHg6xT9XycdINhBRagK+z/u21Rq7oI3guxdz3Dx+iZwZAJ WiVxgUnS7EHj4llfsNh+B2+sF4TL6GTxRdHCNfBYooPj+O/Dhvv8EStoy8tS7eUevWiCspw07zTLO MgAwlPXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1Nbb-000000029mf-2VfO; Mon, 29 Apr 2024 09:47:27 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1NbY-000000029lk-1CSh; Mon, 29 Apr 2024 09:47:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4435060C11; Mon, 29 Apr 2024 09:47:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id D5BC3C113CD; Mon, 29 Apr 2024 09:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714384042; bh=NM6evQjYLnroF7Q2T+xgCdVK89+I3dLZ0fOu5qXvXuU=; h=From:Date:Subject:To:Cc:Reply-To:From; b=HQO5NSRtsNRAd5p8HtrxVIvFV7XzARyZBhe/9abXPitkqGgLwjgaGobgZzj2fr3Jy RNn4H9TdrU4r/kk0QoKFDGhYwSmj0TgUmsFo9C9qRWGC2bw9qEIUG+aCl6vrQBwn1P XtLiU54iDeVX4hRj/xByeoStQ79orF44wjz6Q/vQ1UV/5x374iDJEzDKCx40f13WVT TT0eyFag8yE14sQCNZG0aev1ppupFq1bIQE75Zft/x5c5Y+q4x0SSLc2IxrYRrDIBj 573WNaIabG42dmqeAxKNxQgTNLUu04shvXv8ccuvOsN6lG1eyGAZ1bMyEpSff7b0l0 uOfO8kJDq1wmQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5010C4345F; Mon, 29 Apr 2024 09:47:22 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= Date: Mon, 29 Apr 2024 12:46:43 +0300 Subject: [PATCH net-next] net: dsa: mt7530: detect PHY muxing when PHY is defined on switch MDIO bus MIME-Version: 1.0 Message-Id: <20240429-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-v1-1-1f775983e155@arinc9.com> X-B4-Tracking: v=1; b=H4sIAIJsL2YC/x3NQQ6DIBCF4auYWXcSRNDaq5guqo4yC8AAtjTGu 5e6/JOX7x0QKTBFeFQHBHpzZO9K1LcKJvNyKyHPpUEKqYSSPY4KFx/QUXKUE9rU6UbgHgnjh9N k0M7scdzjNdvMF+2e2a2o761s+6arJ62h8FughfN1PUDh8O/B8zx/gMKG6ZQAAAA= To: Daniel Golle , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno Cc: Bartel Eerdekens , mithat.guner@xeront.com, erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714384017; l=1737; i=arinc.unal@arinc9.com; s=arinc9-patatt; h=from:subject:message-id; bh=aV0b87E50oYhQ0oa+qVZ0uBYjOG8eoZT/UzGqSKMX+s=; b=Nq09mU0p4YPp/xi2o2FjpG+iFQnXvtEU3rSX2+/m1lN0qfURodE/M/xzNPYmVb0YMAjA29jt+ mrN3+nAmij2A4jISevUV4uDaSgAoMYbC1kaiDm0ucx49S8SbqUYx8X2 X-Developer-Key: i=arinc.unal@arinc9.com; a=ed25519; pk=VmvgMWwm73yVIrlyJYvGtnXkQJy9CvbaeEqPQO9Z4kA= X-Endpoint-Received: by B4 Relay for arinc.unal@arinc9.com/arinc9-patatt with auth_id=115 X-Original-From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240429_024724_456751_26115347 X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arinc.unal@arinc9.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL Currently, the MT7530 DSA subdriver configures the MT7530 switch to provide direct access to switch PHYs, meaning, the switch PHYs listen on the MDIO bus the switch listens on. The PHY muxing feature makes use of this. This is problematic as the PHY may be probed before the switch is initialised, in which case attaching the PHY will fail. Since commit 91374ba537bd ("net: dsa: mt7530: support OF-based registration of switch MDIO bus"), we can describe the switch PHYs on the MDIO bus of the switch on the device tree. Extend the check to detect PHY muxing when the PHY is defined on the MDIO bus of the switch on the device tree. When the PHY is described this way, the switch will be initialised first, then the switch MDIO bus will be registered. Only after these steps, the PHY will be probed. Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- base-commit: 5c4c0edca68a5841a8d53ccd49596fe199c8334c change-id: 20240429-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-586269371c55 Best regards, diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 2b9f904a98f0..6cf21c9d523b 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2483,7 +2483,8 @@ mt7530_setup(struct dsa_switch *ds) if (!phy_node) continue; - if (phy_node->parent == priv->dev->of_node->parent) { + if (phy_node->parent == priv->dev->of_node->parent || + phy_node->parent->parent == priv->dev->of_node) { ret = of_get_phy_mode(mac_np, &interface); if (ret && ret != -ENODEV) { of_node_put(mac_np);