Re: [PATCH net-next v2] net: phy: micrel: Add support for PTP_PF_PEROUT for lan8841

From: Horatiu Vultur
Date: Mon Feb 20 2023 - 03:10:40 EST


The 02/20/2023 01:54, Andrew Lunn wrote:

Hi Andrew,

>
> > +static int lan8841_ptp_set_target(struct kszphy_ptp_priv *ptp_priv, u8 event,
> > + s64 sec, u32 nsec)
> > +{
> > + struct phy_device *phydev = ptp_priv->phydev;
> > + int ret;
> > +
> > + ret = phy_write_mmd(phydev, 2, LAN8841_PTP_LTC_TARGET_SEC_HI(event),
> > + upper_16_bits(sec));
> > + ret |= phy_write_mmd(phydev, 2, LAN8841_PTP_LTC_TARGET_SEC_LO(event),
> > + lower_16_bits(sec));
> > + ret |= phy_write_mmd(phydev, 2, LAN8841_PTP_LTC_TARGET_NS_HI(event) & 0x3fff,
> > + upper_16_bits(nsec));
> > + ret |= phy_write_mmd(phydev, 2, LAN8841_PTP_LTC_TARGET_NS_LO(event),
> > + lower_16_bits(nsec));
>
> ORing together error codes generally does not work. MDIO transactions
> can sometimes give ETIMEDOUT, or EINVAL. Combine those and i think you
> get ENOKEY, which is going to be interesting to track down.

Good observation. You are right, it would be ENOKEY.
I will fix this in the next version. I will submit the new version once
the net-next gets open again.

>
> Andrew

--
/Horatiu