realtek: pcs: add dedicated enum for SerDes modes
authorJonas Jelonek <jelonek.jonas@gmail.com>
Thu, 11 Dec 2025 19:17:26 +0000 (19:17 +0000)
committerRobert Marko <robimarko@gmail.com>
Tue, 16 Dec 2025 12:37:31 +0000 (13:37 +0100)
commita4d6e10bf2561a39d9bb3c9e622531e8d5c9caf3
tree032a7206565d398277f4d0a6864bb7cf8095e4c9
parentdecc4f6ba808fb8aa469cd4886ffeea1bb86bcda
realtek: pcs: add dedicated enum for SerDes modes

The Realtek SerDes mode capabilities do not map 1:1 to the
PHY_INTERFACE_MODE_* modes used in the kernel and passed to the PCS.
For example, some PHY chips use the proprietary XSGMII mode for which
there isn't an equivalent in the kernel, or HSGMII.

In the past, this led to problems and confusion using kernel's XGMII to
handle the XSGMII mode, and needed a downstream patch for HSGMII. They
have been solved/worked around for now, but XSGMII is currently not
implemented at all. And who knows what might come in the future.

To make our life easier, introduce a dedicated internal representation
of SerDes modes which differs from kernel's PHY_INTERFACE_MODE_*. This
allows us to map "external" modes to different internal modes as needed
instead of carrying the PHY_INTERFACE_MODE_* through the whole SerDes
configuration code. The PCS driver needs to map PHY_INTERFACE_MODE_* to
RTPCS_SDS_MODE_* in pcs_config, and the latter should be used as the
only one.

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