* net: asix: best way to handle orphan PHYs @ 2022-03-09 12:18 Oleksij Rempel 2022-03-09 13:31 ` Andrew Lunn 0 siblings, 1 reply; 4+ messages in thread From: Oleksij Rempel @ 2022-03-09 12:18 UTC (permalink / raw) To: David S. Miller, Jakub Kicinski, Andrew Lunn, Heiner Kallweit, Russell King Cc: kernel, linux-kernel, linux-usb, netdev, paskripkin Hello all, I have ASIX based USB Ethernet adapter with two PHYs: internal and external. The internal PHY is enabled by default and there seems to be no way to disable internal PHY on the MAC level without affecting the external PHY. What is the preferred method to suspend internal PHY? Currently I have following options: - suspend PHY in the probe function of the PHY driver - get the phydev in the MAC driver and call phy_suspend() - whisper magic numbers from the MAC driver directly this the MDIO bus. Are there other options? Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: net: asix: best way to handle orphan PHYs 2022-03-09 12:18 net: asix: best way to handle orphan PHYs Oleksij Rempel @ 2022-03-09 13:31 ` Andrew Lunn 2022-03-09 14:45 ` Oleksij Rempel 0 siblings, 1 reply; 4+ messages in thread From: Andrew Lunn @ 2022-03-09 13:31 UTC (permalink / raw) To: Oleksij Rempel Cc: David S. Miller, Jakub Kicinski, Heiner Kallweit, Russell King, kernel, linux-kernel, linux-usb, netdev, paskripkin On Wed, Mar 09, 2022 at 01:18:35PM +0100, Oleksij Rempel wrote: > Hello all, > > I have ASIX based USB Ethernet adapter with two PHYs: internal and > external. The internal PHY is enabled by default and there seems to be > no way to disable internal PHY on the MAC level without affecting the > external PHY. > > What is the preferred method to suspend internal PHY? > Currently I have following options: > - suspend PHY in the probe function of the PHY driver > - get the phydev in the MAC driver and call phy_suspend() > - whisper magic numbers from the MAC driver directly this the MDIO bus. > > Are there other options? Hi Oleksij Can you unique identity this device? Does it have a custom VID:PID? It seems like suspending it in the PHY driver would be messy. How do you identify the PHY is part of your devices and should be suspended? Doing it from the MAC driver seems better, your identification information is close to hand. I would avoid the magic numbers, since phy_suspend() makes it clear what you are doing. Is there one MDIO bus with two devices, or two MDIO busses? If there are two busses, you could maybe add an extra flag to the bus structure you pass to mdiobus_register() which indicates it should suspend all PHY it finds on the bus during enumeration of the bus. Generally we don't want this, if the PHY has link already we want to keep it, to avoid the 1.5s delay causes by autoneg. But if we know the PHYs on the bus are not going to be used, it would be a good point to suspend them. Andrew ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: net: asix: best way to handle orphan PHYs 2022-03-09 13:31 ` Andrew Lunn @ 2022-03-09 14:45 ` Oleksij Rempel 2022-03-09 15:57 ` Andrew Lunn 0 siblings, 1 reply; 4+ messages in thread From: Oleksij Rempel @ 2022-03-09 14:45 UTC (permalink / raw) To: Andrew Lunn Cc: David S. Miller, Jakub Kicinski, Heiner Kallweit, Russell King, kernel, linux-kernel, linux-usb, netdev, paskripkin Hi Andrew, On Wed, Mar 09, 2022 at 02:31:18PM +0100, Andrew Lunn wrote: > On Wed, Mar 09, 2022 at 01:18:35PM +0100, Oleksij Rempel wrote: > > Hello all, > > > > I have ASIX based USB Ethernet adapter with two PHYs: internal and > > external. The internal PHY is enabled by default and there seems to be > > no way to disable internal PHY on the MAC level without affecting the > > external PHY. > > > > What is the preferred method to suspend internal PHY? > > Currently I have following options: > > - suspend PHY in the probe function of the PHY driver > > - get the phydev in the MAC driver and call phy_suspend() > > - whisper magic numbers from the MAC driver directly this the MDIO bus. > > > > Are there other options? > > Hi Oleksij > > Can you unique identity this device? Does it have a custom VID:PID? No, currently it has generic VID:PID. > It seems like suspending it in the PHY driver would be messy. How do > you identify the PHY is part of your devices and should be suspended? EEPROM provides information, which PHY address should be used. If address is 0x10, it is internal PHY. Different parts of ASIX driver use this logic. > Doing it from the MAC driver seems better, your identification > information is close to hand. > > I would avoid the magic numbers, since phy_suspend() makes it clear > what you are doing. > > Is there one MDIO bus with two devices, or two MDIO busses? If there > are two busses, you could maybe add an extra flag to the bus structure > you pass to mdiobus_register() which indicates it should suspend all > PHY it finds on the bus during enumeration of the bus. Generally we > don't want this, if the PHY has link already we want to keep it, to > avoid the 1.5s delay causes by autoneg. But if we know the PHYs on the > bus are not going to be used, it would be a good point to suspend > them. It is one MDIO bus with multiple PHYs one of them is the internal PHY. ax88772 seems to provide way to put the PHY to reset from one of MAC register. See drivers/net/usb/asix_devices.c ax88772_hw_reset() if (priv->embd_phy) ... else asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL, But this way is not working for the ax88772b variant. Ok, so if phy_suspend() is the preffered way, I need to get phydev without attaching it. Correct? Do we already have some helpers to do it? Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: net: asix: best way to handle orphan PHYs 2022-03-09 14:45 ` Oleksij Rempel @ 2022-03-09 15:57 ` Andrew Lunn 0 siblings, 0 replies; 4+ messages in thread From: Andrew Lunn @ 2022-03-09 15:57 UTC (permalink / raw) To: Oleksij Rempel Cc: David S. Miller, Jakub Kicinski, Heiner Kallweit, Russell King, kernel, linux-kernel, linux-usb, netdev, paskripkin > EEPROM provides information, which PHY address should be used. If > address is 0x10, it is internal PHY. Different parts of ASIX driver use > this logic. O.K, so the solution should be generic, unless there are devices with bad EEPROM content. > Ok, so if phy_suspend() is the preffered way, I need to get phydev > without attaching it. Correct? Do we already have some helpers to do it? mdiobus_get_phy() will get you the phydev is you know the bus and the address. Andrew ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-09 15:57 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-03-09 12:18 net: asix: best way to handle orphan PHYs Oleksij Rempel 2022-03-09 13:31 ` Andrew Lunn 2022-03-09 14:45 ` Oleksij Rempel 2022-03-09 15:57 ` Andrew Lunn
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).