Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joseph Telaak" <joseph@telaak.dev>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v2 2/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios
Date: Mon, 09 Nov 2026 23:00:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-205781@kernel.org> (raw)
In-Reply-To: <20261108-mxl-gsw1xx-reset-v2-2-46c1da093893@telaak.dev>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: dsa: mxl-gsw1xx: gsw1xx_probe() uses reset API for
  exclusive reset-gpios
--

commit 911ba1a0c2756adf7ef65c7eabd51481e6dc7a52
Author: Joseph Telaak <joseph@telaak.dev>

net: dsa: mxl-gsw1xx: reset the switch through reset-gpios

This commit asserts and deasserts the switch reset line in gsw1xx_probe()
via the reset controller API before accessing switch registers.

> diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> index a26f78e1a44ce..94a7eff5e0077 100644
> --- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
> +++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c

[ ... ]

> @@ -737,6 +739,29 @@ 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");

[Severity: Medium]
Should gsw1xx_probe() request reset-gpios directly with
devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH) and
gpiod_set_value_cansleep() instead of going through the reset controller
API?

The binding in Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
only defines reset-gpios (not resets) for standalone GSW1xx switches, while
NET_DSA_MXL_GSW1XX in drivers/net/dsa/lantiq/Kconfig does not select or
depend on RESET_GPIO or RESET_CONTROLLER.  When CONFIG_RESET_GPIO is
disabled (it defaults to n), __fwnode_reset_control_get() does not fall
back to reset-gpios and devm_reset_control_get_optional_exclusive()
silently returns NULL, skipping the hardware reset and leaving the switch
in the bootloader-configured state where ports fail with -ENODEV.

Using the reset-gpio wrapper for an exclusive GPIO reset also fails in
__reset_add_reset_gpio_device() when GPIO flags exceed GPIO_ACTIVE_LOW
(-EINVAL) or #gpio-cells is not 2 (-ENOENT), and allocates a persistent
auxiliary device and software node that are never freed on unbind.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261108-mxl-gsw1xx-reset-v2-0-46c1da093893@telaak.dev?part=2

  reply	other threads:[~2026-11-09 23:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08 22:59 [PATCH net-next v2 0/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios Joseph Telaak via B4 Relay
2026-11-08 22:59 ` [PATCH net-next v2 1/2] dt-bindings: net: dsa: lantiq,gswip: add reset-gpios Joseph Telaak via B4 Relay
2026-11-09 23:00   ` sashiko-bot
2026-11-08 22:59 ` [PATCH net-next v2 2/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios Joseph Telaak via B4 Relay
2026-11-09 23:00   ` sashiko-bot [this message]
2026-11-09 23:37   ` netdev-bot+sashiko
2026-11-09 23:45     ` Joseph Telaak

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=sashiko-outbox-205781@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=joseph@telaak.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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