Hi Javen On 1.12.2026 10:44, javen wrote:
> From: Javen Xu <jave…@realsil.com.cn> > > The internal PHY of RTL8127A (RTL8261C, PHY ID 0x001cc890) contains a > PTP block with a free running clock that can be read, set, stepped and > frequency adjusted through vendor MMD registers. > > Register a PTP hardware clock for it. All register accesses go through > the normal blocking MDIO path, multi register sequences are serialized > by a driver mutex. The frequency adjustment is cleared at probe. The > clock is set from the system time when the link comes up for the first > time after a PHY init or link loss.
The code doesn't do this anymore, and time_set is unused. Please drop both.
> > Signed-off-by: Javen Xu <jave…@realsil.com.cn> > --- > Changes in v3: > - Keep the clock running across PHY re-initializations, only start it > from the system time if the counter has been reset > - Only bracket the latching EXEC write with the system timestamps in > gettimex64() > - Clear phydev->priv in remove() > - Add defines for the PHY reset register > - Depend on NETWORK_PHY_TIMESTAMPING from this patch on > > Changes in v4: > - Set the clock from the system time on link up, after a PHY init or > link loss > - Don't fail the PHY probe if PTP setup fails > > Changes in v5: > - Don't set the clock from the system time on link up, leave the time > to userspace. > ---
> [...]
> +static int rtl8127a_ptp_poll(struct rtl8127a_ptp *ptp, u16 reg, u16 mask, > + bool set) > +{ > + int ret, val; > + > + ret = read_poll_timeout(rtl8127a_ptp_read, val, > + val < 0 || !!(val & mask) == set, 1, 1000, > + false, ptp, reg);
Could use phy_read_mmd_poll_timeout() ?
> [...]
> +static int rtl8127a_ptp_hwtstamp_enable(struct rtl8127a_ptp *ptp, bool enable) > +{ > + int ret; > + > + mutex_lock(&ptp->lock); > + > + ret = rtl8127a_ptp_modify(ptp, RTL8127A_PTP_SYNCE_CTL, > + RTL8127A_PTP_SYNCE_EN, 0); > + if (ret) > + goto out; > + > + if (enable) {
Unused until 4/4, maybe move it there ?
> [...]
> +static int rtl8127a_ptp_adjfine(struct ptp_clock_info *info, long scaled_ppm) > +{ > + struct rtl8127a_ptp *ptp = container_of(info, struct rtl8127a_ptp, info); > + s32 ppb = scaled_ppm_to_ppb(scaled_ppm);
diff_by_scaled_ppm() would keep the full resolution.
> [...]
> +static int rtl8127a_ptp_gettimex64(struct ptp_clock_info *info, > + struct timespec64 *ts, > + struct ptp_system_timestamp *sts) > +{
What happens when r8169 is runtime suspended? Nothing on this path resumes it.
> [...]
Thanks, Nicolai