From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796120616; b=0vKd5o5LfBnF57FNeneFX/iGjxshwoBCifxqcy2I/n5U3Ou9BW2vbWkEjEgvkxJWjMiU aDrVgvlyzzlDU6R7mae2fjORAkcLyBuL7o7EzBlLrhrwkwPx/WyyDsl4yHRSgLuOlez30 1cOSg9POEFh/k1v8HFFPtFm1c1zmBtoYqVVDSzU6geLGTTfN8kucmMaDGoO5XD5vgmE0m kaCRsk5PQ2Jz/yVFaSmZwXFS1JFwhuk639e96Ux+hDAvZHFaEBbFc6J66qk04YjbvAixF RKorjIQIOX7uE4ALQPNtAc3r/9p3BwN9WtZJ/ofZkDeKCUljau55+RCeavWfgyHhD/A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796120616; h=DMARC-Filter:Received:DKIM-Signature:MIME-Version:Date:From:To:Cc: Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=mZ0dZnf7C9r++aNYM7fmKvg9INBHwxzc1QI44jgAwpg=; b=isOX0RKnYYG+75A6FLN02pkgv8Y0k1ix1OUFSSUSbkaIHRioviRv9DeP/oGVYnonFwbG X+T2xYRbzKZpaIIXLibtnbJ+wCjHp4Ckr/tuRXciMT94nudcoMuns/PI0WsK+uVJuL61y 8GiX20EzjKSGNiPh2uD1qWThruYEV874HD5tXgitF6O2c+xTWZa4thLjHSfsW7GpRybV1 H99e/MWuroaxcS/3WA4fgjos+BVM4c+o0EpZVSPoIaVwfTfabAdGSDCZ2w34rH4ucFebF OatHDQBDh7xEOmXundqFcCvNehyr5OABnZb5+wYuKBt60peHsyphM1u6O5S7dnuWafg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=taLVqyop; arc=none smtp.remote-ip=194.13.80.246 Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2032D606A31A; Tue, 1 Dec 2026 10:23:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2032D606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=taLVqyop Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6B1F1A157F; Tue, 01 Dec 2026 11:23:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1796120613; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=mZ0dZnf7C9r++aNYM7fmKvg9INBHwxzc1QI44jgAwpg=; b=taLVqyopSP7ZrmCEZVmL2AFFz2jfeDhszMN/5e8ily3ec/bBoYXZ5Vi/PPwdjWqx+hTKRi FMXAYW7JSzMdDG2lyEWdEWuDXVjzi9mXozqlLluGB6X58QNdgPR+l+5XYNXxt90KhfkAo2 071mlaoc/qphC/4RZ8w9xG5BwkS66ASSD9G9MZnoAMEZcAwkALhAtvUkl8L3yMChxfMUOL Fl/RfUNRZxG9dh8fLmuyhLi6AZ+G2zRDluUtyWd55kerow4QgeqOMnITnFkuAp5amWgqbl 5Iq5WOIHlsm4BJzc+N/s3o+N9DglFJpQvszvMToc7mRPElKVo+zK0k8boQ5XQw== X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Date: Tue, 01 Dec 2026 11:23:32 +0100 From: Nicolai Buchwitz To: javen Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, daniel@makrotopia.org, vladimir.oltean@nxp.com Subject: Re: [PATCH net-next v5 3/4] net: phy: realtek: add PTP clock support for RTL8127a In-Reply-To: <20261201094454.1150-4-javen_xu@realsil.com.cn> References: <20261201094454.1150-1-javen_xu@realsil.com.cn> <20261201094454.1150-4-javen_xu@realsil.com.cn> Message-ID: X-Sender: nb@tipi-net.de Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 Hi Javen On 1.12.2026 10:44, javen wrote: > From: Javen Xu > > 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 > --- > 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