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

From: Andrew Lunn <[email-masked]>
Date: Mon, 20 Feb 2023 01:54:45 +0100

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