From nobody Tue Sep 29 06:59:45 2026 Received: from mslow3.mail.gandi.net (mslow3.mail.gandi.net [217.70.178.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD12B3F9F3B; Tue, 11 Aug 2026 12:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.249 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786453005; cv=none; b=slwaHwQ9jmd6Gv2wnHuvOo8U/bh807apY9eyt4EzsGekkAfZsmlh/p2ckB63XMg1UhsPBw1XNOzglDACLVfv9ukmvGAPKsn93H+SoEdRJ7bDpYA8Mrk44K20auLGiTd8mJ0dmFiz3V+aSQZP6qAMSeqOAtJV9ebjSrTRok7Xf68= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786453005; c=relaxed/simple; bh=uyQQOVi15S3c7D8BnBr8x/fxEUVOFGeXSCb45HNclGg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Nd1MIRpoKn9cjxBE3iy4hd4gqlC/BHJxI8YgMhkMd5HH1Dzc4irM+auslvIBZw7CjpIthHtvIMBzjm4EcVKIWmIOs5o3qoP5FN320PiuaM92cRKnjKm2ZBvbXzKD3m683mzA+KQVp2m3bfi3tAM95uER3/XiLRKCU5w7AVfY8dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marmottus.net; spf=pass smtp.mailfrom=marmottus.net; dkim=pass (2048-bit key) header.d=marmottus.net header.i=@marmottus.net header.b=BTry9cTZ; arc=none smtp.client-ip=217.70.178.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marmottus.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marmottus.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marmottus.net header.i=@marmottus.net header.b="BTry9cTZ" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by mslow3.mail.gandi.net (Postfix) with ESMTP id CC85B5822EA; Tue, 11 Aug 2026 12:34:52 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 357183EC69; Tue, 11 Aug 2026 12:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marmottus.net; s=gm1; t=1786451684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0jd3dhPZnS4zprNyA8sY9GAb7F0q5LlHLaqGujzjZ9I=; b=BTry9cTZRbO4UwtPOycRD91xmAPd8kLo/4Cml54M32gjyDghPYcJP8PJ4wXFKX6O27gPxD dipOQdG4fjps1Zed16D6/Btd85n2544ZLFF9z9ThGfT33KhIPdt8RJ2Y965Pm1Y44VuJY9 zh1axniVcjQkWItJOEzq7XvYaaDB++ew2jZ3IV/07wqR2OyCMybc/Zon3ZWoUqoCu9I/eA LVxP3VvyYMfHfjExAozPoTL5D20wudb/Eoj+9RAk9KMN2Rn4/RbZXAieUmOl/Smawz2bE2 6ynpPrQLJIUeNViT5UrtG6qCk+1DtkND5kPFPXGO2nlyuYT6SuHA5uURITS0Tg== From: =?utf-8?q?Arthur_Cr=C3=A9pin_Leblond?= Date: Tue, 11 Aug 2026 14:34:33 +0200 Subject: [PATCH net-next v4 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260811-wiznet-link-gpio-v4-1-4d5f7da885a8@marmottus.net> References: <20260811-wiznet-link-gpio-v4-0-4d5f7da885a8@marmottus.net> In-Reply-To: <20260811-wiznet-link-gpio-v4-0-4d5f7da885a8@marmottus.net> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Arnd Bergmann , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Arthur_Cr=C3=A9pin_Leblond?= , Krzysztof Kozlowski X-Mailer: b4 0.15.2 X-GND-Sasl: arthur@marmottus.net X-GND-Cause: dmFkZTGhTFAuWjMd8OOyH8xCxArOr4Ca0SOgRQXayWbVK6z6ocC7oIynP/SDwtlrIKZ1s3hldENkadogrUsfLhVi11Vyzekp27qDxqk6P87IjTLrVUdD1+YO+8VCbcmQkb4uQ10D6RwZU4IuTN767NYRcMBmqqVZ7QhRKuqsk+tjTaFTrHwKCTfIkMER+BcT14NmHwsHfSl0iNvat/fQtHCDjFbr1o7MSq7JIUJ0Ckbs3sDx8reyzBpa6rwZ4wgTIiBkjOytPOwuJXL5YWHEOm68vILoAmXmIyBBbjmvS3+PXFnGyAHWDlGD6UUCprls0YSwJJLLTDe/No8Q2Z51hTEGne4NOLflLhXv/7gb6Ck4TiCJpQb02mZaWdMnYHPVLqrSNcAY0w5Hy77PvGyAr3bSXUk/WU/D9oBQwRH2EixPjXql/mg/z7MM9vjsA4Z0eztB94HmwqSOpDK7prWPYcyOPTqeh8Zpsre6FjmZ+U8HSWe72ObskNuLgFQnuaNCYtwJXWmD1xIdvAVwIzBX2LayoWNLbHfG/CgWlUBx/HqgHacUM0Ps9IBaTVPMCxBKICgeJfdg+pU5T5wUfNIqtTz9FJuBWv7LNO/IdWsQHpaIa5MA/7nWHgglcj1TY4Wu6iul+YCCDno72vHWAe+d/+yDiYIFnhJMM1X33A8cuvFGfNCmVw X-GND-State: clean X-GND-Score: -100 Convert the Wiznet w5x00 SPI Ethernet controller binding from plain text to DT schema. Signed-off-by: Arthur Cr=C3=A9pin Leblond Reviewed-by: Krzysztof Kozlowski Reviewed-by: Arnd Bergmann --- .../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/Docu= mentation/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=C3=A9pin Leblond + +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 MH= z, + 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 + #include + + spi { + #address-cells =3D <1>; + #size-cells =3D <0>; + + ethernet@0 { + compatible =3D "wiznet,w5500"; + reg =3D <0>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <ð1_pins>; + interrupt-parent =3D <&gpio>; + interrupts =3D <25 IRQ_TYPE_EDGE_FALLING>; + spi-max-frequency =3D <30000000>; + local-mac-address =3D [ a0 b0 c0 d0 e0 f0 ]; + }; + }; +... diff --git a/Documentation/devicetree/bindings/net/wiznet,w5x00.txt b/Docum= entation/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 nati= vely - generates falling edge interrupts, however, additional board= logic - might invert the signal. -- pinctrl-names: List of assigned state names, see pinctrl binding documen= tation. -- 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 w= 5500. - According to the w5500 datasheet, the chip allows a maximum of 80 MHz, h= owever, - 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 =3D "wiznet,w5500"; - reg =3D <0>; - pinctrl-names =3D "default"; - pinctrl-0 =3D <ð1_pins>; - interrupt-parent =3D <&gpio>; - interrupts =3D <25 IRQ_TYPE_EDGE_FALLING>; - spi-max-frequency =3D <30000000>; - }; -}; - -&gpio { - eth1_pins: eth1_pins { - brcm,pins =3D <25>; - brcm,function =3D <0>; /* in */ - brcm,pull =3D <0>; /* none */ - }; -}; --=20 2.55.0 From nobody Tue Sep 29 06:59:45 2026 Received: from mslow3.mail.gandi.net (mslow3.mail.gandi.net [217.70.178.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD1B2407590; Tue, 11 Aug 2026 12:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.249 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786453005; cv=none; b=XuWf/mO0UFoG8leTPOB4c8z5nlhKTk1tNmrq4RlwEYkmb9+OmJE0ICXIpaht2oZETMy/Au+zVnSXA4TzZt/ykTt/2ST8RDvTuhZhMMfM2XZCbztLAuDYY9cG7yz1TuWGVJoTGYH9ZA4b+uw+h7VZ5y8ac+30k7s3IeooBjlN9ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786453005; c=relaxed/simple; bh=pFpkkhczKFM4RbQq1PzMqjXSn5B9HPe6D4CnOAI4CDM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mZKNMYoSI0hX+LEaSZ13EzZtxU9ksPuKDoaJlrgYFdmDGdM52hSgt1lKfjM82fzMAQ1TDStRiZDYENIsORm7pZqwvtMUkAy5wg7g11KFsRZwXlDyxpi99CLHMpdKs0cNbVnTMberbnw3Sq+n8DJVvq8Ur25YZ210SWCqGau+I1I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marmottus.net; spf=pass smtp.mailfrom=marmottus.net; dkim=pass (2048-bit key) header.d=marmottus.net header.i=@marmottus.net header.b=bT2RHKJG; arc=none smtp.client-ip=217.70.178.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marmottus.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marmottus.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marmottus.net header.i=@marmottus.net header.b="bT2RHKJG" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by mslow3.mail.gandi.net (Postfix) with ESMTP id AA3465822ED; Tue, 11 Aug 2026 12:34:54 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 428D83EC6A; Tue, 11 Aug 2026 12:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marmottus.net; s=gm1; t=1786451686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4aJRNaiDdOQIaFv139+AH1OKZ3dYZhv5UsL8B74h/l0=; b=bT2RHKJGTry4ANt7+KsoLtWqvSBbvOzwjIdnvx2ZPHVXBstIv1I+4gkl0liaCCKBe9iJTk 8WLyaC1uiFcNEWv+Dr55xmfLGMUKkD7qJ7p3l92DpNzJo74FeHP15bBBfjLIILGCe0Tvqt nlqLN4b26txoYGuNWPofaHCto7OIhWzls1leeZIAVGxQeuZubkDcC+NT88sWru/xVOx8p+ H/2JtGMpmg15gQx6kqb33VnR+fHQ4BTzT6g3CkqNeWKWrckhTJ1AftV6Fy/2wIY94Ya/qo hJac67oE7BT76KNgVklpT+FMPIY7lh8vXmDrW95OykUe91wrdAX6sM/NiawRpw== From: =?utf-8?q?Arthur_Cr=C3=A9pin_Leblond?= Date: Tue, 11 Aug 2026 14:34:34 +0200 Subject: [PATCH net-next v4 2/3] dt-bindings: net: wiznet,w5100: add link status interrupt Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260811-wiznet-link-gpio-v4-2-4d5f7da885a8@marmottus.net> References: <20260811-wiznet-link-gpio-v4-0-4d5f7da885a8@marmottus.net> In-Reply-To: <20260811-wiznet-link-gpio-v4-0-4d5f7da885a8@marmottus.net> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Arnd Bergmann , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Arthur_Cr=C3=A9pin_Leblond?= X-Mailer: b4 0.15.2 X-GND-Sasl: arthur@marmottus.net X-GND-Cause: dmFkZTED/3HJKTgwxBO9D7jQ7O9WW6mZqKFTS5z9+t/FK1af0VH31e8paPNStgsQpQIYlcYucwL4cCmdHRXR1YYxqw1T8z7REX/fEaawr/SFTAReVmgPSkMSXhelgxXwGWSawVSbcpIQz1ApGSMt7N/EmbPGNzbGZYTYvDxpMYQGP1JlU5jgLN/HEWfQYe9TkhK3By7wmxsf+0M+P/IMA7PoVnge/FKBaYY9CaxM9zl0WOY5mQGtYkeKnvmiXrurdSxxCfaFLe1gD6LLRDm8B+uNjWpnFlfgPuimqtreC5Kqai1m6/hFQg5QKCoi3xpXvCY9c8GMn3Fz6R/dnpQZY+phR/sNRD8UvHDgn4kn61ff2ARw2ehZrhVFiGRgNTXDTEG8K6cQzzp3U+Hve1yc4YgM7SyuiyEiRKfFeUabMDK+Q7MP3y7RPWv2+ifoNdZnek6/Oj7NTPEj+ooEiOFcTwKER6bZjgQUg0bgjOBiodsqt6DL0PhCDqpm8IOa7iCvP34mykZZjdnMeztqbcbZ9vWKaHl/vzsHvMQJ9JQwNriZyl7+424cLB+BHUbCmeF97yALSaNF8hy6m58iJz+ik+zXqMDilFrCKwwtIn2PHHAKKKhyzxdkDO8xq+4WBDX3ENm//5+lL39o8zh+c075LAeWkvs050e6x820q1SpHvAPCzqlZw X-GND-State: clean X-GND-Score: -100 Add an optional link status interrupt which can be connected to the LINKLED pin on the device to detect link status changes. Signed-off-by: Arthur Cr=C3=A9pin Leblond Reviewed-by: Arnd Bergmann --- Documentation/devicetree/bindings/net/wiznet,w5100.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/net/wiznet,w5100.yaml b/Docu= mentation/devicetree/bindings/net/wiznet,w5100.yaml index 641c9ddbde9e..30f013f40a77 100644 --- a/Documentation/devicetree/bindings/net/wiznet,w5100.yaml +++ b/Documentation/devicetree/bindings/net/wiznet,w5100.yaml @@ -24,7 +24,11 @@ properties: - wiznet,w5500 =20 interrupts: - maxItems: 1 + maxItems: 2 + items: + - description: Main interrupt (INT pin on the device). + - description: + Optional interrupt for link status changes (LINKLED pin on w5500= ). =20 reg: maxItems: 1 @@ -59,7 +63,8 @@ examples: pinctrl-names =3D "default"; pinctrl-0 =3D <ð1_pins>; interrupt-parent =3D <&gpio>; - interrupts =3D <25 IRQ_TYPE_EDGE_FALLING>; + interrupts =3D <25 IRQ_TYPE_EDGE_FALLING>, + <24 IRQ_TYPE_EDGE_BOTH>; spi-max-frequency =3D <30000000>; local-mac-address =3D [ a0 b0 c0 d0 e0 f0 ]; }; --=20 2.55.0 From nobody Tue Sep 29 06:59:45 2026 Received: from mslow3.mail.gandi.net (mslow3.mail.gandi.net [217.70.178.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD2EB435A87; Tue, 11 Aug 2026 12:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.249 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786453006; cv=none; b=m4lhBUv7nJ0qaM8mtf9CxxUMrfahjHsr32VdiXXkUjlvxnTlHNwFcw4Y34mFh1/38sT/p+6lY2fGm5Nj5aixCccMDZXuTyUafSmiiAF4KS6Q9Xiu7glc1LpZ0A/jnKUAeJUUCvVZxjJFLc192hVhEYei0r5xRElTkS2EKKepFr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786453006; c=relaxed/simple; bh=fJ56bbwwe3vVMnpTdoyYC18bSgyXz3u7+wNH2PeNI8o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=da2iA/hyQsk+qaCFMVcQefO0IybiMKHq7EqdRRpMMZpfKbYQnKc4jQIm/aENn1GS72aWycOwrDO4f/QiuXwlaHijdpKrALFQW35LwQ7qbswqP18M1Js43zZgOI/X9Gl9UJ2fx36xOiKmQmNDh6xqFdHU7jDf7wVsjod0KZKFpF0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marmottus.net; spf=pass smtp.mailfrom=marmottus.net; dkim=pass (2048-bit key) header.d=marmottus.net header.i=@marmottus.net header.b=KgWr3Ci8; arc=none smtp.client-ip=217.70.178.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marmottus.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marmottus.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marmottus.net header.i=@marmottus.net header.b="KgWr3Ci8" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by mslow3.mail.gandi.net (Postfix) with ESMTP id B51C45822F0; Tue, 11 Aug 2026 12:34:56 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3D4153ECDD; Tue, 11 Aug 2026 12:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marmottus.net; s=gm1; t=1786451688; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EFPULwsCEQh8jxrDTdq68dQ4k9ee+NFqozFqmEB9s7g=; b=KgWr3Ci8SbC3otOEJercI3u4wxKY6jX5mdTLNc4w/SarZmsiT8fKFNCTPYZePommitvmWk jTwnI+1KhvYbuIIrZ/WHFkpDrxDSAO3Bn7epDxCr6Bol/OpSWugOFuCe0SwXtV2ErhVUYO G3Oc6EAXzv1vkMTHMlw5eT3SuWxAgOisG7aHRTuvM0xK+QAgJI/P8wiPzCzpv5k5f4agp+ T2nOQkBA9mWADBdwEhBN8hia0t5Yb8d5lcPdgsWlUFniMWp5rFzLyiflBGnZZxIzx5X2Qz qvWCmWqjEDhOo/amRzz++IeL53bOiA7JE8dmsAAlPMo7/12rrHkE5qlZ2NBzpw== From: =?utf-8?q?Arthur_Cr=C3=A9pin_Leblond?= Date: Tue, 11 Aug 2026 14:34:35 +0200 Subject: [PATCH net-next v4 3/3] w5100: detect carrier state using link status bit and optional interrupt Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260811-wiznet-link-gpio-v4-3-4d5f7da885a8@marmottus.net> References: <20260811-wiznet-link-gpio-v4-0-4d5f7da885a8@marmottus.net> In-Reply-To: <20260811-wiznet-link-gpio-v4-0-4d5f7da885a8@marmottus.net> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Arnd Bergmann , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Arthur_Cr=C3=A9pin_Leblond?= X-Mailer: b4 0.15.2 X-GND-Sasl: arthur@marmottus.net X-GND-Cause: dmFkZTED/3HJKTgwxBO9D7jQ7O9WW6mZqKFTS5z9+t/FK1af0VH31e8paPNStgsQpQIYlcYucwL4cCmdHRXR1YYxqw1T8z7REX/fEaawr/SFTAReVmgPSkMSXhelgxXwGWSawVSbcpIQz1ApGSMt7N/EmbPGNzbGZYTYvDxpMYQGP1JlU5jgLN/HEWfQYe9TkhK3By7wmxsf+0M+P/IMA7PoVnge/FKBaYY9CaxM9zl0WOY5mQGtYkeKnvmiXrurdSxxCfaFLe1gD6LLRDm8B+uNjWpnFlfgPuimqtreC5Kqai1m6/hFQg5QKCoi3xpXvCY9c8GMn3Fz6R/dnpQZY+phR/sNQY9r6x+k9x1zRTatfSl2TcVGaH3AMwywSYmX+TSeRecaZq4abXGY0Yp0jO+0JP21trGrRDK197YNrLd/wiWJty2XS9YA+W94Ma0sgCxNDVkXRSjzH4e3IKYVXIy8PHXySTL1Qye/0nz9CGv/Y0ts9iFpAnoHSWMEL/R7/EWghAQwWi9h5AjvwPO1S9VYt9qLPTWD8GTCtgP3WkZAkbKaaJDC6sYIZZe/8jgo8+eX5t+5gcJpaX51ytLbna/ZRi0CNoMX4E3Y+/RcF3CpsOlcIXg4QxKYn3XKgZvqh8FcvLOCV8Wduebe13Z/qy6sgTJnzsExBOKFQ86T9tr2mINgpw X-GND-State: clean X-GND-Score: -100 Detect the link status on the w5500 using the Link Status bit from the PHY Configuration register (PHYCFGR). On w5100/w5200, which lack this register, the link is always reported as up. Also add an optional interrupt, wired to the LINKLED pin of the w5500, to detect link status changes and read the PHYCFGR register. 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: link detection is now done using a second interrupt rather than a gpio with a documented DT binding. Signed-off-by: Arthur Cr=C3=A9pin Leblond Reviewed-by: Arnd Bergmann --- drivers/net/ethernet/wiznet/w5100.c | 68 +++++++++++++++++++++++++++++++++= ++++ 1 file changed, 68 insertions(+) diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiz= net/w5100.c index 53d8dc642fbd..ca5054c20993 100644 --- a/drivers/net/ethernet/wiznet/w5100.c +++ b/drivers/net/ethernet/wiznet/w5100.c @@ -21,6 +21,7 @@ #include #include #include +#include #include =20 #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 */ =20 #define W5500_S0_REGS 0x10000 =20 @@ -154,6 +157,7 @@ struct w5100_priv { u16 s0_rx_buf_size; =20 int irq; + int link_irq; =20 struct napi_struct napi; struct net_device *ndev; @@ -414,6 +418,20 @@ static void w5100_get_drvinfo(struct net_device *ndev, sizeof(info->bus_info)); } =20 +static u32 w5100_get_link(struct net_device *ndev) +{ + struct w5100_priv *priv =3D netdev_priv(ndev); + + if (priv->ops->chip_id =3D=3D W5500) { + int ret =3D w5100_read(priv, W5500_PHYCFGR); + + if (ret >=3D 0) + return ret & PHYCFGR_LNK; + } + + return 1; +} + static u32 w5100_get_msglevel(struct net_device *ndev) { struct w5100_priv *priv =3D netdev_priv(ndev); @@ -616,6 +634,24 @@ static irqreturn_t w5100_interrupt(int irq, void *ndev= _instance) return IRQ_HANDLED; } =20 +static irqreturn_t w5100_detect_link(int irq, void *ndev_instance) +{ + struct net_device *ndev =3D ndev_instance; + struct w5100_priv *priv =3D 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 =3D container_of(work, struct w5100_priv, @@ -659,6 +695,10 @@ static int w5100_open(struct net_device *ndev) w5100_hw_start(priv); napi_enable(&priv->napi); netif_start_queue(ndev); + + if (priv->link_irq < 0 || w5100_get_link(ndev)) + netif_carrier_on(ndev); + return 0; } =20 @@ -678,6 +718,7 @@ static const struct ethtool_ops w5100_ethtool_ops =3D { .get_drvinfo =3D w5100_get_drvinfo, .get_msglevel =3D w5100_get_msglevel, .set_msglevel =3D w5100_set_msglevel, + .get_link =3D w5100_get_link, .get_regs_len =3D w5100_get_regs_len, .get_regs =3D w5100_get_regs, }; @@ -751,6 +792,8 @@ int w5100_probe(struct device *dev, const struct w5100_= ops *ops, priv->ndev =3D ndev; priv->ops =3D ops; priv->irq =3D irq; + priv->link_irq =3D ops->chip_id =3D=3D W5500 ? + fwnode_irq_get(dev_fwnode(dev), 1) : -ENODEV; =20 ndev->netdev_ops =3D &w5100_netdev_ops; ndev->ethtool_ops =3D &w5100_ethtool_ops; @@ -803,8 +846,21 @@ int w5100_probe(struct device *dev, const struct w5100= _ops *ops, if (err) goto err_hw; =20 + if (priv->link_irq >=3D 0) { + err =3D request_threaded_irq(priv->link_irq, NULL, + w5100_detect_link, + IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, + "w5100-link", priv->ndev); + if (err < 0) + goto err_link_irq; + } + return 0; =20 +err_link_irq: + free_irq(priv->irq, ndev); err_hw: destroy_workqueue(priv->xfer_wq); err_wq: @@ -820,6 +876,9 @@ void w5100_remove(struct device *dev) struct net_device *ndev =3D dev_get_drvdata(dev); struct w5100_priv *priv =3D netdev_priv(ndev); =20 + if (priv->link_irq >=3D 0) + free_irq(priv->link_irq, ndev); + w5100_hw_reset(priv); free_irq(priv->irq, ndev); =20 @@ -842,6 +901,9 @@ static int w5100_suspend(struct device *dev) netif_carrier_off(ndev); netif_device_detach(ndev); =20 + if (priv->link_irq >=3D 0) + disable_irq(priv->link_irq); + w5100_hw_close(priv); } return 0; @@ -856,7 +918,13 @@ static int w5100_resume(struct device *dev) w5100_hw_reset(priv); w5100_hw_start(priv); =20 + if (priv->link_irq >=3D 0) + enable_irq(priv->link_irq); + netif_device_attach(ndev); + + if (priv->link_irq < 0 || w5100_get_link(ndev)) + netif_carrier_on(ndev); } return 0; } --=20 2.55.0