From: guoqi0226 <guoqi0226@163.com>
To: Frank <Frank.Sae@motor-comm.com>, Andrew Lunn <andrew@lunn.ch>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
cuiguoqi@kylinos.cn
Subject: [PATCH] net: phy: motorcomm: keep chip delay defaults when firmware provides none
Date: Tue, 1 Sep 2026 14:19:15 +0800 [thread overview]
Message-ID: <20260901061915.3410228-1-guoqi0226@163.com> (raw)
From: cuiguoqi <cuiguoqi@kylinos.cn>
ytphy_rgmii_clk_delay_config() unconditionally programs the YT8521
RGMII delay registers. When firmware describes neither
rx-internal-delay-ps nor tx-internal-delay-ps,
ytphy_get_delay_reg_value() falls back to the default 1950 ps values
and those are still written into CCR and RC1R, overwriting the chip
strap/OTP settings. With phy-mode "rgmii-rxid" this clears the RX
internal delay the MAC relies on, causing CRC errors, packet loss and
link training failures at gigabit speed until the link falls back to
100M.
The fallback only supplies a value and does not skip the register
write, so the check belongs in the caller. Since the hardware links
cleanly at gigabit with the chip defaults untouched, return early when
firmware provides neither delay property. Delays supplied via DT or
ACPI _DSD are still honored.
Since commit fffedfece2b4 ("net: phy: motorcomm: use device properties
for firmware tuning") switched the driver to the generic device
property API, this applies to both DT and ACPI platforms.
Fixes: a6e68f0f8769 ("net: phy: Add dts support for Motorcomm yt8521 gigabit ethernet phy")
Signed-off-by: cuiguoqi <cuiguoqi@kylinos.cn>
---
drivers/net/phy/motorcomm.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
index 5071605a1a11..a8b8ebbd4d6b 100644
--- a/drivers/net/phy/motorcomm.c
+++ b/drivers/net/phy/motorcomm.c
@@ -895,6 +895,18 @@ static int ytphy_rgmii_clk_delay_config(struct phy_device *phydev)
u16 mask, val = 0;
int ret;
+ /* When firmware provides no delay properties, keep the chip's
+ * strap/OTP defaults untouched. Rewriting the delay registers here
+ * would zero the RX internal delay that rgmii-rxid relies on,
+ * which breaks gigabit links (CRC errors and intermittent link
+ * training failures).
+ */
+ if (!device_property_present(&phydev->mdio.dev,
+ "rx-internal-delay-ps") &&
+ !device_property_present(&phydev->mdio.dev,
+ "tx-internal-delay-ps"))
+ return 0;
+
rx_reg = ytphy_get_delay_reg_value(phydev, "rx-internal-delay-ps",
ytphy_rgmii_delays, tb_size,
&rxc_dly_en,
--
2.25.1
next reply other threads:[~2026-09-01 6:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 6:19 guoqi0226 [this message]
2026-09-01 12:18 ` [PATCH] net: phy: motorcomm: keep chip delay defaults when firmware provides none Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260901061915.3410228-1-guoqi0226@163.com \
--to=guoqi0226@163.com \
--cc=Frank.Sae@motor-comm.com \
--cc=andrew@lunn.ch \
--cc=cuiguoqi@kylinos.cn \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox