Message ID | 20250309172717.9067-9-ansuelsmth@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | net: dsa: Add Airoha AN8855 support | expand |
On Sun, Mar 09, 2025 at 06:26:53PM +0100, Christian Marangi wrote: > Permit to pass the device node pointer to mdio regmap config and permit > mdio registration with an OF node to support DT PHY probe. > > With the device node pointer NULL, the normal mdio registration is used. Should this be using a device node, or a fwnode? It depends _why_ you're adding this, and you omit to state that in the commit description (hint - it should say why!)
On Sun, Mar 09, 2025 at 05:37:58PM +0000, Russell King (Oracle) wrote: > On Sun, Mar 09, 2025 at 06:26:53PM +0100, Christian Marangi wrote: > > Permit to pass the device node pointer to mdio regmap config and permit > > mdio registration with an OF node to support DT PHY probe. > > > > With the device node pointer NULL, the normal mdio registration is used. > > Should this be using a device node, or a fwnode? > > It depends _why_ you're adding this, and you omit to state that in the > commit description (hint - it should say why!) > Ugh totally forgot... It should be a device node. The use of the of_ variant of mdiobus register permits to autoprobe PHY defined in device tree. The current regmap driver only permit manual probe using the mask value so it's problematic for MFD usage with an abstract regmap and PHY autoprobe. Will add additional info in the commit.
diff --git a/drivers/net/mdio/mdio-regmap.c b/drivers/net/mdio/mdio-regmap.c index 8bfcd9e415c8..329839ab68e6 100644 --- a/drivers/net/mdio/mdio-regmap.c +++ b/drivers/net/mdio/mdio-regmap.c @@ -90,7 +90,7 @@ struct mii_bus *devm_mdio_regmap_register(struct device *dev, else mii->phy_mask = ~0; - rc = devm_mdiobus_register(dev, mii); + rc = devm_of_mdiobus_register(dev, mii, config->np); if (rc) { dev_err(config->parent, "Cannot register MDIO bus![%s] (%d)\n", mii->id, rc); return ERR_PTR(rc); diff --git a/include/linux/mdio/mdio-regmap.h b/include/linux/mdio/mdio-regmap.h index 8c7061e39ccb..23fc2dd9d752 100644 --- a/include/linux/mdio/mdio-regmap.h +++ b/include/linux/mdio/mdio-regmap.h @@ -22,6 +22,7 @@ struct regmap; struct mdio_regmap_config { struct device *parent; + struct device_node *np; struct regmap *regmap; char name[MII_BUS_ID_SIZE]; u8 valid_addr;
Permit to pass the device node pointer to mdio regmap config and permit mdio registration with an OF node to support DT PHY probe. With the device node pointer NULL, the normal mdio registration is used. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> --- drivers/net/mdio/mdio-regmap.c | 2 +- include/linux/mdio/mdio-regmap.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)