From: Mikhail Zhilkin <csharper2005@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: jerome.forissier@arm.com, ryder.lee@mediatek.com,
weijie.gao@mediatek.com, chunfeng.yun@mediatek.com,
igor.belwon@mentallysanemainliners.org, dlechner@baylibre.com,
jstephan@baylibre.com, GSS_MTK_Uboot_upstream@mediatek.com,
trini@konsulko.com, Mikhail Zhilkin <csharper2005@gmail.com>
Subject: [PATCH v1 3/3] net: mtk_eth: an8855: sync SerDes analog tuning with Linux driver
Date: Sat, 7 Nov 2026 17:24:40 +0300 [thread overview]
Message-ID: <20261107142441.2104669-4-csharper2005@gmail.com> (raw)
In-Reply-To: <20261107142441.2104669-1-csharper2005@gmail.com>
Port the TX FIR (TX Eye) and RX CDR (RX Jitter Tolerance) analog
tuning parameters from the upstream Linux Airoha AN8855 DSA driver
(drivers/net/dsa/airoha/an8855.c).
The default U-Boot configuration omits these register writes, leaving
the SerDes with inferior default drive characteristics. On hardware
iterations with minor silicon or trace variances, this marginal signal
integrity leads to severe packet loss (50-60%) during TFTP recovery
over the 2500Base-X link. Explicitly configuring AN8855_INTF_CTRL_10,
AN8855_INTF_CTRL_11, and AN8855_RG_QP_CDR_LPF_BOT_LIM ensures a
stable physical link across boards.
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
---
drivers/net/mtk_eth/an8855.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/net/mtk_eth/an8855.c b/drivers/net/mtk_eth/an8855.c
index 513f4534701..f8f004e0914 100644
--- a/drivers/net/mtk_eth/an8855.c
+++ b/drivers/net/mtk_eth/an8855.c
@@ -96,6 +96,8 @@
#define AN8855_SS_LCPLL_TDC_PCW_1 (AN8855_QP_PMA_TOP_BASE + 0x248)
#define AN8855_INTF_CTRL_8 (AN8855_QP_PMA_TOP_BASE + 0x320)
#define AN8855_INTF_CTRL_9 (AN8855_QP_PMA_TOP_BASE + 0x324)
+#define AN8855_INTF_CTRL_10 (AN8855_QP_PMA_TOP_BASE + 0x328)
+#define AN8855_INTF_CTRL_11 (AN8855_QP_PMA_TOP_BASE + 0x32c)
#define AN8855_PLL_CTRL_0 (AN8855_QP_PMA_TOP_BASE + 0x400)
#define AN8855_PLL_CTRL_2 (AN8855_QP_PMA_TOP_BASE + 0x408)
#define AN8855_PLL_CTRL_3 (AN8855_QP_PMA_TOP_BASE + 0x40c)
@@ -113,6 +115,7 @@
#define AN8855_QP_ANA_CSR_BASE 0x1022f000
#define AN8855_RG_QP_RX_DAC_EN (AN8855_QP_ANA_CSR_BASE + 0x00)
#define AN8855_RG_QP_RXAFE_RESERVE (AN8855_QP_ANA_CSR_BASE + 0x04)
+#define AN8855_RG_QP_CDR_LPF_BOT_LIM (AN8855_QP_ANA_CSR_BASE + 0x08)
#define AN8855_RG_QP_CDR_LPF_MJV_LIM (AN8855_QP_ANA_CSR_BASE + 0x0c)
#define AN8855_RG_QP_CDR_LPF_SETVALUE (AN8855_QP_ANA_CSR_BASE + 0x14)
#define AN8855_RG_QP_CDR_PR_CKREF_DIV1 (AN8855_QP_ANA_CSR_BASE + 0x18)
@@ -678,6 +681,28 @@ static int an8855_port_sgmii_init(struct an8855_switch_priv *priv, u32 port)
an8855_reg_write(priv, AN8855_MSG_RX_LIK_STS_0, 0x01010107);
an8855_reg_write(priv, AN8855_MSG_RX_LIK_STS_2, 0x00000EEF);
+ /* TX FIR - improve TX EYE */
+ an8855_reg_read(priv, AN8855_INTF_CTRL_10, &val);
+ val &= ~(0x1f << 24);
+ val |= (0x04 << 24);
+ val &= ~(0x1f << 16);
+ val |= (0x00 << 16);
+ val |= BIT(29) | BIT(21);
+ an8855_reg_write(priv, AN8855_INTF_CTRL_10, val);
+
+ an8855_reg_read(priv, AN8855_INTF_CTRL_11, &val);
+ val &= ~(0x3f << 0);
+ val |= BIT(6);
+ an8855_reg_write(priv, AN8855_INTF_CTRL_11, val);
+
+ /* RX CDR - improve RX Jitter Tolerance */
+ an8855_reg_read(priv, AN8855_RG_QP_CDR_LPF_BOT_LIM, &val);
+ val &= ~(0x7 << 24);
+ val |= (0x5 << 24);
+ val &= ~(0x7 << 20);
+ val |= (0x5 << 20);
+ an8855_reg_write(priv, AN8855_RG_QP_CDR_LPF_BOT_LIM, val);
+
return 0;
}
--
2.53.0
next prev parent reply other threads:[~2026-11-07 14:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 14:24 [PATCH v1 0/3] net: mtk_eth: an8855: fix packet loss and sync with Linux Mikhail Zhilkin
2026-11-07 14:24 ` [PATCH v1 1/3] net: mtk_eth: an8855: fix bitwise collision in RX_CTRL_8 register Mikhail Zhilkin
2026-11-09 21:23 ` David Lechner
2026-11-07 14:24 ` [PATCH v1 2/3] net: mtk_eth: an8855: enable link error recovery Mikhail Zhilkin
2026-11-09 21:23 ` David Lechner
2026-11-07 14:24 ` Mikhail Zhilkin [this message]
2026-11-09 21:25 ` [PATCH v1 3/3] net: mtk_eth: an8855: sync SerDes analog tuning with Linux driver David Lechner
2026-11-09 21:23 ` [PATCH v1 0/3] net: mtk_eth: an8855: fix packet loss and sync with Linux David Lechner
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=20261107142441.2104669-4-csharper2005@gmail.com \
--to=csharper2005@gmail.com \
--cc=GSS_MTK_Uboot_upstream@mediatek.com \
--cc=chunfeng.yun@mediatek.com \
--cc=dlechner@baylibre.com \
--cc=igor.belwon@mentallysanemainliners.org \
--cc=jerome.forissier@arm.com \
--cc=jstephan@baylibre.com \
--cc=ryder.lee@mediatek.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=weijie.gao@mediatek.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.