net: phy: question about phy_is_internal for generic-phy
Subsystems (2)
Hello,
Is there a way to specify "phy is internal" to generic phy driver, that is, to make phy_is_internal() function available?
I found "phy-is-integrated" DT property in Documentation/devicetree/bindings/net/phy.txt, however, it seems that the property is no effect for generic phy. And I think that the meaning of "integrated" is slightly different from "internal".
---
Best Regards,
Kunihiko Hayashi
Quoted 9 lines · Kunihiko Hayashi
Hello,
Is there a way to specify "phy is internal" to generic phy driver, that is, to make
phy_is_internal()function available?I found "phy-is-integrated" DT property in
Documentation/devicetree/bindings/net/phy.txt, however, it seems that the property is no effect for generic phy. And I think that the meaning of "integrated" is slightly different from "internal".
Hi Kunihiko
Could you explain the bigger picture. Why do you need this?
Thanks
Andrew
Hi Andrew,
Quoted 6 lines · On Thu, 8 Feb 2018 13:51:44 +0100 <[email protected]> wrote:
Quoted 5 lines · Kunihiko Hayashi
Hello,
Is there a way to specify "phy is internal" to generic phy driver, that is, to make
phy_is_internal()function available?
Quoted 8 lines
Quoted 4 lines
I found "phy-is-integrated" DT property in
Documentation/devicetree/bindings/net/phy.txt, however, it seems that the property is no effect for generic phy. And I think that the meaning of "integrated" is slightly different from "internal".Hi Kunihiko
Could you explain the bigger picture. Why do you need this?
There are some SoCs that have a built-in phy, and sometimes these SoCs can choose to use built-in phy or external phy.
In our case, MAC driver needs to set a register to choose whether to use them. This choice depends on the board implemented on the SoC. And this built-in phy can be driven with generic phy driver.
If 'struct phy_driver' of a phy driver has the flag with PHY_IS_INTERNAL, phy_is_internal() returns true,
and the MAC driver can decide a value of the register using it.
drivers/net/phy/phy_device.c:
if (phydrv->flags & PHY_IS_INTERNAL)
phydev->is_internal = true;include/linux/phy.h:
static inline bool phy_is_internal(struct phy_device *phydev)
{
return phydev->is_internal;
}Although I can write a new driver with PHY_IS_INTERNAL, or add a new property to the MAC driver,
I'd like to use generic phy driver if possible.
However, it seems that the generic phy driver doesn't have the way to express built-in phy with/without even DT.
How can I handle such built-in phy?
Thank you,
---
Best Regards,
Kunihiko Hayashi
Quoted 2 lines
There are some SoCs that have a built-in phy, and sometimes these SoCs can choose to use built-in phy or external phy.
O.K. This is the same use case we had at the end of last year.
How are the MDIO busses arranged? Is there an internal MDIO bus and an external MDIO bus? How do you change between the internal and the external? Or is it one bus, with the two PHYs having different addresses?
For the hardware in question last year, an MDIO MUX was implemented. The MAC has a phy-handle pointing to either the internal PHY on the internal MDIO bus, or the external PHY on the external MDIO bus. The MDIO MUX layer would then set the register to select between the two.
https://patchwork.kernel.org/patch/10025279/
Andrew
Hi Andrew,
Thank you for your advice.
Quoted 10 lines · On Fri, 9 Feb 2018 15:59:54 +0100 <[email protected]> wrote:
Quoted 2 lines
There are some SoCs that have a built-in phy, and sometimes these SoCs can choose to use built-in phy or external phy.
O.K. This is the same use case we had at the end of last year.
How are the MDIO busses arranged? Is there an internal MDIO bus and an external MDIO bus? How do you change between the internal and the external? Or is it one bus, with the two PHYs having different addresses?
Quoted 6 lines
For the hardware in question last year, an MDIO MUX was implemented. The MAC has a phy-handle pointing to either the internal PHY on the internal MDIO bus, or the external PHY on the external MDIO bus. The MDIO MUX layer would then set the register to select between the two.
I've checked our hardware configuration.
There are internal and external MDIO buses, and the register selects between them. I'll consider to apply MDIO MUX layer to our MAC driver rather than phy_is_internal of generic-phy.
Thank you,
---
Best Regards,
Kunihiko Hayashi