Article View: linux.kernel.netdev
Article #25164Re: [PATCH net-next v5 3/4] net: phy: realtek: add PTP clock support for RTL8127a
From: Nicolai Buchwitz
Date: Tue, 01 Dec 2026 10:23
Date: Tue, 01 Dec 2026 10:23
98 lines
11092 bytes
11092 bytes
Hi Javen
On 1.12.2026 10:44, javen wrote:
> From: Javen Xu <javen_xu@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 <javen_xu@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
Technical Details
Message-ID:
<f3abdf1bd4bb98dba9c3a4e4861b4f65@tipi-net.de>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374939-linux-kernel-netdev=dewy.ruReferences:
<20261201094454.1150-1-javen_xu@realsil.com.cn> <20261201094454.1150-4-javen_xu@realsil.com.cn>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374939-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v5 3/4] net: phy: realtek: add PTP clock support for RTL8127a Date: Tue, 01 Dec 2026 11:23:32 +0100 Organization: Usenet Network Message-ID: <f3abdf1bd4bb98dba9c3a4e4861b4f65@tipi-net.de> References: <20261201094454.1150-1-javen_xu@realsil.com.cn> <20261201094454.1150-4-javen_xu@realsil.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1685304"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:GhlBfkqtNZRZSnKeuPayuS3fTnA= sha256:DD7b1H9nr0px7R0KPWjZiwQyi9oWE2EWdrHK9PFpzfw= sha1:jrCujzPIO6HL0GfM103elL8t09U= sha256:9JVwgteiZu8KcT94buy0lgnEHeabrhZWMZqalbN9g7Y= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 9981511732A; Tue, 1 Dec 2026 13:24:13 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=tipi-net.de X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LYrruvslCeSh; Tue, 1 Dec 2026 13:24:10 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374939-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 5FF5211716E; Tue, 1 Dec 2026 13:24:01 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id B4F4F2640A; Tue, 1 Dec 2026 10:23:59 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796120637; b=m6oLbRfLLVbQSQVo+oR2Asy0srVpfC0nU9d3dhDJN6wGKChv3thDeXJ0XzzwNk3pN+JM uP80tTKVDE/tU913K5N9tiphJXCS2763ZMSwTza/6fc/unzSVBdV/eMI066Ewj2A88fWB lor3RHpNXQ+JAdpmGVkK++Zyw/6JDGzc7ZGd/nKM6VzIlubcwjoOAZuOJGOkus/Hw4DP2 PgQ2zN1GhFOyeiHjVCBtgC0j/VYNMuMNSi0En4UItCTjoidAN31pyARu2bsRYia9sqbc3 8YrSAbxpy0Aqa2O5+0DJtsN0CbdIAy1lTaLdr3CPqS87wkNp2XKwkcepGJiMTTPe2sQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796120637; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence: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=qO50kGINn+7oq4aO724IoHyYSk5z3v8DqkGoZbe7pIz1Zti7pyhx3ziSf6SaFM7G1cmT Nv5t4wuXsQv8EXq5GTYWG2M0ma2pZsDrRZfabYgOrhw2EWYYCmJpa8Nsoy68Wkqj7HoCl 5d6uRTQyDInnZP3lYFnvSKyG0Ymnq90OTJgJTvX4Qe410gwgbYW0fRWlY8Otqe9kHWL+e UTPceRzEbNFQLgrSn4xwmsGYXR8gDyKU2VFdnrSecK6p49/bprwlq+KJ3Hx3As3JzNebB I+gTC1BwbMUMIaME73kwBNfwJhmWdNij7+6u2p/Mmifd+f6Z3vsUnQrtShV6J6+gpkg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=taLVqyop; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 76C25606A325; Tue, 1 Dec 2026 10:23:57 +0000 (UTC) X-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 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 X-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== X-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== X-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 X-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) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2032D606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de X-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) X-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: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-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 X-In-Reply-To: <20261201094454.1150-4-javen_xu@realsil.com.cn> X-Sender: nb@tipi-net.de X-Last-TLS-Session-Version: TLSv1.3