Re: [net-next PATCH v5 7/9] net: phy: qcom: add support for QCA807x PHY Family

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 02, 2024 at 06:44:22PM +0100, Christian Marangi wrote:
> On Fri, Feb 02, 2024 at 02:35:11AM +0100, Andrew Lunn wrote:
> > > +static int qca807x_read_fiber_status(struct phy_device *phydev)
> > > +{
> > > +	int ss, err, lpa, old_link = phydev->link;
> > > +
> > > +	/* Update the link, but return if there was an error */
> > > +	err = genphy_update_link(phydev);
> > > +	if (err)
> > > +		return err;
> > > +
> > > +	/* why bother the PHY if nothing can have changed */
> > > +	if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link)
> > > +		return 0;
> > > +
> > > +	phydev->speed = SPEED_UNKNOWN;
> > > +	phydev->duplex = DUPLEX_UNKNOWN;
> > > +	phydev->pause = 0;
> > > +	phydev->asym_pause = 0;
> > > +
> > > +	if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) {
> > > +		lpa = phy_read(phydev, MII_LPA);
> > > +		if (lpa < 0)
> > > +			return lpa;
> > > +
> > > +		linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
> > > +				 phydev->lp_advertising, lpa & LPA_LPACK);
> > > +		linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
> > > +				 phydev->lp_advertising, lpa & LPA_1000XFULL);
> > > +		linkmode_mod_bit(ETHTOOL_LINK_MODE_Pause_BIT,
> > > +				 phydev->lp_advertising, lpa & LPA_1000XPAUSE);
> > > +		linkmode_mod_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
> > > +				 phydev->lp_advertising,
> > > +				 lpa & LPA_1000XPAUSE_ASYM);
> > > +
> > > +		phy_resolve_aneg_linkmode(phydev);
> > > +	}
> > 
> > This looks a lot like genphy_c37_read_status(). Can it be used?
> >
> 
> Yes but I had to expand genphy_c37_read_status. Hope it will be OK.

You can expand it, but please keep to what is defined within 802.3. We
don't want any vendor extensions in this common code. Vendor things
should be kept in the vendor driver. So you can call
genphy_c37_read_status() and then do any vendor specific fixups
needed.

      Andrew




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux