Message ID | 20220420124053.853891-2-kai.heng.feng@canonical.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [1/5] net: mdio: Mask PHY only when its ACPI node is present | expand |
On Wed, Apr 20, 2022 at 08:40:48PM +0800, Kai-Heng Feng wrote: > Not all PHY has an ACPI node, for those nodes auto probing is still > needed. Why do you need this? Documentation/firmware-guide/acpi/dsd/phy.rst There is nothing here about there being PHYs which are not listed in ACPI. If you have decided to go the ACPI route, you need to list the PHYs. Andrew
On Wed, Apr 20, 2022 at 10:47 PM Andrew Lunn <andrew@lunn.ch> wrote: > > On Wed, Apr 20, 2022 at 08:40:48PM +0800, Kai-Heng Feng wrote: > > Not all PHY has an ACPI node, for those nodes auto probing is still > > needed. > > Why do you need this? > > Documentation/firmware-guide/acpi/dsd/phy.rst > > There is nothing here about there being PHYs which are not listed in > ACPI. If you have decided to go the ACPI route, you need to list the > PHYs. This is for backward-compatibility. MAC can have ACPI node but PHY may not have one. On ACPI based platform, stmmac is using mdiobus_register() and its PHY is using autoprobing, so masking all PHYs from autoprobing will break those stmmac users. Kai-Heng > > Andrew
On Thu, Apr 21, 2022 at 10:58:40AM +0800, Kai-Heng Feng wrote: > On Wed, Apr 20, 2022 at 10:47 PM Andrew Lunn <andrew@lunn.ch> wrote: > > > > On Wed, Apr 20, 2022 at 08:40:48PM +0800, Kai-Heng Feng wrote: > > > Not all PHY has an ACPI node, for those nodes auto probing is still > > > needed. > > > > Why do you need this? > > > > Documentation/firmware-guide/acpi/dsd/phy.rst > > > > There is nothing here about there being PHYs which are not listed in > > ACPI. If you have decided to go the ACPI route, you need to list the > > PHYs. > > This is for backward-compatibility. MAC can have ACPI node but PHY may > not have one. And if the PHY does not have an ACPI node, fall back to mdiobus_register(). This is what of_mdiobus_register() does. If np=NULL, it calls mdiobus_register() and skips all the OF stuff. Andrew
On Thu, Apr 21, 2022 at 7:40 PM Andrew Lunn <andrew@lunn.ch> wrote: > > On Thu, Apr 21, 2022 at 10:58:40AM +0800, Kai-Heng Feng wrote: > > On Wed, Apr 20, 2022 at 10:47 PM Andrew Lunn <andrew@lunn.ch> wrote: > > > > > > On Wed, Apr 20, 2022 at 08:40:48PM +0800, Kai-Heng Feng wrote: > > > > Not all PHY has an ACPI node, for those nodes auto probing is still > > > > needed. > > > > > > Why do you need this? > > > > > > Documentation/firmware-guide/acpi/dsd/phy.rst > > > > > > There is nothing here about there being PHYs which are not listed in > > > ACPI. If you have decided to go the ACPI route, you need to list the > > > PHYs. > > > > This is for backward-compatibility. MAC can have ACPI node but PHY may > > not have one. > > And if the PHY does not have an ACPI node, fall back to > mdiobus_register(). This is what of_mdiobus_register() does. If > np=NULL, it calls mdiobus_register() and skips all the OF stuff. The equivalent to this scenario is that when MAC doesn't have ACPI node. But yes it can unmask the PHYs if no ACPI node is found, then call mdiobus_register(). Kai-Heng > > Andrew
diff --git a/drivers/net/mdio/acpi_mdio.c b/drivers/net/mdio/acpi_mdio.c index d77c987fda9cd..f9369319ada19 100644 --- a/drivers/net/mdio/acpi_mdio.c +++ b/drivers/net/mdio/acpi_mdio.c @@ -33,8 +33,15 @@ int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) u32 addr; int ret; - /* Mask out all PHYs from auto probing. */ - mdio->phy_mask = GENMASK(31, 0); + /* Loop over the child nodes and mask out PHY from auto probing */ + fwnode_for_each_child_node(fwnode, child) { + ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr); + if (ret || addr >= PHY_MAX_ADDR) + continue; + + mdio->phy_mask |= BIT(addr); + } + ret = mdiobus_register(mdio); if (ret) return ret;
Not all PHY has an ACPI node, for those nodes auto probing is still needed. So only mask those PHYs with ACPI nodes. Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> --- drivers/net/mdio/acpi_mdio.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)