Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1794746lqa; Mon, 29 Apr 2024 22:01:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUF1IM/fzTSCFXIp7PKxEXy5PbBjEUghbxTk+i2z3RtniyCUY5tE5NKXXK/rzCRIesTlHCUUCc7VmfdL4Oqx9FeDF091+t4eURgKIsVmg== X-Google-Smtp-Source: AGHT+IHSQLY09MkG/HmNiiRcnEWvs4uxaguZXlaFo9T0As3+UcY7qkJTtY7YY+ZD//LqMtX16zE9 X-Received: by 2002:a05:6a21:3405:b0:1a7:9476:6cb9 with SMTP id yn5-20020a056a21340500b001a794766cb9mr8992775pzb.32.1714453314300; Mon, 29 Apr 2024 22:01:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714453314; cv=pass; d=google.com; s=arc-20160816; b=0RqbbIuOrR2D+8+UvIdnm5QW/R3wRXRbPLBXIIl+nunXSSXQTuBk6JevZWqQ/F5oWB 8WmZSLJ3RqfEr7xoBND2b4VpfE0NAZv09WgmUwvsvGMQ8leiXeEux5u3S4V+Uwm0CisR IB/p8/XGFH7V7HApbr5s7WVzu2x7uxPLIrk3E12CtRBNEQqdK4Ji6X+phJarfSi90xmh MDYIAYZbCg1kHdjg6k572w/qzGqUMAqkmDk2KgWuJf8H2kGajPuaJ9jnys7kM8WtmKiK cMMhezsfFHyUFTMUSRzbqzTttog3ezLHGpWJjDQD7lHxIVhH0JsoXH0mAm1VfxPlEmpb OVyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=VSF0Mx0dEWNOVDPPTv+bhummELAdeuHws5ENmO8dVz4=; fh=rcOhACxJIylN2BwrUu4OZ75RNsE44QOAAiMTd4Ce5us=; b=IM4x3XlPmn/MVBf0ga8kZCjo3CD6winqZBNYl8i3sJn6/mIDTJPm/+UJz0Ch6nvStB Aq4Qi/r3uWnZugmBEzRt13Bt5xknZbvAZ/wTtrV1PCNvDV74V95q3tm3hjaSFNem0u1G 5R6gO0s7VxB2chTWW6BxCxxsNnS0LHfxRKzbAtWR/ACv0MnqSQay2TWV4yyaTzKk/mq2 SRnGTw13hYtXWweXPGq8FRXgSUQPScZoF/r1lOyhyjr9zu8+bnX2yJn6Iyryzwv6f8ml ylU5XjaSZdMWZtXnlv7TMrABiuWdwwUwbfaIEAa0XauQhxn319d52i34W/1IXtE4HImS 0eFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LTwGL2cB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-163344-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163344-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id rj12-20020a17090b3e8c00b002b28a9087b4si515741pjb.101.2024.04.29.22.01.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 22:01:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163344-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LTwGL2cB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-163344-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163344-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D9A67B21FB4 for ; Tue, 30 Apr 2024 05:01:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 286631754B; Tue, 30 Apr 2024 05:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LTwGL2cB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C9C114A89; Tue, 30 Apr 2024 05:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714453299; cv=none; b=gV4Z0elIASLrrICjPPmDeR0kBaXtdjeqbz/cnj3/0V74cRGmjd5sMQ4PtMYq5iPdJkWbhn4mzf/WX9xcqituDcVV7Vj68zrsE5d6NavvrMK9kf7Ef3Yyr8gEbekALfL9fKuF6ul7TeVFQiFoGQyAJNFzB9YAiQGJlWzw98bldMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714453299; c=relaxed/simple; bh=GGkybB3RbZ4yacytPZCe3ceKcaWca6ygWTw/PJtmpsk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=QRWD6k4Qg1t5nZj6oj2xdwWDCGHQWHG2xj0lkYcEMm3dMkvPpLbCIOptpZBJtSq06TMxRjVJhgVJ9ATDTIYGKwCHJTx3JTxspI+YkxLsXsfnz9jNxMyQ/+CO3xzRjTuKg0mGP3fl1Q1xznm/8cenWMDUOrv/p1Wlg1XZ8s01edY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LTwGL2cB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 1A3AEC2BBFC; Tue, 30 Apr 2024 05:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714453299; bh=GGkybB3RbZ4yacytPZCe3ceKcaWca6ygWTw/PJtmpsk=; h=From:Date:Subject:To:Cc:Reply-To:From; b=LTwGL2cBtvmG8vpW/5yPEkA2A4EWbBIHkpxGRp6NhmQcwKx6T+Q4Gt/MKTUdGZ6pp FHxkNOtF/KeqTZc814r9H7gtR+6rzRBCcQfWYl2TIdj+1edX/UrwUARQa8CQYwWK3V jqfD9pCOCm+hptOHs6o0+j5FaW5TtN6QJTG/1GpftEfJkQYpsp/jEL28MY35u99DBK yZErlS77MlNQEMScOR7McNtMj0pYnTvgrZLefdORzeWQhX6REODGKFL2xoSWjtg9jw QeQUp07wKwtuwHpKI07IBsFwIsclZYD3/oXrjBSSZmvwHCCvAYT+PXRiH0moLzHERn aa8XczXBSlBVw== 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 04CA2C25B10; Tue, 30 Apr 2024 05:01:39 +0000 (UTC) From: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL_via_B4_Relay?= Date: Tue, 30 Apr 2024 08:01:33 +0300 Subject: [PATCH net-next v2] net: dsa: mt7530: detect PHY muxing when PHY is defined on switch MDIO bus Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240430-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-v2-1-9104d886d0db@arinc9.com> X-B4-Tracking: v=1; b=H4sIACx7MGYC/6WOSw6DMBBDr1LNulNBIHy66j0qFhAGmAUJSgIFI e7eNFeovLJsPfsER5bJwfN2gqWNHRsdjLjfQE2tHgm5Dx5EIvIkFzV2OQ7Goiavafc4+1JmCa6 O0H3Yqwnnng12q4u1ZTpwXnfWI8qqEEWdlamSEgJ+sTTwHqffEHD440ETkomdN/aIn7Y05v/Pb ykGDWUp6yqjVMpXa1mr+qHMDM11XV8dryM7CwEAAA== 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?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714453297; l=1949; i=arinc.unal@arinc9.com; s=arinc9-PC; h=from:subject:message-id; bh=c3IRARdnxa6x5otHszH4xrnla2RxJAal1114ej/d2wE=; b=FL4WEHh4zYu1gBE7wbaN+X2OMCOIMJVsYBkXurHM0IC3CnI6XfpKE1V5QLUSXby75WZfvQ0se lrMQos/eOAaCNbkyxUkmwb3opbC915iywMECA0lv/g0IAo6snRYzMae X-Developer-Key: i=arinc.unal@arinc9.com; a=ed25519; pk=Bd1s2kQtNfZAWyeLHg39jaWBDqt8Ud1WJXLFh7gxl20= X-Endpoint-Received: by B4 Relay for arinc.unal@arinc9.com/arinc9-PC with auth_id=158 X-Original-From: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= Reply-To: arinc.unal@arinc9.com 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 attached before the switch is initialised, in which case, the PHY will fail to be attached. 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 attached. Signed-off-by: Arınç ÜNAL --- Changes in v2: - Address the terminology on the patch log. - Link to v1: https://lore.kernel.org/r/20240429-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-v1-1-1f775983e155@arinc9.com --- drivers/net/dsa/mt7530.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); --- base-commit: 5c4c0edca68a5841a8d53ccd49596fe199c8334c change-id: 20240429-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-586269371c55 Best regards, -- Arınç ÜNAL