796-net-dsa-mt7530-detect-PHY-muxing-when-PHY-is-defined-on-switch-MDIO-bus.patch 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. From patchwork Tue Apr 30 05:01:33 2024
  2. Content-Type: text/plain; charset="utf-8"
  3. MIME-Version: 1.0
  4. Content-Transfer-Encoding: 8bit
  5. X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?=
  6. <[email protected]>
  7. X-Patchwork-Id: 13648264
  8. X-Patchwork-Delegate: [email protected]
  9. Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org
  10. [10.30.226.201])
  11. (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
  12. (No client certificate requested)
  13. by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C9C114A89;
  14. Tue, 30 Apr 2024 05:01:39 +0000 (UTC)
  15. Authentication-Results: smtp.subspace.kernel.org;
  16. arc=none smtp.client-ip=10.30.226.201
  17. ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
  18. t=1714453299; cv=none;
  19. b=gV4Z0elIASLrrICjPPmDeR0kBaXtdjeqbz/cnj3/0V74cRGmjd5sMQ4PtMYq5iPdJkWbhn4mzf/WX9xcqituDcVV7Vj68zrsE5d6NavvrMK9kf7Ef3Yyr8gEbekALfL9fKuF6ul7TeVFQiFoGQyAJNFzB9YAiQGJlWzw98bldMQ=
  20. ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
  21. s=arc-20240116; t=1714453299; c=relaxed/simple;
  22. bh=GGkybB3RbZ4yacytPZCe3ceKcaWca6ygWTw/PJtmpsk=;
  23. h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc;
  24. b=QRWD6k4Qg1t5nZj6oj2xdwWDCGHQWHG2xj0lkYcEMm3dMkvPpLbCIOptpZBJtSq06TMxRjVJhgVJ9ATDTIYGKwCHJTx3JTxspI+YkxLsXsfnz9jNxMyQ/+CO3xzRjTuKg0mGP3fl1Q1xznm/8cenWMDUOrv/p1Wlg1XZ8s01edY=
  25. ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
  26. dkim=pass (2048-bit key) header.d=kernel.org [email protected]
  27. header.b=LTwGL2cB; arc=none smtp.client-ip=10.30.226.201
  28. Authentication-Results: smtp.subspace.kernel.org;
  29. dkim=pass (2048-bit key) header.d=kernel.org [email protected]
  30. header.b="LTwGL2cB"
  31. Received: by smtp.kernel.org (Postfix) with ESMTPS id 1A3AEC2BBFC;
  32. Tue, 30 Apr 2024 05:01:39 +0000 (UTC)
  33. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
  34. s=k20201202; t=1714453299;
  35. bh=GGkybB3RbZ4yacytPZCe3ceKcaWca6ygWTw/PJtmpsk=;
  36. h=From:Date:Subject:To:Cc:Reply-To:From;
  37. b=LTwGL2cBtvmG8vpW/5yPEkA2A4EWbBIHkpxGRp6NhmQcwKx6T+Q4Gt/MKTUdGZ6pp
  38. FHxkNOtF/KeqTZc814r9H7gtR+6rzRBCcQfWYl2TIdj+1edX/UrwUARQa8CQYwWK3V
  39. jqfD9pCOCm+hptOHs6o0+j5FaW5TtN6QJTG/1GpftEfJkQYpsp/jEL28MY35u99DBK
  40. yZErlS77MlNQEMScOR7McNtMj0pYnTvgrZLefdORzeWQhX6REODGKFL2xoSWjtg9jw
  41. QeQUp07wKwtuwHpKI07IBsFwIsclZYD3/oXrjBSSZmvwHCCvAYT+PXRiH0moLzHERn
  42. aa8XczXBSlBVw==
  43. Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org
  44. (localhost.localdomain [127.0.0.1])
  45. by smtp.lore.kernel.org (Postfix) with ESMTP id 04CA2C25B10;
  46. Tue, 30 Apr 2024 05:01:39 +0000 (UTC)
  47. From: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?=
  48. <[email protected]>
  49. Date: Tue, 30 Apr 2024 08:01:33 +0300
  50. Subject: [PATCH net-next v2] net: dsa: mt7530: detect PHY muxing when PHY
  51. is defined on switch MDIO bus
  52. Precedence: bulk
  53. X-Mailing-List: [email protected]
  54. List-Id: <netdev.vger.kernel.org>
  55. List-Subscribe: <mailto:[email protected]>
  56. List-Unsubscribe: <mailto:[email protected]>
  57. MIME-Version: 1.0
  58. Message-Id:
  59. <20240430-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-v2-1-9104d886d0db@arinc9.com>
  60. X-B4-Tracking: v=1; b=H4sIACx7MGYC/6WOSw6DMBBDr1LNulNBIHy66j0qFhAGmAUJSgIFI
  61. e7eNFeovLJsPfsER5bJwfN2gqWNHRsdjLjfQE2tHgm5Dx5EIvIkFzV2OQ7Goiavafc4+1JmCa6
  62. O0H3Yqwnnng12q4u1ZTpwXnfWI8qqEEWdlamSEgJ+sTTwHqffEHD440ETkomdN/aIn7Y05v/Pb
  63. ykGDWUp6yqjVMpXa1mr+qHMDM11XV8dryM7CwEAAA==
  64. To: Daniel Golle <[email protected]>, DENG Qingfang <[email protected]>,
  65. Sean Wang <[email protected]>, Andrew Lunn <[email protected]>,
  66. Florian Fainelli <[email protected]>,
  67. Vladimir Oltean <[email protected]>,
  68. "David S. Miller" <[email protected]>, Eric Dumazet <[email protected]>,
  69. Jakub Kicinski <[email protected]>, Paolo Abeni <[email protected]>,
  70. Matthias Brugger <[email protected]>,
  71. AngeloGioacchino Del Regno <[email protected]>
  72. Cc: Bartel Eerdekens <[email protected]>,
  73. [email protected], [email protected], [email protected],
  74. [email protected], [email protected],
  75. [email protected],
  76. =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= <[email protected]>
  77. X-Mailer: b4 0.13.0
  78. X-Developer-Signature: v=1; a=ed25519-sha256; t=1714453297; l=1949;
  79. [email protected]; s=arinc9-PC; h=from:subject:message-id;
  80. bh=c3IRARdnxa6x5otHszH4xrnla2RxJAal1114ej/d2wE=;
  81. b=FL4WEHh4zYu1gBE7wbaN+X2OMCOIMJVsYBkXurHM0IC3CnI6XfpKE1V5QLUSXby75WZfvQ0se
  82. lrMQos/eOAaCNbkyxUkmwb3opbC915iywMECA0lv/g0IAo6snRYzMae
  83. X-Developer-Key: [email protected]; a=ed25519;
  84. pk=Bd1s2kQtNfZAWyeLHg39jaWBDqt8Ud1WJXLFh7gxl20=
  85. X-Endpoint-Received: by B4 Relay for [email protected]/arinc9-PC with
  86. auth_id=158
  87. X-Original-From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= <[email protected]>
  88. Reply-To: [email protected]
  89. X-Patchwork-Delegate: [email protected]
  90. From: Arınç ÜNAL <[email protected]>
  91. Currently, the MT7530 DSA subdriver configures the MT7530 switch to provide
  92. direct access to switch PHYs, meaning, the switch PHYs listen on the MDIO
  93. bus the switch listens on. The PHY muxing feature makes use of this.
  94. This is problematic as the PHY may be attached before the switch is
  95. initialised, in which case, the PHY will fail to be attached.
  96. Since commit 91374ba537bd ("net: dsa: mt7530: support OF-based registration
  97. of switch MDIO bus"), we can describe the switch PHYs on the MDIO bus of
  98. the switch on the device tree. Extend the check to detect PHY muxing when
  99. the PHY is defined on the MDIO bus of the switch on the device tree.
  100. When the PHY is described this way, the switch will be initialised first,
  101. then the switch MDIO bus will be registered. Only after these steps, the
  102. PHY will be attached.
  103. Signed-off-by: Arınç ÜNAL <[email protected]>
  104. ---
  105. Changes in v2:
  106. - Address the terminology on the patch log.
  107. - 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
  108. ---
  109. drivers/net/dsa/mt7530.c | 3 ++-
  110. 1 file changed, 2 insertions(+), 1 deletion(-)
  111. ---
  112. base-commit: 5c4c0edca68a5841a8d53ccd49596fe199c8334c
  113. change-id: 20240429-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-586269371c55
  114. Best regards,
  115. --- a/drivers/net/dsa/mt7530.c
  116. +++ b/drivers/net/dsa/mt7530.c
  117. @@ -2488,7 +2488,8 @@ mt7530_setup(struct dsa_switch *ds)
  118. if (!phy_node)
  119. continue;
  120. - if (phy_node->parent == priv->dev->of_node->parent) {
  121. + if (phy_node->parent == priv->dev->of_node->parent ||
  122. + phy_node->parent->parent == priv->dev->of_node) {
  123. ret = of_get_phy_mode(mac_np, &interface);
  124. if (ret && ret != -ENODEV) {
  125. of_node_put(mac_np);