On Tue, Nov 24, 2026 at 2:26 AM <netd…@kernel.org> wrote:
>
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 1
>
> 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] Possibly incomplete MAC configuration for duplex on RZ/T2H/N2H
> ETHSW ports.
> - [Low] This patch leaves a comment in miic_init_hw()
> (drivers/net/pcs/pcs-rzn1-miic.c) that is now wrong for RZ/T2H.
>
> --
>
> net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL
>
> On RZ/T2H and RZ/N2H, this patch programs SWCTRL.SET10/SET1000 from
> miic_link_up() for converters routed to ETHSW ports. The commit message
> says COMMAND_CONFIG_Pn.ENA_10 has no effect on the actual MAC speed on
> those parts. The matched MODCTRL configuration is now kept in struct miic,
> so the switch port that a converter is routed to can be looked up at
> link-up time.
>
> > diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
> > index 682a73cf5a87d..96f4cb533a719 100644
> > --- a/drivers/net/pcs/pcs-rzn1-miic.c
> > +++ b/drivers/net/pcs/pcs-rzn1-miic.c
>
> [ ... ]
>
> > @@ -383,6 +396,27 @@ static int miic_config(struct phylink_pcs *pcs, unsigned int neg_mode,
> > return 0;
> > }
> >
> > +static void miic_swctrl_set_speed(struct miic *miic, int port, int speed)
> > +{
> > + const struct miic_of_data *of_data = miic->of_data;
> > + u8 conf = miic->conv_conf[port + 1];
> > + u32 val = 0;
> > + int sw_port;
> > +
> > + if (conf < of_data->swctrl_conf_start ||
> > + conf >= of_data->swctrl_conf_start + of_data->swctrl_conf_count)
> > + return;
> > +
> > + sw_port = conf - of_data->swctrl_conf_start;
> > +
> > + if (speed == SPEED_1000)
> > + val = MIIC_SWCTRL_SET_SPEED_1000(sw_port);
> > + else if (speed == SPEED_10)
> > + val = MIIC_SWCTRL_SET_SPEED_10(sw_port);
> > +
> > + miic_reg_rmw(miic, MIIC_SWCTRL, MIIC_SWCTRL_SET_SPEED_MASK(sw_port), val);
> > +}
>
> [Severity: Low]
> This isn't a bug, but on RZ/T2H the comment in miic_init_hw() above the
> probe-time SWCTRL/SWDUPC writes now seems to contradict this function:
>
> drivers/net/pcs/pcs-rzn1-miic.c:miic_init_hw() {
> ...
> /* Disable speed/duplex control from these registers, datasheet
> * says switch registers should be used to setup switch port
> * speed and duplex.
> */
> miic_reg_writel(miic, MIIC_SWCTRL, 0x0);
> miic_reg_writel(miic, MIIC_SWDUPC, 0x0);
> ...
> }
>
> On RZ/T2H, writing SWCTRL = 0 does not hand speed control to the switch.
> It selects 100 Mbps on every ETHSW port, and miic_swctrl_set_speed() now
> uses SWCTRL as the real speed control.
>
> Could this comment be updated to say it describes RZ/N1 only? Otherwise a
> later cleanup that trusts it could drop the SWCTRL programming. The
> comment is still unchanged at the end of the series.
>
I will update the comment in the next version.
Cheers,
Prabhakar
> > static void miic_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
> > phy_interface_t interface, int speed, int duplex)
> > {
> > @@ -415,6 +449,8 @@ static void miic_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
> >
> > miic_reg_rmw(miic, MIIC_CONVCTRL(port),
> > (MIIC_CONVCTRL_CONV_SPEED | MIIC_CONVCTRL_FULLD), val);
> > +
> > + miic_swctrl_set_speed(miic, port, speed);
> > }
>
> [Severity: Medium]
> Does MIIC_SWDUPC need the same handling as SWCTRL on RZ/T2H?
>
> Only speed is copied into the switch-control registers here. In
> miic_link_up(), duplex only sets MIIC_CONVCTRL_FULLD on the converter.
> MIIC_SWDUPC keeps the 0 written in miic_init_hw() and is never written
> again.
>
> On the switch side, half duplex is only set through COMMAND_CONFIG. That
> is the same register block whose ENA_10 bit the commit message says has
> no effect:
>
> drivers/net/dsa/rzn1_a5psw.c:a5psw_phylink_mac_link_up() {
> ...
> if (duplex == DUPLEX_HALF)
> cmd_cfg |= A5PSW_CMD_CFG_HD_ENA;
> ...
> }
>
> a5psw_phylink_get_caps() advertises MAC_100 | MAC_10 on user ports, so
> phylink can resolve a 10/100 half-duplex link.
>
> Suppose SWDUPC selects duplex on RZ/T2H the way SWCTRL selects speed, and
> HD_ENA is as ineffective as ENA_10. The MAC would then stay at whatever
> duplex SWDUPC = 0 encodes, not the negotiated duplex. Could that cause a
> duplex mismatch on half-duplex links?
>
> Nothing in the tree documents SWDUPC semantics on RZ/T2H, so this would
> need checking against the hardware manual. Testing with full duplex only
> would not show it. RZ/T2H ETHSW ports only carry traffic once a later
> patch in this series, "net: dsa: rzn1-a5psw: Add support for RZ/T2H
> Ethernet switch", is applied.
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40bp.renesas.com