Re: [PATCH 2/2] net: phy: dp83826: Add support for straps reading

From: Russell King (Oracle)
Date: Mon Mar 03 2025 - 13:09:11 EST


On Mon, Mar 03, 2025 at 06:35:04PM +0100, Jean-Michel Hautbois wrote:
> Hi Russel,
>
> On 03/03/2025 18:25, Russell King (Oracle) wrote:
> > On Mon, Mar 03, 2025 at 06:05:52PM +0100, Jean-Michel Hautbois wrote:
> > > + /* Bit 10: MDIX mode */
> > > + if (val & BIT(10))
> > > + phydev_dbg(phydev, "MDIX mode enabled\n");
> > > +
> > > + /* Bit 9: auto-MDIX disable */
> > > + if (val & BIT(9))
> > > + phydev_dbg(phydev, "Auto-MDIX disabled\n");
> > > +
> > > + /* Bit 8: RMII */
> > > + if (val & BIT(8)) {
> > > + phydev_dbg(phydev, "RMII mode enabled\n");
> > > + phydev->interface = PHY_INTERFACE_MODE_RMII;
> > > + }
> >
> > Do all users of this PHY driver support having phydev->interface
> > changed?
> >
>
> I don't know, what is the correct way to know and do it ?
> Other phys did something similar (bcm84881_read_status is an example I
> took).

That's currently known to only be used in a SFP, and therefore it uses
phylink, and therefore changing ->interface is supported (phylink's
design is to support this.)

> > > +
> > > + /* Bit 5: Slave mode */
> > > + if (val & BIT(5))
> > > + phydev_dbg(phydev, "RMII slave mode enabled\n");
> > > +
> > > + /* Bit 0: autoneg disable */
> > > + if (val & BIT(0)) {
> > > + phydev_dbg(phydev, "Auto-negotiation disabled\n");
> > > + phydev->autoneg = AUTONEG_DISABLE;
> > > + phydev->speed = SPEED_100;
> > > + phydev->duplex = DUPLEX_FULL;
> > > + }
> >
> > This doesn't force phylib to disallow autoneg.
>
> Is it needed to call phy_lookup_setting() or something else ?

Have a look at phy_ethtool_ksettings_set(), there's some clues in
there about how to prevent autoneg being enabled.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!