]> git.ipfire.org Git - thirdparty/openwrt.git/commit
realtek: pcs: rtl930x: fix LEQ calibration to use media type
authorJonas Jelonek <jelonek.jonas@gmail.com>
Sat, 27 Jun 2026 19:23:05 +0000 (19:23 +0000)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Sun, 28 Jun 2026 21:38:36 +0000 (23:38 +0200)
commit393d5b01fba4dbefcaed95c1938cc2b6c47e2dfb
treeff0e225d51596fafade4293f6b452854f43660cd
parent8dd1c280aec92e67caa07a9031cbcfa85c8cbcad
realtek: pcs: rtl930x: fix LEQ calibration to use media type

Replace the mode-based approximation in the LEQ adapt+lock step with
proper media-based logic using the newly stored sds->media field. Those
adjustments are based on SDK code and digging through some basics of
signal conditioning.

PCB connections route through an external PHY (PHY-attached); that PHY
handles its own equalization so the SerDes LEQ is left in free-running
auto-adapt with no correction offset. DAC and fiber SFP connect directly
to the SerDes without an intermediate PHY and require a calibrated lock.

Replace the SDK's dacLongCableOffset/eqHoldEnable variable pair with a
single direct_serdes bool and encode the full per-media LEQ correction
into one switch: fiber +3 (direct SerDes, no cable), DAC short +4
(base 3 + 1), DAC long +6 (base 3 + 3).

Fix the MAXHOLD_EN bit (0x17[7]) and the 0x0c[8] write to be gated on
direct_serdes; both were previously conditioned on PCB which is the
PHY-attached case and thus wrong. Fix the LEQ lock to apply to all
direct SerDes connections (DAC + fiber), not just PCB. Also drop the
spurious dead-code branch that was an artifact of the original
transplanting.

No behavioral change because this particular function of calibration is
not used right now but will be in the future.

Link: https://github.com/openwrt/openwrt/pull/23983
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c