From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=211.75.126.72 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796201793; b=vC23t9UTIHv/ovNoNgG002ENfntQcJ9Bkl03A9B9jriP0oIOMn63XHMuQhEoBCy9bnB/ NcNNH+w9vjBmtHyf7vbrM3xKyFE0jjk7GqCEBzIW/KellK4Sr6XWgVKjd9cmyntydzKWD BXk2DsAT2tXC9bTjSDfxo43b52LPf9Lxd+BRtuyiebDOiApxv4wQPjI5gambvHIdcCGHt nwkU3bW0uRTmn57s/C8U/2J3fL7QpB5SWLFzD1RHhOnEdpGWNtjIR2KZ/7Vn5H0bWYt9N WD9GkLhZR3dV715tcYSIZvaNFAwsJBcuUDcpXpfjW+UhlptSTRAAcSulHmwt3knYxcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796201793; h=DMARC-Filter:X-SpamFilter-By:DKIM-Signature:Received:Received: Received:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID: References:In-Reply-To:Accept-Language:Content-Language: x-originating-ip:Content-Type:Content-Transfer-Encoding:MIME-Version; bh=8er3tMuGEF8RBymBQ+EkE6khKuChT71MCRMU83qXVsg=; b=VezGIVhWeXRITKwQg7vbZ9+iDLgj5QKw8dr3angUSlSKc7j/HPJZpzeTmhr9UcxjEV+E dimKmmZPgf5Q7zCqBoM0rr/5aYcVkIPK4th9dMzesg/9I/XCqlFni1sy2SSTRLVdHSS4/ KcVes7zUN3cZexTiPVxe9SKCkwi+FB0Vv++f62ECDY6xnlYJwAiBU59nNmV5pG/3Pp8be 9E0WNZS1UYs/9Rd6hbpZwgISWgHu/6LDuOZr0V+3eUrlseCzMjEprj2tAPt5760G5ypvP lHC0GjAXh7qJ6xyxuMJYqVDi88FL6hXbhsRLfsYjlkrvWxruxxbYkmBm9I8Zh+wzZGg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=realsil.com.cn; spf=pass smtp.mailfrom=realsil.com.cn; dkim=pass header.d=realsil.com.cn header.i=@realsil.com.cn header.a=rsa-sha256 header.s=dkim header.b="U/G52yAK"; arc=none smtp.remote-ip=211.75.126.72 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB12E606A327; Wed, 2 Dec 2026 08:56:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BB12E606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realsil.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realsil.com.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=realsil.com.cn header.i=@realsil.com.cn header.a=rsa-sha256 header.s=dkim header.b=U/G52yAK X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 6B28tWEv9827329, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realsil.com.cn; s=dkim; t=1796201735; bh=8er3tMuGEF8RBymBQ+EkE6khKuChT71MCRMU83qXVsg=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:Content-Transfer-Encoding:MIME-Version; b=U/G52yAKqLz3tx/WaEqz+ZUQL8RKwfX7SjOezS9SETI57mfKS60Mb6kd+7YYppPZ4 lj6FPEuNOvt8+AD1TafSrAxAqyJIkTtfHcO+0IVrmQ0ddrRqCPaCZaDpHUzSTWpr47 akyLrR8rlIAlf7PS3NFBawxSc+MzduUlq7yA9cIdfYBMNjh4U7zx/ggRQ3tR+hKnAq TzYtDM6qgzfJkRkiGpghB7tUIBWvzb/QXBIZ4oj3JCnn7qDH1V5IxBOJiluAGeARZ2 X/O0arpeqWZVRBlklg8h+QphmLmJNdU5XR6wXzZk2E/vs+zX+QvRj/XXVfu8CxR3Qi pNMR7qsCU4dFg== Received: from RS-EX-MBS1.realsil.com.cn ([172.29.17.101]) by rtits2.realtek.com.tw (8.15.2/3.29/5.94) with ESMTPS id 6B28tWEv9827329 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 2 Dec 2026 16:55:34 +0800 Received: from RS-EX-MBS3.realsil.com.cn (172.29.17.103) by RS-EX-MBS1.realsil.com.cn (172.29.17.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Wed, 2 Dec 2026 16:55:32 +0800 Received: from RS-EX-MBS3.realsil.com.cn ([172.29.17.103]) by RS-EX-MBS3.realsil.com.cn ([172.29.17.103]) with mapi id 15.02.2562.056; Wed, 2 Dec 2026 16:55:32 +0800 From: Javen To: Nicolai Buchwitz 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 Thread-Topic: [PATCH net-next v5 3/4] net: phy: realtek: add PTP clock support for RTL8127a Thread-Index: AQHdgXihWXtWRJ6B0UWGXiAMAYnp7bdHcvkAgAH/EGA= Date: Wed, 2 Dec 2026 08:55:32 +0000 Message-ID: References: <20261201094454.1150-1-javen_xu@realsil.com.cn> <20261201094454.1150-4-javen_xu@realsil.com.cn> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Hi Nicolai, > >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 =3D read_poll_timeout(rtl8127a_ptp_read, val, >> + val < 0 || !!(val & mask) =3D=3D set, 1, 1= 000, >> + 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 =3D 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 =3D container_of(info, struct >> +rtl8127a_ptp, >> info); >> + s32 ppb =3D 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. I think we could resume the MAC around the PHC callbacks with pm_runtime_re= sume_and_get(phydev->mdio.bus->parent), or only take a reference with pm_ru= ntime_get_if_active() and return -EBUSY while the MAC is suspended, so the = PHC doesn't wake up the NIC (and re-init the PHY) while there is no link. Which one do you prefer? Thanks, Javen