* [PATCH v2 0/2] w5100: restore GPIO-based link detection
@ 2026-08-04 17:40 Arthur Crépin Leblond
2026-08-04 17:40 ` [PATCH v2 1/2] " Arthur Crépin Leblond
2026-08-04 17:40 ` [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML Arthur Crépin Leblond
0 siblings, 2 replies; 11+ messages in thread
From: Arthur Crépin Leblond @ 2026-08-04 17:40 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: Arnd Bergmann, netdev, devicetree, linux-kernel,
Arthur Crépin Leblond
Hi,
I am using the W5500 on a Raspberry Pi and rely on the link GPIO for
the carrier detection.
If we could bring it back, I would greatly appreciate.
Thank you!
Arthur Crépin Leblond
Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net>
---
Changes in v2:
- Convert device tree binding to YAML
- Use devm_request_threaded_irq instead of request_any_context_irq
- Use devm_gpiod_get_optional instead of gpiod_get_optional
- Call dev_err_probe on gpiod_to_irq failure
- Remove link_irq from priv
- Use a fixed string for the IRQ name
- Remove empty new lines
- Link to v1: https://patch.msgid.link/20260804-wiznet-link-gpio-v1-1-b626fd4f7ccb@marmottus.net
---
Arthur Crépin Leblond (2):
w5100: restore GPIO-based link detection
dt-bindings: net: convert wiznet,w5x00 to YAML
.../devicetree/bindings/net/wiznet,w5x00.txt | 50 ----------
.../devicetree/bindings/net/wiznet,w5x00.yaml | 103 +++++++++++++++++++++
drivers/net/ethernet/wiznet/w5100.c | 71 ++++++++++++++
3 files changed, 174 insertions(+), 50 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v2 1/2] w5100: restore GPIO-based link detection 2026-08-04 17:40 [PATCH v2 0/2] w5100: restore GPIO-based link detection Arthur Crépin Leblond @ 2026-08-04 17:40 ` Arthur Crépin Leblond 2026-08-04 18:44 ` Arnd Bergmann ` (2 more replies) 2026-08-04 17:40 ` [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML Arthur Crépin Leblond 1 sibling, 3 replies; 11+ messages in thread From: Arthur Crépin Leblond @ 2026-08-04 17:40 UTC (permalink / raw) To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: Arnd Bergmann, netdev, devicetree, linux-kernel, Arthur Crépin Leblond Commit dacf281771a9 ("w5100: remove unused gpio link detection") dropped the link_gpio/link_irq handling on the grounds that no devicetree user passed a "link" GPIO at the time. This isn't a plain revert of that removal. The link GPIO is now bound from the device tree link-gpios property using the resource managed GPIO descriptors. The link IRQ is also requested with devm_request_threaded_irq() instead of request_any_context_irq(), so it is released automatically on driver removal or probe failure. Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net> --- drivers/net/ethernet/wiznet/w5100.c | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c index 53d8dc642fbd..1410a9fcfa92 100644 --- a/drivers/net/ethernet/wiznet/w5100.c +++ b/drivers/net/ethernet/wiznet/w5100.c @@ -22,6 +22,7 @@ #include <linux/ioport.h> #include <linux/interrupt.h> #include <linux/irq.h> +#include <linux/gpio/consumer.h> #include "w5100.h" @@ -154,6 +155,7 @@ struct w5100_priv { u16 s0_rx_buf_size; int irq; + struct gpio_desc *link_gpio; struct napi_struct napi; struct net_device *ndev; @@ -414,6 +416,16 @@ static void w5100_get_drvinfo(struct net_device *ndev, sizeof(info->bus_info)); } +static u32 w5100_get_link(struct net_device *ndev) +{ + struct w5100_priv *priv = netdev_priv(ndev); + + if (priv->link_gpio) + return !!gpiod_get_value_cansleep(priv->link_gpio); + + return 1; +} + static u32 w5100_get_msglevel(struct net_device *ndev) { struct w5100_priv *priv = netdev_priv(ndev); @@ -616,6 +628,24 @@ static irqreturn_t w5100_interrupt(int irq, void *ndev_instance) return IRQ_HANDLED; } +static irqreturn_t w5100_detect_link(int irq, void *ndev_instance) +{ + struct net_device *ndev = ndev_instance; + struct w5100_priv *priv = netdev_priv(ndev); + + if (netif_running(ndev)) { + if (gpiod_get_value(priv->link_gpio) != 0) { + netif_info(priv, link, ndev, "link is up\n"); + netif_carrier_on(ndev); + } else { + netif_info(priv, link, ndev, "link is down\n"); + netif_carrier_off(ndev); + } + } + + return IRQ_HANDLED; +} + static void w5100_setrx_work(struct work_struct *work) { struct w5100_priv *priv = container_of(work, struct w5100_priv, @@ -659,6 +689,14 @@ static int w5100_open(struct net_device *ndev) w5100_hw_start(priv); napi_enable(&priv->napi); netif_start_queue(ndev); + + if (priv->link_gpio) { + if (gpiod_get_value_cansleep(priv->link_gpio) != 0) + netif_carrier_on(ndev); + else + netif_carrier_off(ndev); + } + return 0; } @@ -678,6 +716,7 @@ static const struct ethtool_ops w5100_ethtool_ops = { .get_drvinfo = w5100_get_drvinfo, .get_msglevel = w5100_get_msglevel, .set_msglevel = w5100_set_msglevel, + .get_link = w5100_get_link, .get_regs_len = w5100_get_regs_len, .get_regs = w5100_get_regs, }; @@ -751,6 +790,13 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops, priv->ndev = ndev; priv->ops = ops; priv->irq = irq; + priv->link_gpio = devm_gpiod_get_optional(dev, "link", GPIOD_IN); + if (IS_ERR(priv->link_gpio)) { + err = dev_err_probe(dev, PTR_ERR(priv->link_gpio), + "failed to get link GPIO\n"); + priv->link_gpio = NULL; + goto err_register; + } ndev->netdev_ops = &w5100_netdev_ops; ndev->ethtool_ops = &w5100_ethtool_ops; @@ -803,8 +849,29 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops, if (err) goto err_hw; + if (priv->link_gpio) { + int link_irq = gpiod_to_irq(priv->link_gpio); + + if (link_irq < 0) { + err = dev_err_probe(dev, link_irq, + "No corresponding irq for link gpio\n"); + goto err_gpio; + } + + err = devm_request_threaded_irq(dev, link_irq, NULL, + w5100_detect_link, + IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, + "w5100-link", priv->ndev); + if (err < 0) + goto err_gpio; + } + return 0; +err_gpio: + free_irq(priv->irq, ndev); err_hw: destroy_workqueue(priv->xfer_wq); err_wq: @@ -857,6 +924,10 @@ static int w5100_resume(struct device *dev) w5100_hw_start(priv); netif_device_attach(ndev); + + if (!priv->link_gpio || + gpiod_get_value_cansleep(priv->link_gpio) != 0) + netif_carrier_on(ndev); } return 0; } -- 2.55.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/2] w5100: restore GPIO-based link detection 2026-08-04 17:40 ` [PATCH v2 1/2] " Arthur Crépin Leblond @ 2026-08-04 18:44 ` Arnd Bergmann 2026-08-04 20:58 ` Jakub Kicinski 2026-08-05 17:58 ` sashiko-bot 2 siblings, 0 replies; 11+ messages in thread From: Arnd Bergmann @ 2026-08-04 18:44 UTC (permalink / raw) To: Arthur Crépin Leblond, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: Netdev, devicetree, linux-kernel On Tue, Aug 4, 2026, at 19:40, Arthur Crépin Leblond wrote: > Commit dacf281771a9 ("w5100: remove unused gpio link detection") > dropped the link_gpio/link_irq handling on the grounds that no > devicetree user passed a "link" GPIO at the time. > > This isn't a plain revert of that removal. The link GPIO is now > bound from the device tree link-gpios property using the resource > managed GPIO descriptors. > > The link IRQ is also requested with devm_request_threaded_irq() > instead of request_any_context_irq(), so it is released automatically > on driver removal or probe failure. > > Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net> Reviewed-by: Arnd Bergmann <arnd@arndb.de> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/2] w5100: restore GPIO-based link detection 2026-08-04 17:40 ` [PATCH v2 1/2] " Arthur Crépin Leblond 2026-08-04 18:44 ` Arnd Bergmann @ 2026-08-04 20:58 ` Jakub Kicinski 2026-08-05 7:56 ` Arnd Bergmann 2026-08-05 17:58 ` sashiko-bot 2 siblings, 1 reply; 11+ messages in thread From: Jakub Kicinski @ 2026-08-04 20:58 UTC (permalink / raw) To: Arthur Crépin Leblond Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann, netdev, devicetree, linux-kernel On Tue, 04 Aug 2026 19:40:56 +0200 Arthur Crépin Leblond wrote: > Commit dacf281771a9 ("w5100: remove unused gpio link detection") Sounds like a fix, so the two patches should probably travel separately, the fix with a Fixes tag and more explanation (what you have in the cover letter and more) in the message. And the conversion should travel via net-next. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/2] w5100: restore GPIO-based link detection 2026-08-04 20:58 ` Jakub Kicinski @ 2026-08-05 7:56 ` Arnd Bergmann 0 siblings, 0 replies; 11+ messages in thread From: Arnd Bergmann @ 2026-08-05 7:56 UTC (permalink / raw) To: Jakub Kicinski, Arthur Crépin Leblond Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Netdev, devicetree, linux-kernel On Tue, Aug 4, 2026, at 22:58, Jakub Kicinski wrote: > On Tue, 04 Aug 2026 19:40:56 +0200 Arthur Crépin Leblond wrote: >> Commit dacf281771a9 ("w5100: remove unused gpio link detection") > > Sounds like a fix, so the two patches should probably travel separately, > the fix with a Fixes tag and more explanation (what you have in the > cover letter and more) in the message. > > And the conversion should travel via net-next. It's not really a fix for my patch though: the original code never worked on mainline kernels because the w5100_spi_probe() function always passed -EINVAL as the gpio number since it was first added in 630cf09751fe ("net: w5100: support SPI interface mode"). Arthur correctly adds support for the link gpio line using DT probing. I would suggest rewording the patch description to clarify this by describing what the added code does first before mentioning the removal of the old version. Arnd ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/2] w5100: restore GPIO-based link detection 2026-08-04 17:40 ` [PATCH v2 1/2] " Arthur Crépin Leblond 2026-08-04 18:44 ` Arnd Bergmann 2026-08-04 20:58 ` Jakub Kicinski @ 2026-08-05 17:58 ` sashiko-bot 2 siblings, 0 replies; 11+ messages in thread From: sashiko-bot @ 2026-08-05 17:58 UTC (permalink / raw) To: Arthur Crépin Leblond; +Cc: devicetree, conor+dt, robh Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] The devm-managed link IRQ outlives the manually freed network device, leading to a Use-After-Free in the interrupt handler during driver removal. - [Medium] The threaded interrupt handler uses the non-sleepable `gpiod_get_value()` instead of `gpiod_get_value_cansleep()`, which will trigger a kernel WARNING if the GPIO chip can sleep. - [Medium] Race condition between the initial link state check in `w5100_open` and the edge-triggered link IRQ, leading to a desynchronized carrier state. -- --- Patch [1]: [PATCH v2 1/2] w5100: restore GPIO-based link detection --- commit 48dd7a12d64614af31aae8617e2d9b17300b7e8a Author: Arthur Crépin Leblond <arthur@marmottus.net> w5100: restore GPIO-based link detection Commit dacf281771a9 ("w5100: remove unused gpio link detection") dropped the link_gpio/link_irq handling on the grounds that no devicetree user passed a "link" GPIO at the time. This isn't a plain revert of that removal. The link GPIO is now bound from the device tree link-gpios property using the resource managed GPIO descriptors. The link IRQ is also requested with devm_request_threaded_irq() instead of request_any_context_irq(), so it is released automatically on driver removal or probe failure. > diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c > index 53d8dc642fbd6..1410a9fcfa921 100644 > --- a/drivers/net/ethernet/wiznet/w5100.c > +++ b/drivers/net/ethernet/wiznet/w5100.c [ ... ] > @@ -616,6 +628,24 @@ static irqreturn_t w5100_interrupt(int irq, void *ndev_instance) > return IRQ_HANDLED; > } > > +static irqreturn_t w5100_detect_link(int irq, void *ndev_instance) > +{ > + struct net_device *ndev = ndev_instance; > + struct w5100_priv *priv = netdev_priv(ndev); > + > + if (netif_running(ndev)) { > + if (gpiod_get_value(priv->link_gpio) != 0) { [Severity: Medium] Will this trigger a warning if the GPIO controller can sleep? Since w5100_detect_link() is registered as a threaded IRQ handler, it is allowed to sleep. If the underlying GPIO controller is sleepable (like an I2C or SPI expander), using the non-sleepable gpiod_get_value() will trigger a WARN_ON. Should this use gpiod_get_value_cansleep() instead? > + netif_info(priv, link, ndev, "link is up\n"); > + netif_carrier_on(ndev); > + } else { > + netif_info(priv, link, ndev, "link is down\n"); > + netif_carrier_off(ndev); > + } > + } > + > + return IRQ_HANDLED; > +} > + [ ... ] > @@ -659,6 +689,14 @@ static int w5100_open(struct net_device *ndev) > w5100_hw_start(priv); > napi_enable(&priv->napi); > netif_start_queue(ndev); > + > + if (priv->link_gpio) { > + if (gpiod_get_value_cansleep(priv->link_gpio) != 0) > + netif_carrier_on(ndev); > + else > + netif_carrier_off(ndev); > + } > + [Severity: Medium] Can this race with the w5100_detect_link() IRQ handler? If a physical link change triggers an interrupt right after the GPIO value is read but before netif_carrier_on/off is called, the IRQ handler will run and correctly update the carrier state. Once the IRQ handler completes, w5100_open() will continue and overwrite the carrier state with the stale value it read earlier. Because the link IRQ is edge-triggered, no further interrupts will correct this desynchronization. > return 0; > } [ ... ] > @@ -803,8 +849,29 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops, > if (err) > goto err_hw; > > + if (priv->link_gpio) { > + int link_irq = gpiod_to_irq(priv->link_gpio); > + > + if (link_irq < 0) { > + err = dev_err_probe(dev, link_irq, > + "No corresponding irq for link gpio\n"); > + goto err_gpio; > + } > + > + err = devm_request_threaded_irq(dev, link_irq, NULL, > + w5100_detect_link, > + IRQF_TRIGGER_RISING | > + IRQF_TRIGGER_FALLING | > + IRQF_ONESHOT, > + "w5100-link", priv->ndev); [Severity: High] Does this introduce a Use-After-Free during driver removal? Since devm_request_threaded_irq() is used, the IRQ is automatically released by devres after the driver's remove function returns. However, w5100_remove() manually frees the network device: drivers/net/ethernet/wiznet/w5100.c:w5100_remove() { ... unregister_netdev(ndev); free_netdev(ndev); } If a link interrupt fires after free_netdev() but before devres cleans up the IRQ, w5100_detect_link() will be called and dereference the freed ndev pointer. > + if (err < 0) > + goto err_gpio; > + } > + > return 0; -- Sashiko AI review · https://sashiko.dev/#/patchset/20260804-wiznet-link-gpio-v2-0-3b1d0c870f35@marmottus.net?part=1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML 2026-08-04 17:40 [PATCH v2 0/2] w5100: restore GPIO-based link detection Arthur Crépin Leblond 2026-08-04 17:40 ` [PATCH v2 1/2] " Arthur Crépin Leblond @ 2026-08-04 17:40 ` Arthur Crépin Leblond 2026-08-04 18:49 ` Rob Herring (Arm) ` (2 more replies) 1 sibling, 3 replies; 11+ messages in thread From: Arthur Crépin Leblond @ 2026-08-04 17:40 UTC (permalink / raw) To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: Arnd Bergmann, netdev, devicetree, linux-kernel, Arthur Crépin Leblond Convert the Wiznet w5x00 SPI Ethernet controller binding from text to DT schema format. Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net> --- .../devicetree/bindings/net/wiznet,w5x00.txt | 50 ---------- .../devicetree/bindings/net/wiznet,w5x00.yaml | 103 +++++++++++++++++++++ 2 files changed, 103 insertions(+), 50 deletions(-) diff --git a/Documentation/devicetree/bindings/net/wiznet,w5x00.txt b/Documentation/devicetree/bindings/net/wiznet,w5x00.txt deleted file mode 100644 index e9665798c4be..000000000000 --- a/Documentation/devicetree/bindings/net/wiznet,w5x00.txt +++ /dev/null @@ -1,50 +0,0 @@ -* Wiznet w5x00 - -This is a standalone 10/100 MBit Ethernet controller with SPI interface. - -For each device connected to a SPI bus, define a child node within -the SPI master node. - -Required properties: -- compatible: Should be one of the following strings: - "wiznet,w5100" - "wiznet,w5200" - "wiznet,w5500" -- reg: Specify the SPI chip select the chip is wired to. -- interrupts: Specify the interrupt index within the interrupt controller (referred - to above in interrupt-parent) and interrupt type. w5x00 natively - generates falling edge interrupts, however, additional board logic - might invert the signal. -- pinctrl-names: List of assigned state names, see pinctrl binding documentation. -- pinctrl-0: List of phandles to configure the GPIO pin used as interrupt line, - see also generic and your platform specific pinctrl binding - documentation. - -Optional properties: -- spi-max-frequency: Maximum frequency of the SPI bus when accessing the w5500. - According to the w5500 datasheet, the chip allows a maximum of 80 MHz, however, - board designs may need to limit this value. -- local-mac-address: See ethernet.txt in the same directory. - - -Example (for Raspberry Pi with pin control stuff for GPIO irq): - -&spi { - ethernet@0: w5500@0 { - compatible = "wiznet,w5500"; - reg = <0>; - pinctrl-names = "default"; - pinctrl-0 = <ð1_pins>; - interrupt-parent = <&gpio>; - interrupts = <25 IRQ_TYPE_EDGE_FALLING>; - spi-max-frequency = <30000000>; - }; -}; - -&gpio { - eth1_pins: eth1_pins { - brcm,pins = <25>; - brcm,function = <0>; /* in */ - brcm,pull = <0>; /* none */ - }; -}; diff --git a/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml b/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml new file mode 100644 index 000000000000..8f45a5d773fe --- /dev/null +++ b/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml @@ -0,0 +1,103 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/wiznet,w5x00.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Wiznet w5x00 SPI Ethernet Controller + +description: | + This is a standalone 10/100 MBit Ethernet controller with SPI interface. + + For each device connected to a SPI bus, define a child node within the SPI master node. + +allOf: + - $ref: /schemas/net/ethernet-controller.yaml# + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + enum: + - wiznet,w5100 + - wiznet,w5200 + - wiznet,w5500 + + reg: + description: Specify the SPI chip select the chip is wired to. + maxItems: 1 + minItems: 1 + + interrupts: + description: + Specify the interrupt index within the interrupt controller (referred to + above in interrupt-parent) and interrupt type. w5x00 natively generates + falling edge interrupts, however, additional board logic might invert the + signal. + maxItems: 1 + minItems: 1 + + pinctrl-names: + description: + List of assigned state names, see pinctrl binding documentation. + enum: + - default + minItems: 1 + + pinctrl-0: + description: + List of phandles to configure the GPIO pin used as interrupt line, see + also generic and your platform specific pinctrl binding documentation. + minItems: 1 + + local-mac-address: true + + spi-max-frequency: + description: + Maximum frequency of the SPI bus when accessing the w5500. According to + the w5500 datasheet, the chip allows a maximum of 80 MHz, however, board + designs may need to limit this value. + maximum: 80000000 + + link-gpios: + description: A GPIO line used for the link detection interrupt. + maxItems: 1 + +required: + - compatible + - reg + - interrupts + - pinctrl-names + - pinctrl-0 + +unevaluatedProperties: false + +examples: + - | + /* Example (for Raspberry Pi with pin control stuff for GPIO irq) */ + + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/interrupt-controller/irq.h> + + spi { + #address-cells = <1>; + #size-cells = <0>; + + ethernet@0: w5500@0 { + compatible = "wiznet,w5500"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <ð1_pins>; + interrupt-parent = <&gpio>; + interrupts = <25 IRQ_TYPE_EDGE_FALLING>; + spi-max-frequency = <30000000>; + link-gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + local-mac-address = [ a0 b0 c0 d0 e0 f0 ]; + }; + }; + + &gpio { + eth1_pins: eth1_pins { + brcm,pins = <25 4>; + brcm,function = <0 0>; /* in */ + brcm,pull = <0 0>; /* none */ + }; -- 2.55.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML 2026-08-04 17:40 ` [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML Arthur Crépin Leblond @ 2026-08-04 18:49 ` Rob Herring (Arm) 2026-08-05 11:08 ` Krzysztof Kozlowski 2026-08-05 17:58 ` sashiko-bot 2 siblings, 0 replies; 11+ messages in thread From: Rob Herring (Arm) @ 2026-08-04 18:49 UTC (permalink / raw) To: Arthur Crépin Leblond Cc: Arnd Bergmann, Andrew Lunn, devicetree, Krzysztof Kozlowski, netdev, Conor Dooley, David S. Miller, linux-kernel, Paolo Abeni, Eric Dumazet, Jakub Kicinski On Tue, 04 Aug 2026 19:40:57 +0200, Arthur Crépin Leblond wrote: > Convert the Wiznet w5x00 SPI Ethernet controller binding from > text to DT schema format. > > Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net> > --- > .../devicetree/bindings/net/wiznet,w5x00.txt | 50 ---------- > .../devicetree/bindings/net/wiznet,w5x00.yaml | 103 +++++++++++++++++++++ > 2 files changed, 103 insertions(+), 50 deletions(-) > My bot found errors running 'make dt_binding_check' on your patch: yamllint warnings/errors: dtschema/dtc warnings/errors: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml: properties:pinctrl-names: 'enum' should not be valid under {'enum': ['const', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'minimum', 'maximum', 'multipleOf', 'pattern']} hint: Scalar and array keywords cannot be mixed from schema $id: http://devicetree.org/meta-schemas/keywords.yaml /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml: 'maintainers' is a required property hint: Metaschema for devicetree binding documentation from schema $id: http://devicetree.org/meta-schemas/base.yaml /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml: properties:reg: 'anyOf' conditional failed, one must be fixed: 'minItems' is not one of ['maxItems', 'description', 'deprecated'] hint: Only "maxItems" is required for a single entry if there are no constraints defined for the values. 'maxItems' is not one of ['description', 'deprecated', 'const', 'enum', 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf'] 'minItems' is not one of ['description', 'deprecated', 'const', 'enum', 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf'] 1 is less than the minimum of 2 hint: Arrays must be described with a combination of minItems/maxItems/items hint: cell array properties must define how many entries and what the entries are when there is more than one entry. from schema $id: http://devicetree.org/meta-schemas/cell.yaml /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml: properties:interrupts: 'anyOf' conditional failed, one must be fixed: 'minItems' is not one of ['maxItems', 'description', 'deprecated'] hint: Only "maxItems" is required for a single entry if there are no constraints defined for the values. 'maxItems' is not one of ['description', 'deprecated', 'const', 'enum', 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf'] 'minItems' is not one of ['description', 'deprecated', 'const', 'enum', 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf'] 1 is less than the minimum of 2 hint: Arrays must be described with a combination of minItems/maxItems/items hint: cell array properties must define how many entries and what the entries are when there is more than one entry. from schema $id: http://devicetree.org/meta-schemas/cell.yaml Error: Documentation/devicetree/bindings/net/wiznet,w5x00.example.dts:33.23-24 syntax error FATAL ERROR: Unable to parse input tree make[2]: *** [scripts/Makefile.dtbs:140: Documentation/devicetree/bindings/net/wiznet,w5x00.example.dtb] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1703: dt_binding_check] Error 2 make: *** [Makefile:248: __sub-make] Error 2 doc reference errors (make refcheckdocs): See https://patchwork.kernel.org/project/devicetree/patch/20260804-wiznet-link-gpio-v2-2-3b1d0c870f35@marmottus.net The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML 2026-08-04 17:40 ` [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML Arthur Crépin Leblond 2026-08-04 18:49 ` Rob Herring (Arm) @ 2026-08-05 11:08 ` Krzysztof Kozlowski 2026-08-05 17:23 ` Arthur Crépin Leblond 2026-08-05 17:58 ` sashiko-bot 2 siblings, 1 reply; 11+ messages in thread From: Krzysztof Kozlowski @ 2026-08-05 11:08 UTC (permalink / raw) To: Arthur Crépin Leblond, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: Arnd Bergmann, netdev, devicetree, linux-kernel On 04/08/2026 19:40, Arthur Crépin Leblond wrote: > Convert the Wiznet w5x00 SPI Ethernet controller binding from > text to DT schema format. Limited review, to spare you one review cycle, as it was not tested. Subject: s/YAML/DT schema/ See also: https://elixir.bootlin.com/linux/v7.1-rc7/source/Documentation/devicetree/bindings/submitting-patches.rst#L23 > > Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net> > --- > .../devicetree/bindings/net/wiznet,w5x00.txt | 50 ---------- > .../devicetree/bindings/net/wiznet,w5x00.yaml | 103 +++++++++++++++++++++ > 2 files changed, 103 insertions(+), 50 deletions(-) > > diff --git a/Documentation/devicetree/bindings/net/wiznet,w5x00.txt b/Documentation/devicetree/bindings/net/wiznet,w5x00.txt > deleted file mode 100644 > index e9665798c4be..000000000000 > --- a/Documentation/devicetree/bindings/net/wiznet,w5x00.txt > +++ /dev/null > @@ -1,50 +0,0 @@ > -* Wiznet w5x00 > - > -This is a standalone 10/100 MBit Ethernet controller with SPI interface. > - > -For each device connected to a SPI bus, define a child node within > -the SPI master node. > - > -Required properties: > -- compatible: Should be one of the following strings: > - "wiznet,w5100" > - "wiznet,w5200" > - "wiznet,w5500" > -- reg: Specify the SPI chip select the chip is wired to. > -- interrupts: Specify the interrupt index within the interrupt controller (referred > - to above in interrupt-parent) and interrupt type. w5x00 natively > - generates falling edge interrupts, however, additional board logic > - might invert the signal. > -- pinctrl-names: List of assigned state names, see pinctrl binding documentation. > -- pinctrl-0: List of phandles to configure the GPIO pin used as interrupt line, > - see also generic and your platform specific pinctrl binding > - documentation. > - > -Optional properties: > -- spi-max-frequency: Maximum frequency of the SPI bus when accessing the w5500. > - According to the w5500 datasheet, the chip allows a maximum of 80 MHz, however, > - board designs may need to limit this value. > -- local-mac-address: See ethernet.txt in the same directory. > - > - > -Example (for Raspberry Pi with pin control stuff for GPIO irq): > - > -&spi { > - ethernet@0: w5500@0 { > - compatible = "wiznet,w5500"; > - reg = <0>; > - pinctrl-names = "default"; > - pinctrl-0 = <ð1_pins>; > - interrupt-parent = <&gpio>; > - interrupts = <25 IRQ_TYPE_EDGE_FALLING>; > - spi-max-frequency = <30000000>; > - }; > -}; > - > -&gpio { > - eth1_pins: eth1_pins { > - brcm,pins = <25>; > - brcm,function = <0>; /* in */ > - brcm,pull = <0>; /* none */ > - }; > -}; > diff --git a/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml b/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml > new file mode 100644 > index 000000000000..8f45a5d773fe > --- /dev/null > +++ b/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml Filename: wiznet,w5100.yaml > @@ -0,0 +1,103 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/net/wiznet,w5x00.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Wiznet w5x00 SPI Ethernet Controller > + > +description: | > + This is a standalone 10/100 MBit Ethernet controller with SPI interface. > + > + For each device connected to a SPI bus, define a child node within the SPI master node. This looks unwrapped (see Linux coding style). > + > +allOf: > + - $ref: /schemas/net/ethernet-controller.yaml# > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +properties: > + compatible: > + enum: > + - wiznet,w5100 > + - wiznet,w5200 > + - wiznet,w5500 > + > + reg: > + description: Specify the SPI chip select the chip is wired to. > + maxItems: 1 > + minItems: 1 Drop, please do not invent your own syntax. Look at recently reviewed code or example-schema. > + > + interrupts: > + description: > + Specify the interrupt index within the interrupt controller (referred to > + above in interrupt-parent) and interrupt type. w5x00 natively generates > + falling edge interrupts, however, additional board logic might invert the > + signal. > + maxItems: 1 > + minItems: 1 > + > + pinctrl-names: > + description: > + List of assigned state names, see pinctrl binding documentation. > + enum: > + - default > + minItems: 1 Do not invent own code. Drop > + > + pinctrl-0: > + description: > + List of phandles to configure the GPIO pin used as interrupt line, see > + also generic and your platform specific pinctrl binding documentation. > + minItems: 1 > + > + local-mac-address: true > + > + spi-max-frequency: > + description: > + Maximum frequency of the SPI bus when accessing the w5500. According to > + the w5500 datasheet, the chip allows a maximum of 80 MHz, however, board > + designs may need to limit this value. > + maximum: 80000000 > + > + link-gpios: > + description: A GPIO line used for the link detection interrupt. > + maxItems: 1 This wasn't in the original binding and lacks explanation in commit msg. Any change done to the binding must be documented with a reason WHY. If there is no reason WHY, then maybe you wanted separate commit (although each commit should explain WHY). > + > +required: > + - compatible > + - reg > + - interrupts > + - pinctrl-names > + - pinctrl-0 > + > +unevaluatedProperties: false > + > +examples: > + - | > + /* Example (for Raspberry Pi with pin control stuff for GPIO irq) */ > + > + #include <dt-bindings/gpio/gpio.h> > + #include <dt-bindings/interrupt-controller/irq.h> > + > + spi { > + #address-cells = <1>; > + #size-cells = <0>; > + > + ethernet@0: w5500@0 { > + compatible = "wiznet,w5500"; > + reg = <0>; > + pinctrl-names = "default"; Messed indentation. > + pinctrl-0 = <ð1_pins>; > + interrupt-parent = <&gpio>; > + interrupts = <25 IRQ_TYPE_EDGE_FALLING>; > + spi-max-frequency = <30000000>; > + link-gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; > + local-mac-address = [ a0 b0 c0 d0 e0 f0 ]; > + }; > + }; > + > + &gpio { > + eth1_pins: eth1_pins { > + brcm,pins = <25 4>; > + brcm,function = <0 0>; /* in */ > + brcm,pull = <0 0>; /* none */ > + }; Irrelevant node, drop Best regards, Krzysztof ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML 2026-08-05 11:08 ` Krzysztof Kozlowski @ 2026-08-05 17:23 ` Arthur Crépin Leblond 0 siblings, 0 replies; 11+ messages in thread From: Arthur Crépin Leblond @ 2026-08-05 17:23 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann, netdev, devicetree, linux-kernel On Wed, Aug 05, 2026 at 01:08:35PM +0200, Krzysztof Kozlowski wrote: >On 04/08/2026 19:40, Arthur Crépin Leblond wrote: >> Convert the Wiznet w5x00 SPI Ethernet controller binding from >> text to DT schema format. > >Limited review, to spare you one review cycle, as it was not tested. > >Subject: s/YAML/DT schema/ > >See also: >https://elixir.bootlin.com/linux/v7.1-rc7/source/Documentation/devicetree/bindings/submitting-patches.rst#L23 > Hi Krzysztof, Thank you for the review, I'll address all the changes in a new patch. Quick question, since there was no maintainer on that text file, who should I assign it to? Thanks Arthur ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML 2026-08-04 17:40 ` [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML Arthur Crépin Leblond 2026-08-04 18:49 ` Rob Herring (Arm) 2026-08-05 11:08 ` Krzysztof Kozlowski @ 2026-08-05 17:58 ` sashiko-bot 2 siblings, 0 replies; 11+ messages in thread From: sashiko-bot @ 2026-08-05 17:58 UTC (permalink / raw) To: Arthur Crépin Leblond; +Cc: conor+dt, devicetree, robh Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] The device tree example contains multiple syntax errors and unresolved references that will cause `make dt_binding_check` to fail fatally. - [Low] The `pinctrl-names` property incorrectly uses `enum` alongside `minItems: 1` for a string array constraint. -- --- Patch [2]: [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML --- commit 03b1fc0266172468d4c1e28d10eec5fa26175fe7 Author: Arthur Crépin Leblond <arthur@marmottus.net> dt-bindings: net: convert wiznet,w5x00 to YAML Convert the Wiznet w5x00 SPI Ethernet controller binding from text to DT schema format. > diff --git a/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml b/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml > new file mode 100644 > index 0000000000000..8f45a5d773fe3 > --- /dev/null > +++ b/Documentation/devicetree/bindings/net/wiznet,w5x00.yaml > @@ -0,0 +1,103 @@ [ ... ] > + pinctrl-names: > + description: > + List of assigned state names, see pinctrl binding documentation. > + enum: > + - default > + minItems: 1 [Severity: Low] Does this incorrectly restrict pinctrl-names to a scalar string instead of a string-array? Since pinctrl-names is inherently defined as a string-array, using enum: [ default ] restricts the property to a scalar string, which will cause schema validation to fail for valid device trees. The standard approach requires: items: - const: default [ ... ] > +examples: > + - | > + /* Example (for Raspberry Pi with pin control stuff for GPIO irq) */ > + > + #include <dt-bindings/gpio/gpio.h> > + #include <dt-bindings/interrupt-controller/irq.h> > + > + spi { > + #address-cells = <1>; > + #size-cells = <0>; > + > + ethernet@0: w5500@0 { [Severity: Low] Is the label ethernet@0 valid here? DTS labels cannot contain the '@' character. This will cause a strict compilation failure when this YAML example is parsed by dtc during make dt_binding_check. > + compatible = "wiznet,w5500"; > + reg = <0>; > + pinctrl-names = "default"; > + pinctrl-0 = <ð1_pins>; > + interrupt-parent = <&gpio>; [Severity: Low] Could this unresolved &gpio phandle reference cause a compiler error during dt_binding_check? Since &gpio is not defined in the scope of this standalone example, dtc will fail to resolve it. > + interrupts = <25 IRQ_TYPE_EDGE_FALLING>; > + spi-max-frequency = <30000000>; > + link-gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; > + local-mac-address = [ a0 b0 c0 d0 e0 f0 ]; > + }; > + }; > + > + &gpio { > + eth1_pins: eth1_pins { > + brcm,pins = <25 4>; > + brcm,function = <0 0>; /* in */ > + brcm,pull = <0 0>; /* none */ > + }; [Severity: Low] Are we missing a final closing brace for the &gpio node here? This syntax error seems to have been introduced during the conversion from the text binding, and it will prevent make dt_binding_check from compiling the example. -- Sashiko AI review · https://sashiko.dev/#/patchset/20260804-wiznet-link-gpio-v2-0-3b1d0c870f35@marmottus.net?part=2 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-08-05 17:58 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-08-04 17:40 [PATCH v2 0/2] w5100: restore GPIO-based link detection Arthur Crépin Leblond 2026-08-04 17:40 ` [PATCH v2 1/2] " Arthur Crépin Leblond 2026-08-04 18:44 ` Arnd Bergmann 2026-08-04 20:58 ` Jakub Kicinski 2026-08-05 7:56 ` Arnd Bergmann 2026-08-05 17:58 ` sashiko-bot 2026-08-04 17:40 ` [PATCH v2 2/2] dt-bindings: net: convert wiznet,w5x00 to YAML Arthur Crépin Leblond 2026-08-04 18:49 ` Rob Herring (Arm) 2026-08-05 11:08 ` Krzysztof Kozlowski 2026-08-05 17:23 ` Arthur Crépin Leblond 2026-08-05 17:58 ` sashiko-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox