From: Daniel Golle <daniel@makrotopia.org>
To: "A. Sverdlin" <alexander.sverdlin@siemens.com>
Cc: netdev@vger.kernel.org, Hauke Mehrtens <hauke@hauke-m.de>,
Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4] net: dsa: mxl-gsw1xx: force internal PHYs into a known reset state
Date: Tue, 22 Sep 2026 11:53:48 +0100 [thread overview]
Message-ID: <arJePPY2gHpVeIKU@makrotopia.org> (raw)
In-Reply-To: <20260922104124.311334-1-alexander.sverdlin@siemens.com>
On Tue, Sep 22, 2026 at 12:41:22PM +0200, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
>
> 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@siemens.com>
> [...]
> --- 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@makrotopia.org>
prev parent reply other threads:[~2026-09-22 10:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 10:41 A. Sverdlin
2026-09-22 10:53 ` Daniel Golle [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=arJePPY2gHpVeIKU@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=alexander.sverdlin@siemens.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hauke@hauke-m.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®