From: netdev-bot+sashiko@kernel.org
To: joseph@telaak.dev
Cc: hauke@hauke-m.de, andrew@lunn.ch, olteanv@gmail.com,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, daniel@makrotopia.org,
p.zabel@pengutronix.de, netdev@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 2/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios
Date: Wed, 18 Nov 2026 12:33:56 +0000 [thread overview]
Message-ID: <179500523674.3136.3797005435367758007@kernel.org> (raw)
In-Reply-To: <20261115-mxl-gsw1xx-reset-v4-2-4ecd18c922e2@telaak.dev>
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] gsw1xx_probe() (drivers/net/dsa/lantiq/mxl-gsw1xx.c) can skip
the switch reset without logging anything.
- [Low] gsw1xx_probe() pulses the hardware reset on every probe attempt:
assert, fsleep(250000), deassert, fsleep(1000000).
--
net: dsa: mxl-gsw1xx: reset the switch through reset-gpios
This patch gets an optional reset control in gsw1xx_probe() and pulses it
before the first register access. The pulse is 250 ms asserted, then 1 s
before access, which is the timing from the vendor's GSW150 driver. It
also adds imply RESET_GPIO to the Kconfig entry and extends the help text.
> diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> index 0c7ea242a62c2..33b73b2ed5fe7 100644
> --- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> +++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
[ ... ]
> @@ -737,6 +739,30 @@ static int gsw1xx_probe(struct mdio_device *mdiodev)
> if (!priv->gswip.hw_info)
> return -EINVAL;
>
> + /* The MDIO core handles reset-gpios only for PHYs. Reset the switch
> + * here, so it does not run with whatever the bootloader configured.
> + */
> + reset = devm_reset_control_get_optional_exclusive(dev, NULL);
> + if (IS_ERR(reset))
> + return dev_err_probe(dev, PTR_ERR(reset),
> + "failed to get reset control\n");
> +
> + if (reset) {
[Severity: Medium]
If the switch node has reset-gpios, can the reset still be skipped here
with no message at all?
In two configurations, devm_reset_control_get_optional_exclusive()
returns NULL even when reset-gpios is in the DT.
With CONFIG_RESET_CONTROLLER=n, the stub in include/linux/reset.h does:
return optional ? NULL : ERR_PTR(-ENOTSUPP);
With CONFIG_RESET_GPIO=n, __fwnode_reset_control_get() in
drivers/reset/core.c returns before it tries the reset-gpios fallback:
if (!IS_ENABLED(CONFIG_RESET_GPIO))
return optional ? NULL : ERR_PTR(ret);
In both cases the if (reset) branch is not taken. Probe then continues
with the bootloader state. The commit message says this state makes port
0 fail with "failed to connect to PHY: -ENODEV".
The new help text in drivers/net/dsa/lantiq/Kconfig says:
A switch whose hardware reset is described with reset-gpios is
only reset when RESET_GPIO is enabled as well, which this option
does by default.
Is this true for every config? RESET_GPIO is inside "if RESET_CONTROLLER"
and depends on GPIOLIB. RESET_CONTROLLER is only default y if
ARCH_HAS_RESET_CONTROLLER. NET_DSA_MXL_GSW1XX provides neither
dependency, so on x86 or generic MIPS, for example, the imply has no
effect.
The reset-gpios binding added earlier in this series describes it as the
switch's hardware reset input. It also says the slew rates return to
their power-on defaults "after a reset through reset-gpios". A DT that
follows the binding can silently get neither.
Other DSA drivers with a switch-level reset-gpios call
devm_gpiod_get_optional() directly, and that only needs GPIOLIB. Examples
are qca8k-8xxx.c, realtek/rtl83xx.c, mv88e6xxx/chip.c, lan9303-core.c,
vitesse-vsc73xx-core.c, mt7530-mdio.c and ksz_common.c.
Would that approach work here? If not, could probe at least warn or fail
when reset-gpios is present but no reset control was obtained? Could the
help text also name the RESET_CONTROLLER and GPIOLIB dependency?
> + ret = reset_control_assert(reset);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "failed to assert reset\n");
> +
> + fsleep(GSW1XX_RESET_ASSERT_US);
> +
> + ret = reset_control_deassert(reset);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "failed to deassert reset\n");
> +
> + fsleep(GSW1XX_RESET_DEASSERT_US);
> + }
[Severity: Low]
Does this pulse the reset again on every probe attempt after
-EPROBE_DEFER?
The reset runs before gswip_probe_common() reaches dsa_register_switch().
dsa_register_switch() can return -EPROBE_DEFER, for example when the
conduit is not registered yet:
net/dsa/dsa.c:dsa_port_parse_of() {
...
conduit = of_find_net_device_by_node(ethernet);
of_node_put(ethernet);
if (!conduit) {
rtnl_unlock();
return -EPROBE_DEFER;
}
...
}
It also defers when the tagger module is not loaded yet.
For MDIO-attached switches, the conduit is often missing on the first
try. The MAC driver registers its MDIO bus, which probes the switch,
before it calls register_netdev(). That first attempt usually runs inside
the MAC driver's own probe.
Each retry resets the chip again and blocks for another 1.25 s, because
both fsleep() calls become msleep(). The commit message says this timing
is only known for the GSW150. Nothing breaks, since the next attempt
redoes the PCS init and the GPIO pin-mux, so the cost is boot time.
Could the reset be pulsed only once, or could the line state be kept
across probe attempts?
> priv->gswip.gswip = gsw1xx_regmap_init(priv, "switch",
> GSW1XX_SWITCH_BASE, 0xfff);
> if (IS_ERR(priv->gswip.gswip))
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115-mxl-gsw1xx-reset-v4-0-4ecd18c922e2%40telaak.dev
next prev parent reply other threads:[~2026-11-18 12:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 22:33 [PATCH net-next v4 0/2] " Joseph Telaak via B4 Relay
2026-11-15 22:33 ` [PATCH net-next v4 1/2] dt-bindings: net: dsa: lantiq,gswip: add reset-gpios Joseph Telaak via B4 Relay
2026-11-15 22:33 ` [PATCH net-next v4 2/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios Joseph Telaak via B4 Relay
2026-11-18 12:33 ` netdev-bot+sashiko [this message]
2026-11-18 13:07 ` Daniel Golle
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=179500523674.3136.3797005435367758007@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=hauke@hauke-m.de \
--cc=joseph@telaak.dev \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
/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®