On Tue, Nov 24, 2026 at 2:26 AM <netd…@kernel.org> 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] This patch's stated invariant for keep_mac_tx_enabled SoCs
> (RZ/T2H, RZ/N2H; the next patch, "net: dsa: rzn1-a5psw: Add support…
>
> --
>
> net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H
>
> On SoCs with keep_mac_tx_enabled set, this patch stops clearing
> CMD_CFG.TX_ENA and gates port transmission through PORT_ENA.TXENA
> instead. The TXENA bit is computed from both the STP/admin state and
> the link state. CMD_CFG.SW_RESET is no longer written during setup, and
> the probe path pulses the switch reset line instead.
>
> > diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> > index 751d03b0bde4c..86d5b9d52f8db 100644
> > --- a/drivers/net/dsa/rzn1_a5psw.c
> > +++ b/drivers/net/dsa/rzn1_a5psw.c
>
> [ ... ]
>
> > @@ -996,9 +1037,22 @@ static int a5psw_setup(struct dsa_switch *ds)
> > dsa_switch_for_each_port(dp, ds) {
> > port = dp->index;
> >
> > - /* Reset the port */
> > - a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(port),
> > - A5PSW_CMD_CFG_SW_RESET);
> > + /* Gate TX on link state only for user ports */
> > + if (!a5psw->of_data->keep_mac_tx_enabled || !dsa_port_is_user(dp))
> > + a5psw->link_up |= BIT(port);
> > +
> > + /*
> > + * Writing CMD_CFG = SW_RESET also writes TX_ENA as 0, which
> > + * must never happen on some SoCs. Their switch is reset through
> > + * its reset line in probe, so the statistics are already
> > + * cleared; only disable the MAC receive path.
> > + */
> > + if (a5psw->of_data->keep_mac_tx_enabled)
> > + a5psw_reg_rmw(a5psw, A5PSW_CMD_CFG(port),
> > + A5PSW_CMD_CFG_RX_ENA, 0);
>
> [Severity: Medium]
> Where does TX_ENA actually get set on these SoCs before the first link-up?
>
> The new reset pulse in a5psw_probe() puts every CMD_CFG register back to
> its hardware reset value:
>
> ret = reset_control_reset(reset);
>
> This branch then clears only RX_ENA. TX_ENA keeps whatever value the
> reset default gives it.
>
> The only code that writes TX_ENA=1 is the full register write in
> a5psw_phylink_mac_link_up():
>
> a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(dp->index), cmd_cfg);
>
> Unused ports never get there. User ports get there only after their
> first PHY link-up, and the CPU port only after its fixed-link comes up.
>
> If the RZ/T2H / RZ/N2H reset value of TX_ENA is 0, would unused ports
> keep TX_ENA=0 permanently, and user ports keep it at 0 until their first
> link-up? That would contradict the invariant this patch is meant to
> enforce. The old SW_RESET path in this same loop wrote TX_ENA=0
> explicitly, so the register does accept 0 there.
>
> The following patch in the series ("net: dsa: rzn1-a5psw: Add support
> for RZ/T2H Ethernet switch") sets .keep_mac_tx_enabled = true in
> rzt2h_of_data, and this behaviour is still present at the end of the
> series.
>
> Would something like this set the bit regardless of the reset default?
>
> a5psw_reg_rmw(a5psw, A5PSW_CMD_CFG(port),
> A5PSW_CMD_CFG_RX_ENA | A5PSW_CMD_CFG_TX_ENA,
> A5PSW_CMD_CFG_TX_ENA);
>
On the RZ/T2H and RZ/N2H, COMMAND_CONFIG_Pn.TX_ENA resets to 1 (HW
manual section 29.3.6.2), and probe now pulses the switch reset line
before setup, so TX_ENA is already set on all ports, including unused
ones, before the first link-up. The SW_RESET path wrote TX_ENA=0 only
because it overwrote the whole register; that is what this patch
removes.
That said, setting TX_ENA explicitly is cheap and makes the invariant
independent of the reset value, so I'll update the RMW in
a5psw_setup() to clear RX_ENA and set TX_ENA.
Cheers,
Prabhakar
> > + else
> > + a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(port),
> > + A5PSW_CMD_CFG_SW_RESET);
> >
> > /* Enable only CPU port */
> > a5psw_port_enable_set(a5psw, port, dsa_port_is_cpu(dp));
>
> [ ... ]
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40bp.renesas.com