* [PATCH net-next v3 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema
2026-08-06 14:59 [PATCH net-next v3 0/3] w5100: restore GPIO-based link detection Arthur Crépin Leblond
@ 2026-08-06 15:00 ` Arthur Crépin Leblond
2026-08-10 7:40 ` Krzysztof Kozlowski
2026-08-06 15:00 ` [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios Arthur Crépin Leblond
2026-08-06 15:00 ` [PATCH net-next v3 3/3] w5100: detect carrier state using link status bit Arthur Crépin Leblond
2 siblings, 1 reply; 15+ messages in thread
From: Arthur Crépin Leblond @ 2026-08-06 15:00 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
plain text to DT schema.
Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net>
---
.../devicetree/bindings/net/wiznet,w5100.yaml | 67 ++++++++++++++++++++++
.../devicetree/bindings/net/wiznet,w5x00.txt | 50 ----------------
2 files changed, 67 insertions(+), 50 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/wiznet,w5100.yaml b/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
new file mode 100644
index 000000000000..641c9ddbde9e
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/wiznet,w5100.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Wiznet w5100/w5200/w5500 SPI Ethernet Controller
+
+maintainers:
+ - Arthur Crépin Leblond <arthur@marmottus.net>
+
+description: |
+ This is a standalone 10/100 MBit Ethernet controller with SPI interface.
+
+allOf:
+ - $ref: /schemas/net/ethernet-controller.yaml#
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+ compatible:
+ enum:
+ - wiznet,w5100
+ - wiznet,w5200
+ - wiznet,w5500
+
+ interrupts:
+ maxItems: 1
+
+ reg:
+ maxItems: 1
+
+ spi-max-frequency:
+ description:
+ According to the w5500 datasheet, the chip allows a maximum of 80 MHz,
+ however, board designs may need to limit this value.
+ maximum: 80000000
+
+required:
+ - compatible
+ - reg
+ - interrupts
+
+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 {
+ 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>;
+ local-mac-address = [ a0 b0 c0 d0 e0 f0 ];
+ };
+ };
+...
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 */
- };
-};
--
2.55.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH net-next v3 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema
2026-08-06 15:00 ` [PATCH net-next v3 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema Arthur Crépin Leblond
@ 2026-08-10 7:40 ` Krzysztof Kozlowski
0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-10 7:40 UTC (permalink / raw)
To: Arthur Crépin Leblond
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 Thu, Aug 06, 2026 at 05:00:00PM +0200, Arthur Crépin Leblond wrote:
> Convert the Wiznet w5x00 SPI Ethernet controller binding from
> plain text to DT schema.
>
> Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-06 14:59 [PATCH net-next v3 0/3] w5100: restore GPIO-based link detection Arthur Crépin Leblond
2026-08-06 15:00 ` [PATCH net-next v3 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema Arthur Crépin Leblond
@ 2026-08-06 15:00 ` Arthur Crépin Leblond
2026-08-10 7:43 ` Krzysztof Kozlowski
2026-08-06 15:00 ` [PATCH net-next v3 3/3] w5100: detect carrier state using link status bit Arthur Crépin Leblond
2 siblings, 1 reply; 15+ messages in thread
From: Arthur Crépin Leblond @ 2026-08-06 15:00 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
Add the link-gpios property which describes an optional GPIO line that
can be wired to the LINKLED pin of the w5500 as an interrupt to detect
link status changes.
Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net>
---
Documentation/devicetree/bindings/net/wiznet,w5100.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/wiznet,w5100.yaml b/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
index 641c9ddbde9e..cebf437ad3c4 100644
--- a/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
+++ b/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
@@ -35,6 +35,12 @@ properties:
however, board designs may need to limit this value.
maximum: 80000000
+ link-gpios:
+ description:
+ An optional GPIO line that can be wired to the LINKLED pin of the w5500
+ as an interrupt to detect link status changes.
+ maxItems: 1
+
required:
- compatible
- reg
@@ -60,6 +66,7 @@ examples:
pinctrl-0 = <ð1_pins>;
interrupt-parent = <&gpio>;
interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
+ link-gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
spi-max-frequency = <30000000>;
local-mac-address = [ a0 b0 c0 d0 e0 f0 ];
};
--
2.55.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-06 15:00 ` [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios Arthur Crépin Leblond
@ 2026-08-10 7:43 ` Krzysztof Kozlowski
2026-08-10 7:50 ` Arthur Crépin Leblond
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-10 7:43 UTC (permalink / raw)
To: Arthur Crépin Leblond
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 Thu, Aug 06, 2026 at 05:00:01PM +0200, Arthur Crépin Leblond wrote:
> Add the link-gpios property which describes an optional GPIO line that
> can be wired to the LINKLED pin of the w5500 as an interrupt to detect
> link status changes.
>
> Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net>
> ---
> Documentation/devicetree/bindings/net/wiznet,w5100.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/net/wiznet,w5100.yaml b/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
> index 641c9ddbde9e..cebf437ad3c4 100644
> --- a/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
> +++ b/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
> @@ -35,6 +35,12 @@ properties:
> however, board designs may need to limit this value.
> maximum: 80000000
>
> + link-gpios:
> + description:
> + An optional GPIO line that can be wired to the LINKLED pin of the w5500
> + as an interrupt to detect link status changes.
The message is confusing. If you describe it from the host (system point
of view), then interrupts are not GPIOs but "interrupts".
But maybe this is OUT GPIO from the system to the device?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-10 7:43 ` Krzysztof Kozlowski
@ 2026-08-10 7:50 ` Arthur Crépin Leblond
2026-08-10 7:53 ` Arnd Bergmann
2026-08-10 7:55 ` Krzysztof Kozlowski
2 siblings, 0 replies; 15+ messages in thread
From: Arthur Crépin Leblond @ 2026-08-10 7:50 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 Mon, Aug 10, 2026 at 09:43:21AM +0200, Krzysztof Kozlowski wrote:
>The message is confusing. If you describe it from the host (system point
>of view), then interrupts are not GPIOs but "interrupts".
>
>But maybe this is OUT GPIO from the system to the device?
>
>Best regards,
>Krzysztof
>
It's an input on the host that triggers an interrupt on the host.
So, yes, you are right I will change the description.
Thanks
Arthur
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-10 7:43 ` Krzysztof Kozlowski
2026-08-10 7:50 ` Arthur Crépin Leblond
@ 2026-08-10 7:53 ` Arnd Bergmann
2026-08-10 7:59 ` Krzysztof Kozlowski
2026-08-10 7:55 ` Krzysztof Kozlowski
2 siblings, 1 reply; 15+ messages in thread
From: Arnd Bergmann @ 2026-08-10 7:53 UTC (permalink / raw)
To: Krzysztof Kozlowski, Arthur Crépin Leblond
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Netdev, devicetree, linux-kernel
On Mon, Aug 10, 2026, at 09:43, Krzysztof Kozlowski wrote:
> On Thu, Aug 06, 2026 at 05:00:01PM +0200, Arthur Crépin Leblond wrote:
>>
>> + link-gpios:
>> + description:
>> + An optional GPIO line that can be wired to the LINKLED pin of the w5500
>> + as an interrupt to detect link status changes.
>
> The message is confusing. If you describe it from the host (system point
> of view), then interrupts are not GPIOs but "interrupts".
>
> But maybe this is OUT GPIO from the system to the device?
From the device point of view, it's an LED output, but from the
system side we should describe it as an IRQ_TYPE_EDGE_BOTH
"interrupts" property rather than a gpio line.
Arnd
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-10 7:53 ` Arnd Bergmann
@ 2026-08-10 7:59 ` Krzysztof Kozlowski
2026-08-10 8:12 ` Arthur Crépin Leblond
0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-10 7:59 UTC (permalink / raw)
To: Arnd Bergmann, Arthur Crépin Leblond
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Netdev, devicetree, linux-kernel
On 10/08/2026 09:53, Arnd Bergmann wrote:
> On Mon, Aug 10, 2026, at 09:43, Krzysztof Kozlowski wrote:
>> On Thu, Aug 06, 2026 at 05:00:01PM +0200, Arthur Crépin Leblond wrote:
>>>
>>> + link-gpios:
>>> + description:
>>> + An optional GPIO line that can be wired to the LINKLED pin of the w5500
>>> + as an interrupt to detect link status changes.
>>
>> The message is confusing. If you describe it from the host (system point
>> of view), then interrupts are not GPIOs but "interrupts".
>>
>> But maybe this is OUT GPIO from the system to the device?
>
> From the device point of view, it's an LED output, but from the
> system side we should describe it as an IRQ_TYPE_EDGE_BOTH
> "interrupts" property rather than a gpio line.
Then probably we should list all four other pins as well (speed, duplex
and active).
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-10 7:59 ` Krzysztof Kozlowski
@ 2026-08-10 8:12 ` Arthur Crépin Leblond
2026-08-10 8:21 ` Krzysztof Kozlowski
0 siblings, 1 reply; 15+ messages in thread
From: Arthur Crépin Leblond @ 2026-08-10 8:12 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Arnd Bergmann, Andrew Lunn, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Netdev, devicetree, linux-kernel
On Mon, Aug 10, 2026 at 09:59:18AM +0200, Krzysztof Kozlowski wrote:
>On 10/08/2026 09:53, Arnd Bergmann wrote:
>> On Mon, Aug 10, 2026, at 09:43, Krzysztof Kozlowski wrote:
>>> On Thu, Aug 06, 2026 at 05:00:01PM +0200, Arthur Crépin Leblond wrote:
>>>>
>>>> + link-gpios:
>>>> + description:
>>>> + An optional GPIO line that can be wired to the LINKLED pin of the w5500
>>>> + as an interrupt to detect link status changes.
>>>
>>> The message is confusing. If you describe it from the host (system point
>>> of view), then interrupts are not GPIOs but "interrupts".
>>>
>>> But maybe this is OUT GPIO from the system to the device?
>>
>> From the device point of view, it's an LED output, but from the
>> system side we should describe it as an IRQ_TYPE_EDGE_BOTH
>> "interrupts" property rather than a gpio line.
>
>Then probably we should list all four other pins as well (speed, duplex
>and active).
>
>Best regards,
>Krzysztof
We use this line to detect a link change but don't read its value in
the interrupt handler, we read the i2c PHYCFGR register to get the
link status.
Arthur
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-10 8:12 ` Arthur Crépin Leblond
@ 2026-08-10 8:21 ` Krzysztof Kozlowski
2026-08-10 8:25 ` Arnd Bergmann
0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-10 8:21 UTC (permalink / raw)
To: Arthur Crépin Leblond
Cc: Arnd Bergmann, Andrew Lunn, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Netdev, devicetree, linux-kernel
On 10/08/2026 10:12, Arthur Crépin Leblond wrote:
> On Mon, Aug 10, 2026 at 09:59:18AM +0200, Krzysztof Kozlowski wrote:
>> On 10/08/2026 09:53, Arnd Bergmann wrote:
>>> On Mon, Aug 10, 2026, at 09:43, Krzysztof Kozlowski wrote:
>>>> On Thu, Aug 06, 2026 at 05:00:01PM +0200, Arthur Crépin Leblond wrote:
>>>>>
>>>>> + link-gpios:
>>>>> + description:
>>>>> + An optional GPIO line that can be wired to the LINKLED pin of the w5500
>>>>> + as an interrupt to detect link status changes.
>>>>
>>>> The message is confusing. If you describe it from the host (system point
>>>> of view), then interrupts are not GPIOs but "interrupts".
>>>>
>>>> But maybe this is OUT GPIO from the system to the device?
>>>
>>> From the device point of view, it's an LED output, but from the
>>> system side we should describe it as an IRQ_TYPE_EDGE_BOTH
>>> "interrupts" property rather than a gpio line.
>>
>> Then probably we should list all four other pins as well (speed, duplex
>> and active).
>>
>> Best regards,
>> Krzysztof
>
> We use this line to detect a link change but don't read its value in
> the interrupt handler, we read the i2c PHYCFGR register to get the
> link status.
I know, but won't you have soon the same problem with active? Otherwise
are you going to keep polling for the active link, since it is not
reported through the main interrupt?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-10 8:21 ` Krzysztof Kozlowski
@ 2026-08-10 8:25 ` Arnd Bergmann
2026-08-10 8:31 ` Krzysztof Kozlowski
0 siblings, 1 reply; 15+ messages in thread
From: Arnd Bergmann @ 2026-08-10 8:25 UTC (permalink / raw)
To: Krzysztof Kozlowski, Arthur Crépin Leblond
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Netdev, devicetree, linux-kernel
On Mon, Aug 10, 2026, at 10:21, Krzysztof Kozlowski wrote:
> On 10/08/2026 10:12, Arthur Crépin Leblond wrote:
>>
>> We use this line to detect a link change but don't read its value in
>> the interrupt handler, we read the i2c PHYCFGR register to get the
>> link status.
>
> I know, but won't you have soon the same problem with active? Otherwise
> are you going to keep polling for the active link, since it is not
> reported through the main interrupt?
I don't see how we'd ever want to report 'active' state back to
the kernel, this just means it's either receiving or transmitting,
and the kernel already knows when a data transfer happened
because it either started sending or it receives an interrupt for
a received frame.
Arnd
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-10 8:25 ` Arnd Bergmann
@ 2026-08-10 8:31 ` Krzysztof Kozlowski
2026-08-10 14:46 ` Arthur Crépin Leblond
0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-10 8:31 UTC (permalink / raw)
To: Arnd Bergmann, Arthur Crépin Leblond
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Netdev, devicetree, linux-kernel
On 10/08/2026 10:25, Arnd Bergmann wrote:
> On Mon, Aug 10, 2026, at 10:21, Krzysztof Kozlowski wrote:
>> On 10/08/2026 10:12, Arthur Crépin Leblond wrote:
>>>
>>> We use this line to detect a link change but don't read its value in
>>> the interrupt handler, we read the i2c PHYCFGR register to get the
>>> link status.
>>
>> I know, but won't you have soon the same problem with active? Otherwise
>> are you going to keep polling for the active link, since it is not
>> reported through the main interrupt?
>
> I don't see how we'd ever want to report 'active' state back to
> the kernel, this just means it's either receiving or transmitting,
> and the kernel already knows when a data transfer happened
> because it either started sending or it receives an interrupt for
> a received frame.
True, that was just an example so the author thinks about it instead of
just solving one problem now. For example neither speed nor duplex are
reported in the main interrupt and you might need to configure something
if they change.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-10 8:31 ` Krzysztof Kozlowski
@ 2026-08-10 14:46 ` Arthur Crépin Leblond
0 siblings, 0 replies; 15+ messages in thread
From: Arthur Crépin Leblond @ 2026-08-10 14:46 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Arnd Bergmann, Andrew Lunn, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Netdev, devicetree, linux-kernel
On Mon, Aug 10, 2026 at 10:31:50AM +0200, Krzysztof Kozlowski wrote:
>On 10/08/2026 10:25, Arnd Bergmann wrote:
>> On Mon, Aug 10, 2026, at 10:21, Krzysztof Kozlowski wrote:
>>> On 10/08/2026 10:12, Arthur Crépin Leblond wrote:
>>>>
>>>> We use this line to detect a link change but don't read its value in
>>>> the interrupt handler, we read the i2c PHYCFGR register to get the
>>>> link status.
>>>
>>> I know, but won't you have soon the same problem with active? Otherwise
>>> are you going to keep polling for the active link, since it is not
>>> reported through the main interrupt?
>>
>> I don't see how we'd ever want to report 'active' state back to
>> the kernel, this just means it's either receiving or transmitting,
>> and the kernel already knows when a data transfer happened
>> because it either started sending or it receives an interrupt for
>> a received frame.
>
>True, that was just an example so the author thinks about it instead of
>just solving one problem now. For example neither speed nor duplex are
>reported in the main interrupt and you might need to configure something
>if they change.
>
>Best regards,
>Krzysztof
I did not want to modify the driver too much and the link status is
enough for me.
Arthur
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios
2026-08-10 7:43 ` Krzysztof Kozlowski
2026-08-10 7:50 ` Arthur Crépin Leblond
2026-08-10 7:53 ` Arnd Bergmann
@ 2026-08-10 7:55 ` Krzysztof Kozlowski
2 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-10 7:55 UTC (permalink / raw)
To: Arthur Crépin Leblond
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 10/08/2026 09:43, Krzysztof Kozlowski wrote:
> On Thu, Aug 06, 2026 at 05:00:01PM +0200, Arthur Crépin Leblond wrote:
>> Add the link-gpios property which describes an optional GPIO line that
>> can be wired to the LINKLED pin of the w5500 as an interrupt to detect
>> link status changes.
>>
>> Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net>
>> ---
>> Documentation/devicetree/bindings/net/wiznet,w5100.yaml | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/net/wiznet,w5100.yaml b/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
>> index 641c9ddbde9e..cebf437ad3c4 100644
>> --- a/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
>> +++ b/Documentation/devicetree/bindings/net/wiznet,w5100.yaml
>> @@ -35,6 +35,12 @@ properties:
>> however, board designs may need to limit this value.
>> maximum: 80000000
>>
>> + link-gpios:
>> + description:
>> + An optional GPIO line that can be wired to the LINKLED pin of the w5500
>> + as an interrupt to detect link status changes.
>
> The message is confusing. If you describe it from the host (system point
> of view), then interrupts are not GPIOs but "interrupts".
>
> But maybe this is OUT GPIO from the system to the device?
>
So I read your driver and hardware datasheet. This is not an interrupt,
just output pin, so drop the "interrupt" wording here.
This output pin can be wired to LED or to GPIO on the host side, so
ideally this would be mutually exclusive, but representing this as GPIO
is fine for now. Description could be:
"Active low LINKLED output pin reporting status of the link"
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH net-next v3 3/3] w5100: detect carrier state using link status bit
2026-08-06 14:59 [PATCH net-next v3 0/3] w5100: restore GPIO-based link detection Arthur Crépin Leblond
2026-08-06 15:00 ` [PATCH net-next v3 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema Arthur Crépin Leblond
2026-08-06 15:00 ` [PATCH net-next v3 2/3] dt-bindings: net: wiznet,w5100: add link-gpios Arthur Crépin Leblond
@ 2026-08-06 15:00 ` Arthur Crépin Leblond
2 siblings, 0 replies; 15+ messages in thread
From: Arthur Crépin Leblond @ 2026-08-06 15:00 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
Detect the link status on the w5500 using the Link Status bit from the
PHY Configuration register.
Also add an optional GPIO line that can be wired to the LINKLED pin of
the w5500 as an interrupt to detect link status changes and read the
register.
On chip variants other than the w5500, which lack this register, the
link is always reported as up.
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 and that it used the
old gpio interface.
This isn't a plain revert of that removal. It uses the new managed GPIO
descriptors so that the resources are released automatically on driver
removal or probe failure.
Signed-off-by: Arthur Crépin Leblond <arthur@marmottus.net>
---
drivers/net/ethernet/wiznet/w5100.c | 70 +++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index 53d8dc642fbd..6707a6f27395 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"
@@ -124,6 +125,8 @@ MODULE_LICENSE("GPL");
*/
#define W5500_SIMR 0x0018 /* Socket Interrupt Mask Register */
#define W5500_RTR 0x0019 /* Retry Time-value Register */
+#define W5500_PHYCFGR 0x002e /* PHY Configuration Register */
+#define PHYCFGR_LNK 0x01 /* link status */
#define W5500_S0_REGS 0x10000
@@ -154,6 +157,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 +418,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->ops->chip_id == W5500)
+ return w5100_read(priv, W5500_PHYCFGR) & PHYCFGR_LNK;
+
+ return 1;
+}
+
static u32 w5100_get_msglevel(struct net_device *ndev)
{
struct w5100_priv *priv = netdev_priv(ndev);
@@ -616,6 +630,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 (w5100_get_link(ndev)) {
+ 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 +691,12 @@ static int w5100_open(struct net_device *ndev)
w5100_hw_start(priv);
napi_enable(&priv->napi);
netif_start_queue(ndev);
+
+ if (w5100_get_link(ndev))
+ 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,9 @@ static int w5100_resume(struct device *dev)
w5100_hw_start(priv);
netif_device_attach(ndev);
+
+ if (w5100_get_link(ndev))
+ netif_carrier_on(ndev);
}
return 0;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 15+ messages in thread