Re: [PATCH net-next v4] net: dsa: mxl-gsw1xx: force internal PHYs into a known reset state

From: Daniel Golle

Date: Tue Sep 22 2026 - 06:54:33 EST


On Tue, Sep 22, 2026 at 12:41:22PM +0200, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxxxx>
>
> When bootstrapped with PS_NOWAIT = 0 the internal PHYs stay held in
> reset, so the driver only worked with PS_NOWAIT = 1 where they are
> released automatically.
>
> Add a ->setup() hook, run before the MDIO bus is registered so PHY IDs
> are readable during the bus scan, that programs the RST_REQ PHY reset
> lines: release the PHYs of used (DSA user) ports and hold all other
> internal PHYs in reset. Driving both directions yields the same state
> regardless of the PS_NOWAIT bootstrap and keeps unused PHYs from staying
> powered.
>
> A single 300ms settle delay is applied only when at least one PHY is
> released.
>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxxxx>
> [...]
> --- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> +++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> @@ -589,6 +589,37 @@ static void gsw150_phylink_get_caps(struct dsa_switch *ds, int port,
> gsw1xx_phylink_get_lpi_caps(config);
> }
>
> +static int gsw1xx_setup(struct dsa_switch *ds)
> +{
> + struct gsw1xx_priv *priv = container_of(ds->priv, struct gsw1xx_priv, gswip);
> + struct gswip_priv *gswip_priv = ds->priv;
> + u32 phy_mask = 0, active_mask = 0;
> + int port, ret;
> +
> + /* Reset bits exist only for the internal-PHY ports preceding the first
> + * MII port.
> + */
> + for (port = 0; port < gswip_priv->hw_info->max_ports; port++) {
> + if (gswip_priv->hw_info->mii_cfg[port] != -1)
> + break;
> +
> + phy_mask |= GSW1XX_RST_REQ_PHY(port);
> +
> + if (dsa_port_is_user(dsa_to_port(ds, port)))
> + active_mask |= GSW1XX_RST_REQ_PHY(port);
> + }
> +
> + ret = regmap_update_bits(priv->shell, GSW1XX_SHELL_RST_REQ, phy_mask,
> + phy_mask & ~active_mask);

```suggestion
~active_mask);
```

regmap_update_bits already applies the mask for you, so applying it
also in the caller is redundant.

With that change applied:
Reviewed-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>