* [PATCH net-next v3 1/2] dt-bindings: net: dsa: lantiq,gswip: add reset-gpios
2026-11-12 21:39 [PATCH net-next v3 0/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios Joseph Telaak via B4 Relay
@ 2026-11-12 21:39 ` Joseph Telaak via B4 Relay
2026-11-12 21:39 ` [PATCH net-next v3 2/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios Joseph Telaak via B4 Relay
2026-11-13 14:08 ` [PATCH net-next v3 0/2] " Andrew Lunn
2 siblings, 0 replies; 5+ messages in thread
From: Joseph Telaak via B4 Relay @ 2026-11-12 21:39 UTC (permalink / raw)
To: Hauke Mehrtens, Andrew Lunn, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Daniel Golle, Philipp Zabel, netdev, devicetree, linux-kernel,
Joseph Telaak
From: Joseph Telaak <joseph@telaak.dev>
The standalone GSW1xx switches have a hardware reset input, and boards
wire it to a SoC GPIO. Allow describing it. The SoC-integrated GSWIP
variants have no such pin.
A reset through it returns the RGMII slew rates to their power-on
defaults, so say so where the slew-rate properties say that the
bootloader's configuration is otherwise preserved.
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Joseph Telaak <joseph@telaak.dev>
---
Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
index 49af5573e4..89f78a1bc1 100644
--- a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
@@ -40,6 +40,11 @@ properties:
- const: mdio
- const: mii
+ reset-gpios:
+ maxItems: 1
+ description:
+ GPIO connected to the hardware reset input of a standalone switch.
+
mdio:
$ref: /schemas/net/mdio.yaml#
unevaluatedProperties: false
@@ -120,7 +125,8 @@ patternProperties:
1: Slow
If not present, the configuration made by the switch bootloader is
- preserved.
+ preserved, or the power-on default after a reset through
+ reset-gpios.
maxlinear,slew-rate-txd:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1]
@@ -131,7 +137,8 @@ patternProperties:
1: Slow
If not present, the configuration made by the switch bootloader is
- preserved.
+ preserved, or the power-on default after a reset through
+ reset-gpios.
maxlinear,rmii-refclk-out:
type: boolean
description:
@@ -173,6 +180,7 @@ allOf:
mdio:
required:
- compatible
+ reset-gpios: false
else:
properties:
reg:
--
Git-155)
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH net-next v3 2/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios
2026-11-12 21:39 [PATCH net-next v3 0/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios Joseph Telaak via B4 Relay
2026-11-12 21:39 ` [PATCH net-next v3 1/2] dt-bindings: net: dsa: lantiq,gswip: add reset-gpios Joseph Telaak via B4 Relay
@ 2026-11-12 21:39 ` Joseph Telaak via B4 Relay
2026-11-13 14:08 ` [PATCH net-next v3 0/2] " Andrew Lunn
2 siblings, 0 replies; 5+ messages in thread
From: Joseph Telaak via B4 Relay @ 2026-11-12 21:39 UTC (permalink / raw)
To: Hauke Mehrtens, Andrew Lunn, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Daniel Golle, Philipp Zabel, netdev, devicetree, linux-kernel,
Joseph Telaak
From: Joseph Telaak <joseph@telaak.dev>
The switch keeps the configuration the bootloader left in it, and the
driver never resets it. The MDIO core asserts and releases reset-gpios
only for PHY devices, so a reset line described on the switch node has
no effect either.
On the GL.iNet GL-SFT1200 the bootloader leaves each internal PHY of
the GSW150 one MDIO address above its port. Port 0 then fails with
"failed to connect to PHY: -ENODEV", and the PHY that answers at a
port's address belongs to the neighboring port. After a hardware reset
every PHY is back at its port's address and all ports work.
Get the reset through the reset controller API and pulse it before the
first register access. The reset core hands a reset-gpios property to
the reset-gpio driver, so a board that wires the reset this way needs
CONFIG_RESET_GPIO; without it the reset is skipped. The timing follows
the vendor's driver for the GSW150: asserted for 250 ms, then 1 s before
the switch is accessed.
The reset also returns the RGMII slew rates to their power-on defaults,
so a board that uses reset-gpios sets the ones it needs in its device
tree.
Signed-off-by: Joseph Telaak <joseph@telaak.dev>
---
drivers/net/dsa/lantiq/mxl-gsw1xx.c | 26 ++++++++++++++++++++++++++
drivers/net/dsa/lantiq/mxl-gsw1xx.h | 4 ++++
2 files changed, 30 insertions(+)
diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
index a26f78e1a4..f69856a65b 100644
--- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c
+++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c
@@ -18,6 +18,7 @@
#include <linux/phy/phy-common-props.h>
#include <linux/property.h>
#include <linux/regmap.h>
+#include <linux/reset.h>
#include <linux/workqueue.h>
#include <net/dsa.h>
@@ -719,6 +720,7 @@ static int gsw1xx_serdes_pcs_init(struct gsw1xx_priv *priv)
static int gsw1xx_probe(struct mdio_device *mdiodev)
{
struct device *dev = &mdiodev->dev;
+ struct reset_control *reset;
struct gsw1xx_priv *priv;
u32 version, val;
u8 shellver;
@@ -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) {
+ 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);
+ }
+
priv->gswip.gswip = gsw1xx_regmap_init(priv, "switch",
GSW1XX_SWITCH_BASE, 0xfff);
if (IS_ERR(priv->gswip.gswip))
diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.h b/drivers/net/dsa/lantiq/mxl-gsw1xx.h
index 81bc00eabb..bca8e3223c 100644
--- a/drivers/net/dsa/lantiq/mxl-gsw1xx.h
+++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.h
@@ -19,6 +19,10 @@
#define GSW1XX_SYS_CLK_FREQ 340000000
+/* Hardware reset timing of the vendor's driver for the GSW150 */
+#define GSW1XX_RESET_ASSERT_US 250000
+#define GSW1XX_RESET_DEASSERT_US 1000000
+
/* SMDIO switch register base address */
#define GSW1XX_SMDIO_BADR 0x1f
#define GSW1XX_SMDIO_BADR_UNKNOWN -1
--
Git-155)
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next v3 0/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios
2026-11-12 21:39 [PATCH net-next v3 0/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios Joseph Telaak via B4 Relay
2026-11-12 21:39 ` [PATCH net-next v3 1/2] dt-bindings: net: dsa: lantiq,gswip: add reset-gpios Joseph Telaak via B4 Relay
2026-11-12 21:39 ` [PATCH net-next v3 2/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios Joseph Telaak via B4 Relay
@ 2026-11-13 14:08 ` Andrew Lunn
2026-11-13 15:10 ` Daniel Golle
2 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2026-11-13 14:08 UTC (permalink / raw)
To: joseph
Cc: Hauke Mehrtens, Vladimir Oltean, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Daniel Golle, Philipp Zabel, netdev, devicetree,
linux-kernel
> This is separate from commit 82e2c7db0830 ("net: dsa: mxl-gsw1xx: force
> internal PHYs into a known reset state"), which only programs the PHY
> bits of RST_REQ. On this board that commit is applied, and the PHYs still
> sit at the shifted addresses; only a hardware reset of the switch moves
> them back.
I don't think 82e2c7db0830 is relevant here. The commit message says
nothing about the address of the PHY.
How does the bootloader change the address? I assume there is a
register it writes?
Is there a comment about why it changes the address?
Does the driver have an implicit assumption about the addresses of the
PHYs? Should the driver actually be writing this register to put the
PHYs at the expected address?
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net-next v3 0/2] net: dsa: mxl-gsw1xx: reset the switch through reset-gpios
2026-11-13 14:08 ` [PATCH net-next v3 0/2] " Andrew Lunn
@ 2026-11-13 15:10 ` Daniel Golle
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Golle @ 2026-11-13 15:10 UTC (permalink / raw)
To: Andrew Lunn
Cc: joseph, Hauke Mehrtens, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel, netdev,
devicetree, linux-kernel
On Fri, Nov 13, 2026 at 03:08:10PM +0100, Andrew Lunn wrote:
> > This is separate from commit 82e2c7db0830 ("net: dsa: mxl-gsw1xx: force
> > internal PHYs into a known reset state"), which only programs the PHY
> > bits of RST_REQ. On this board that commit is applied, and the PHYs still
> > sit at the shifted addresses; only a hardware reset of the switch moves
> > them back.
>
> I don't think 82e2c7db0830 is relevant here. The commit message says
> nothing about the address of the PHY.
>
> How does the bootloader change the address? I assume there is a
> register it writes?
Yes.
PHY_ADDR_{0,1,2,3,4,5} at offsets 0xF415, 0xF414, 0xF413, 0xF412,
0xF411, 0xF410 (ie. reverse order). Bits 4:0 are the address of the
respective built-in PHY.
>
> Is there a comment about why it changes the address?
I *guess* that in this case the vendor wants to avoid using PHY
address 0 which is widely misunderstood as being the "broadcast
address" (which it is, but only in scope of AUI attachments and SFP
modules). I know many people who get upset about using PHY address 0
for an actual PHY rather than reserving it as a broadcast address all
PHYs on the bus are listening on...
The switch also has it's own MDIO master interface exposed on external
pins which is shared with the internal PHYs. Hence programming the
addresses of the built-in PHYs can be done in order to accomodate
external PHYs on the same bus which may not be free to use arbitrary
addresses.
>
> Does the driver have an implicit assumption about the addresses of the
> PHYs? Should the driver actually be writing this register to put the
> PHYs at the expected address?
The driver does what is described in the device tree. Ie. boot firmware
applying a non-default PHY addresses should just say so in the DT passed
to Linux imho.
See also Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
^ permalink raw reply [flat|nested] 5+ messages in thread