* [PATCH net-next] net: dsa: mt7530: detect PHY muxing when PHY is defined on switch MDIO bus
@ 2024-04-29 9:46 Arınç ÜNAL via B4 Relay
2024-04-29 9:58 ` Russell King (Oracle)
0 siblings, 1 reply; 3+ messages in thread
From: Arınç ÜNAL via B4 Relay @ 2024-04-29 9:46 UTC (permalink / raw)
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, erkin.bozoglu, netdev,
linux-kernel, linux-arm-kernel, linux-mediatek,
Arınç ÜNAL
From: Arınç ÜNAL <arinc.unal@arinc9.com>
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 <arinc.unal@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 <arinc.unal@arinc9.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: dsa: mt7530: detect PHY muxing when PHY is defined on switch MDIO bus
2024-04-29 9:46 [PATCH net-next] net: dsa: mt7530: detect PHY muxing when PHY is defined on switch MDIO bus Arınç ÜNAL via B4 Relay
@ 2024-04-29 9:58 ` Russell King (Oracle)
2024-04-29 13:17 ` Arınç ÜNAL
0 siblings, 1 reply; 3+ messages in thread
From: Russell King (Oracle) @ 2024-04-29 9:58 UTC (permalink / raw)
To: arinc.unal
Cc: 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, Bartel Eerdekens, mithat.guner,
erkin.bozoglu, netdev, linux-kernel, linux-arm-kernel,
linux-mediatek
On Mon, Apr 29, 2024 at 12:46:43PM +0300, Arınç ÜNAL via B4 Relay wrote:
> From: Arınç ÜNAL <arinc.unal@arinc9.com>
>
> 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.
Looking at the commit description and the patch, I'm not sure whether
you really mean "probed" or whether you mean "attached".
PHY drivers will bind to PHY devices when they are detected on the MDIO
bus (either by scanning or instantiating firmware description) and the
devices are registered. As each device is registered, the drivers for
the bus type are scanned and any matches will have their probe function
called. This happens outside of any control of the DSA driver if the
DSA device is on the same MDIO bus.
This is separate from the process of looking up a PHY and attaching the
PHY.
So, I think there is probably a terminology issue with the patch
description. I suspect you don't mean "probing" as in phy_probe() being
called. Looking at the code, it looks like the driver is making
decisions based on how PHYs are connected to the ethernet MACs in the
device tree, and you're making decisions based on that. I wouldn't call
that "probing" a PHY.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: dsa: mt7530: detect PHY muxing when PHY is defined on switch MDIO bus
2024-04-29 9:58 ` Russell King (Oracle)
@ 2024-04-29 13:17 ` Arınç ÜNAL
0 siblings, 0 replies; 3+ messages in thread
From: Arınç ÜNAL @ 2024-04-29 13:17 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: 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, Bartel Eerdekens, mithat.guner,
erkin.bozoglu, netdev, linux-kernel, linux-arm-kernel,
linux-mediatek
On 29.04.2024 12:58, Russell King (Oracle) wrote:
> On Mon, Apr 29, 2024 at 12:46:43PM +0300, Arınç ÜNAL via B4 Relay wrote:
>> From: Arınç ÜNAL <arinc.unal@arinc9.com>
>>
>> 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.
>
> Looking at the commit description and the patch, I'm not sure whether
> you really mean "probed" or whether you mean "attached".
>
> PHY drivers will bind to PHY devices when they are detected on the MDIO
> bus (either by scanning or instantiating firmware description) and the
> devices are registered. As each device is registered, the drivers for
> the bus type are scanned and any matches will have their probe function
> called. This happens outside of any control of the DSA driver if the
> DSA device is on the same MDIO bus.
>
> This is separate from the process of looking up a PHY and attaching the
> PHY.
>
> So, I think there is probably a terminology issue with the patch
> description. I suspect you don't mean "probing" as in phy_probe() being
> called. Looking at the code, it looks like the driver is making
> decisions based on how PHYs are connected to the ethernet MACs in the
> device tree, and you're making decisions based on that. I wouldn't call
> that "probing" a PHY.
Yes, I meant to say "looking up a PHY and attaching the PHY" by probing a
PHY. I'll adjust the patch log to below, thanks.
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.
Arınç
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-29 13:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29 9:46 [PATCH net-next] net: dsa: mt7530: detect PHY muxing when PHY is defined on switch MDIO bus Arınç ÜNAL via B4 Relay
2024-04-29 9:58 ` Russell King (Oracle)
2024-04-29 13:17 ` Arınç ÜNAL
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).