Re: [PATCH net-next v18 10/15] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support
From: netdev-bot+sashiko
Date: Wed Dec 02 2026 - 18:59:05 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] On family D, rtl8365mb_pcs_config()
(drivers/net/dsa/realtek/rtl8365mb_main.c) skips the…
--
net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support
This commit adds family D support to the existing RTL8367S SGMII/HSGMII
PCS code. The family D CPU SerDes is reached through the indexed SDS13
window, and SDS_MISC uses a different layout. The family D paths get
separate tuning tables and their own SDS_MISC setup, and the family D
SerDes port no longer writes DIGITAL_INTERFACE_SELECT or advertises
10/100 Mbit/s.
> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index 7500ea9b3a627..da0c5f254560f 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c
[ ... ]
> @@ -1575,34 +1663,63 @@ static int rtl8365mb_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
[ ... ]
> ret = regmap_update_bits(priv->map, RTL8365MB_SDS_MISC_REG,
> - RTL8365MB_SDS_MISC_MAC8_SEL_SGMII_MASK |
> - RTL8365MB_SDS_MISC_MAC8_SEL_HSGMII_MASK,
> - mode == RTL8365MB_EXT_PORT_MODE_SGMII ?
> - RTL8365MB_SDS_MISC_MAC8_SEL_SGMII_MASK :
> - RTL8365MB_SDS_MISC_MAC8_SEL_HSGMII_MASK);
> + misc_mask, misc_val);
> if (ret)
> return ret;
>
> - val = mode << RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_OFFSET(id);
> - ret = regmap_update_bits(priv->map,
> - RTL8365MB_DIGITAL_INTERFACE_SELECT_REG(id),
> - RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK(id),
> - val);
> - if (ret)
> - return ret;
> + /* On family D, SDS_MISC configures the SerDes mode directly; id (1)
> + * refers to RGMII port 7 on RTL8367S-VB and must not be overwritten.
> + */
> + if (!is_d) {
> + val = sds_mode << RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_OFFSET(id);
> + ret = regmap_update_bits(priv->map,
> + RTL8365MB_DIGITAL_INTERFACE_SELECT_REG(id),
> + RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK(id),
> + val);
> + if (ret)
> + return ret;
> + }
[Severity: Medium]
On family D, rtl8365mb_pcs_config() now skips the whole
DIGITAL_INTERFACE_SELECT update. Should it write the EXT0 field instead?
The RTL8367S-VB chip entry describes the SerDes as extint id 0:
{ 6, 0, PHY_INTF(SGMII) | PHY_INTF(HSGMII) },
That is the EXT0 field, bits 3:0 of RTL8365MB_DIGITAL_INTERFACE_SELECT_REG0
(0x1305). Nothing on the family D path writes that field in SGMII or
2500base-x mode.
The reason given for skipping is that id 1 is the RGMII port 7. That
argues for writing id 0 rather than skipping the write altogether.
Family C sets up this register in two places: the init jam writes
{ 0x1305, 0xC000 }, and pcs_config() writes the SerDes mode into EXT1.
Family D has no init jam table. The register is still used on family D,
because rtl8365mb_ext_config_rgmii() writes the EXT1 field for RGMII on
port 7.
Suppose the EXT0 power-on or strap default on some board is not a SerDes
mode. Could MAC6 then fail to connect to the SerDes and the CPU link stay
down, even though SDS_MISC has MAC6_SEL_SDS0 and the mode field set?
The commit message says:
The EXT0 field of that
register keeps its reset or bootloader value.
Can a bootloader value survive here? rtl8365mb_setup() calls
rtl8365mb_reset_chip() before any PCS configuration:
priv->write_reg_noack(priv, RTL8365MB_CHIP_RESET_REG,
FIELD_PREP(RTL8365MB_CHIP_RESET_HW_MASK, 1));
...
return regmap_read_poll_timeout(priv->map, RTL8365MB_CHIP_RESET_REG, val,
!(val & RTL8365MB_CHIP_RESET_HW_MASK),
20000, 1e6);
That is a full hardware reset, so it looks like EXT0 will always hold its
power-on or strap default when rtl8365mb_pcs_config() runs.
The commit message also says it was not verified whether the vendor
RTL8367D sequence programs this field. The new source comment, however,
says that SDS_MISC configures the SerDes mode directly, as if that were
established. It also does not mention that EXT0 is left unprogrammed.
Could the comment say both of those things, so it matches the commit
message?
This code is unchanged at the end of the series. The RTL8367S-VB chip
entry makes this path reachable, and no later patch in the series
programs EXT0.
>
> /* Take the SerDes out of reset. The vendor driver does this only
> * after the SerDes mux and the interface mode are configured.
> */
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/1383a67b-15e4-4c76-8bbf-65d3cbfa1fc1%40yahoo.com