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

From: Andrew Lunn
Date: Sun Feb 19 2023 - 19:54:56 EST


> +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.

Andrew