Re: [PATCH net-next v19 15/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB
From: Mieczyslaw Nalewaj
Date: Fri Dec 04 2026 - 01:22:06 EST
On 12/4/2026 3:18 AM, netdev-bot+sashiko@xxxxxxxxxx wrote:
> 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] In rtl8365mb_pcs_config()
> (drivers/net/dsa/realtek/rtl8365mb_main.c), DIGITAL_INTERFACE_SELECT…
>
> --
>
> net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB
>
> This patch adds the RTL8367S-VB (chip ID 0x6642, version 0x0010) to the
> chip table as the first family D chip. That makes the family D code paths
> from the earlier patches reachable. The new rtl8365mb_family_d leaves
> jam_table unset and maps the SerDes to port 6 / EXT0 and the RGMII
> interface to port 7 / EXT1.
>
>> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
>> index b3fc6fbfac7c8..2b7b364542a6c 100644
>> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
>> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c
>
> [ ... ]
>
>> @@ -845,6 +861,24 @@ static const struct rtl8365mb_family_info rtl8365mb_family_c = {
>> .qos_set_untag_pcp = rtl8365mb_c_qos_set_untag_pcp,
>> };
>>
>> +static const struct rtl8365mb_family_info rtl8365mb_family_d = {
>> + .family = RTL8365MB_FAMILY_D,
>> + .ext_config_forcemode = rtl8365mb_d_ext_config_forcemode,
>
> [ ... ]
>
>> @@ -935,6 +969,19 @@ static const struct rtl8365mb_chip_info rtl8365mb_chip_infos[] = {
>> },
>> .num_tx_queues = 8,
>> },
>> + {
>> + .name = "RTL8367S-VB",
>> + .chip_id = 0x6642,
>> + .chip_ver = 0x0010,
>> + .family_info = &rtl8365mb_family_d,
>> + .port_mask = PORT_MASK(GENMASK(4, 0) | BIT(6) | BIT(7)),
>> + .extints = {
>> + { 6, 0, PHY_INTF(SGMII) | PHY_INTF(HSGMII) },
>> + { 7, 1, PHY_INTF(MII) | PHY_INTF(TMII) |
>> + PHY_INTF(RMII) | PHY_INTF(RGMII) },
>> + },
>> + .num_tx_queues = 8,
>> + },
>> };
>
> [Severity: Medium]
> This entry puts the SerDes on EXT0, and rtl8365mb_family_d has no
> jam_table. On family D, does anything ever program the EXT0 mode field
> (bits[3:0]) of DIGITAL_INTERFACE_SELECT (0x1305)?
>
> In rtl8365mb_pcs_config(), the only write to that register is skipped on
> family D:
>
> drivers/net/dsa/realtek/rtl8365mb_main.c:rtl8365mb_pcs_config() {
> ...
> /* On family D, SDS_MISC selects the SerDes mode. id (1) refers to
> * RGMII port 7 on RTL8367S-VB and must not be overwritten. The EXT0
> * field of DIGITAL_INTERFACE_SELECT is not programmed here and keeps
> * its power-on or strap default; whether the vendor sequence sets it
> * for the SerDes was not verified, but the link came up on all tested
> * boards.
> */
> 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),
> ...
> }
>
> On family C, the jam table in rtl8365mb_setup() also writes
> { 0x1305, 0xC000 }. Here fi->jam_table is NULL, so that write is skipped
> as well. On family D, rtl8365mb_ext_config_rgmii() only writes the EXT1
> nibble (bits[7:4]) for port 7.
>
> That leaves the EXT0 field and bits[15:14] at whatever value they have
> after rtl8365mb_reset_chip(), which is the power-on or strap value.
>
> What happens on a board where that default leaves EXT0 in a non-SerDes
> or disabled mode? rtl8365mb_d_ext_config_forcemode() would still force
> MAC6 up from mac_link_up(), and pcs_get_state() only reads the SerDes
> link bit. Could the CPU port then report link up but pass no traffic,
> with no error logged?
>
> If the hardware ignores the EXT0 nibble once SDS_MISC selects
> RTL8365MB_D_SDS_MISC_MAC6_SEL_SDS0, there is no problem. Can that be
> checked against the vendor RTL8367D sequence? If not, should the EXT0
> field be programmed explicitly for the SerDes on family D?
>
Thanks for the review.
I checked this against the vendor RTL8367D port API. In
dal_rtl8367d_port_extMode_set() the SerDes path for MAC6 (id == 1) does not
touch DIGITAL_INTERFACE_SELECT (0x1305) at all. It sets MAC6_SEL_SDS0, loads
the SGCfg/HSGCfg tuning table through the SDS indirect window, sets the
FIBER_CFG_2 RX disable field, and then programs PA12PC_EN, PA33PC_EN and the
mode field in SDS_MISC.
The EXT0 field (SELECT_GMII_0, bits 3:0) is defined in the vendor register
header but is not used anywhere in the vendor code. Every write to 0x1305 there
is to SELECT_GMII_1 (EXT1, RGMII on port 7). So on this family the SerDes mode
is selected by SDS_MISC alone, and the driver matches the vendor sequence by not
writing EXT0.
No code change is needed.