Devicetree
 help / color / mirror / Atom feed
* (no subject)
@ 2026-09-18 22:49 Alessandro Zini
  2026-09-18 22:49 ` [PATCH net-next v3 1/4] dt-bindings: net: microchip,lan8650: add reset-gpios property Alessandro Zini
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Alessandro Zini @ 2026-09-18 22:49 UTC (permalink / raw)
  To: Parthiban Veerasooran, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Ciprian Regus, Qingfang Deng, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, netdev, devicetree, linux-kernel, Alessandro Zini

Subject: [PATCH net-next v3 0/4] net: ethernet: oa_tc6: add reset-gpios
 support

This series adds optional reset GPIO support for OPEN Alliance 10BASE-T1x
MAC-PHY devices using the OA TC6 library, and documents the property for
the two MAC-PHYs currently bound to it.

Patch 1 and 2 document the optional reset-gpios property for the Microchip
LAN8650/1 and for the ADI ADIN1140/AD3306.

Patch 3 converts oa_tc6_init() to return an ERR_PTR instead of NULL, so
that -EPROBE_DEFER from the GPIO lookup added in patch 4 reaches the
driver core instead of being turned into -ENODEV.

Patch 4 implements optional reset GPIO handling in the common oa_tc6
library. The reset line is requested asserted, kept asserted for 10 us and
1 ms of settle time is allowed after deassertion for the crystal
oscillator startup, before the OPEN Alliance TC6 communication is started.

Changes in v3:
- Picked up Acked-by tag from Krzysztof on patch 1.
- Added patch 2, documenting the property for adi,ad3306 as well, since
  the reset handling lives in the common library and the adin1140 driver
  gets it too.
- Added patch 3, converting oa_tc6_init() to ERR_PTR, so that
  -EPROBE_DEFER is not lost.
- In patch 4, requested the GPIO with GPIOD_OUT_HIGH and dropped the now
  redundant gpiod_set_value_cansleep() call, as suggested by Qingfang
  Deng, propagated the dev_err_probe() return value, reworded the comment
  and sorted the new includes.

Changes in v2:
- Moved reset-gpios handling from the lan865x driver into the common oa_tc6
  library (drivers/net/ethernet/oa_tc6.c), so all MAC-PHY devices can make
  use of it, as suggested by Parthiban Veerasooran.

Alessandro Zini (4):
  dt-bindings: net: microchip,lan8650: add reset-gpios property
  dt-bindings: net: adi,ad3306: add reset-gpios property
  net: ethernet: oa_tc6: return ERR_PTR from oa_tc6_init()
  net: ethernet: oa_tc6: add reset-gpios support

 .../devicetree/bindings/net/adi,ad3306.yaml   |  5 ++
 .../bindings/net/microchip,lan8650.yaml       |  5 ++
 drivers/net/ethernet/adi/adin1140.c           |  4 +-
 .../net/ethernet/microchip/lan865x/lan865x.c  |  4 +-
 drivers/net/ethernet/oa_tc6.c                 | 46 +++++++++++++------
 5 files changed, 47 insertions(+), 17 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next v3 1/4] dt-bindings: net: microchip,lan8650: add reset-gpios property
  2026-09-18 22:49 Alessandro Zini
@ 2026-09-18 22:49 ` Alessandro Zini
  2026-09-18 22:49 ` [PATCH net-next v3 2/4] dt-bindings: net: adi,ad3306: " Alessandro Zini
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Alessandro Zini @ 2026-09-18 22:49 UTC (permalink / raw)
  To: Parthiban Veerasooran, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Ciprian Regus, Qingfang Deng, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, netdev, devicetree, linux-kernel, Alessandro Zini,
	Krzysztof Kozlowski

Add optional reset-gpios property to describe the connection to the
hardware RESET_N pin of the LAN8650/1 MAC-PHY.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Alessandro Zini <alessandro.zini@siemens.com>
---
Changes in v3:
- Picked up Acked-by tag.

Changes in v2:
- None
 Documentation/devicetree/bindings/net/microchip,lan8650.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/microchip,lan8650.yaml b/Documentation/devicetree/bindings/net/microchip,lan8650.yaml
index 766ff58147ae3..1b543ce307632 100644
--- a/Documentation/devicetree/bindings/net/microchip,lan8650.yaml
+++ b/Documentation/devicetree/bindings/net/microchip,lan8650.yaml
@@ -40,6 +40,11 @@ properties:
       Event.
     maxItems: 1
 
+  reset-gpios:
+    description:
+      GPIO connected to the active-low RESET_N pin of the MAC-PHY.
+    maxItems: 1
+
   spi-max-frequency:
     minimum: 15000000
     maximum: 25000000
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v3 2/4] dt-bindings: net: adi,ad3306: add reset-gpios property
  2026-09-18 22:49 Alessandro Zini
  2026-09-18 22:49 ` [PATCH net-next v3 1/4] dt-bindings: net: microchip,lan8650: add reset-gpios property Alessandro Zini
@ 2026-09-18 22:49 ` Alessandro Zini
  2026-09-24 11:50   ` Krzysztof Kozlowski
  2026-09-18 22:49 ` [PATCH net-next v3 3/4] net: ethernet: oa_tc6: return ERR_PTR from oa_tc6_init() Alessandro Zini
  2026-09-18 22:49 ` [PATCH net-next v3 4/4] net: ethernet: oa_tc6: add reset-gpios support Alessandro Zini
  3 siblings, 1 reply; 6+ messages in thread
From: Alessandro Zini @ 2026-09-18 22:49 UTC (permalink / raw)
  To: Parthiban Veerasooran, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Ciprian Regus, Qingfang Deng, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, netdev, devicetree, linux-kernel, Alessandro Zini

The ADIN1140/AD3306 MAC-PHY has an active-low hardware reset pin, and the
driver binds to the common OA TC6 library which is gaining support for an
optional reset GPIO. As the schema uses "unevaluatedProperties: false", a
board description using the property would otherwise be rejected.

Add the optional reset-gpios property to describe the connection to that
pin.

Signed-off-by: Alessandro Zini <alessandro.zini@siemens.com>
---
Changes in v3:
- New patch, so that a board using reset-gpios with the adi,adin1140 /
  adi,ad3306 compatibles is not rejected by dt_binding_check.
 Documentation/devicetree/bindings/net/adi,ad3306.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/adi,ad3306.yaml b/Documentation/devicetree/bindings/net/adi,ad3306.yaml
index 785d05c995dbb..8eb72562459f2 100644
--- a/Documentation/devicetree/bindings/net/adi,ad3306.yaml
+++ b/Documentation/devicetree/bindings/net/adi,ad3306.yaml
@@ -42,6 +42,11 @@ properties:
     description: Interrupt from the MAC-PHY for receive data available
       and error conditions
 
+  reset-gpios:
+    description:
+      GPIO connected to the active-low RESET_N pin of the MAC-PHY.
+    maxItems: 1
+
 required:
   - compatible
   - reg
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v3 3/4] net: ethernet: oa_tc6: return ERR_PTR from oa_tc6_init()
  2026-09-18 22:49 Alessandro Zini
  2026-09-18 22:49 ` [PATCH net-next v3 1/4] dt-bindings: net: microchip,lan8650: add reset-gpios property Alessandro Zini
  2026-09-18 22:49 ` [PATCH net-next v3 2/4] dt-bindings: net: adi,ad3306: " Alessandro Zini
@ 2026-09-18 22:49 ` Alessandro Zini
  2026-09-18 22:49 ` [PATCH net-next v3 4/4] net: ethernet: oa_tc6: add reset-gpios support Alessandro Zini
  3 siblings, 0 replies; 6+ messages in thread
From: Alessandro Zini @ 2026-09-18 22:49 UTC (permalink / raw)
  To: Parthiban Veerasooran, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Ciprian Regus, Qingfang Deng, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, netdev, devicetree, linux-kernel, Alessandro Zini

oa_tc6_init() returns NULL on failure, so the reason for the failure is
lost and both callers turn it into a plain -ENODEV. In preparation for
acquiring an optional reset GPIO, which can return -EPROBE_DEFER when the
GPIO provider is not available yet, the error code has to reach the driver
core, otherwise the SPI device would never be probed again.

Convert oa_tc6_init() to return an ERR_PTR on failure instead of NULL,
and update the lan865x and adin1140 callers to check with IS_ERR() and
propagate the error with PTR_ERR().

Signed-off-by: Alessandro Zini <alessandro.zini@siemens.com>
---
Changes in v3:
- New patch to allow proper propagation of error codes, such as
  -EPROBE_DEFER
 drivers/net/ethernet/adi/adin1140.c           |  4 +--
 .../net/ethernet/microchip/lan865x/lan865x.c  |  4 +--
 drivers/net/ethernet/oa_tc6.c                 | 27 ++++++++++---------
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/adi/adin1140.c b/drivers/net/ethernet/adi/adin1140.c
index 93710baca1517..adc6e2ef44f8c 100644
--- a/drivers/net/ethernet/adi/adin1140.c
+++ b/drivers/net/ethernet/adi/adin1140.c
@@ -725,8 +725,8 @@ static int adin1140_probe(struct spi_device *spi)
 	tc6_quirks.quirk_flags = OA_TC6_BROKEN_PHY;
 
 	priv->tc6 = oa_tc6_init(spi, netdev, &tc6_quirks);
-	if (!priv->tc6)
-		return -ENODEV;
+	if (IS_ERR(priv->tc6))
+		return PTR_ERR(priv->tc6);
 
 	ret = devm_add_action_or_reset(&spi->dev, adin1140_oa_tc6_remove,
 				       priv->tc6);
diff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c b/drivers/net/ethernet/microchip/lan865x/lan865x.c
index 26a2761332a5a..127afb9e9f141 100644
--- a/drivers/net/ethernet/microchip/lan865x/lan865x.c
+++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c
@@ -347,8 +347,8 @@ static int lan865x_probe(struct spi_device *spi)
 	INIT_WORK(&priv->multicast_work, lan865x_multicast_work_handler);
 
 	priv->tc6 = oa_tc6_init(spi, netdev, NULL);
-	if (!priv->tc6) {
-		ret = -ENODEV;
+	if (IS_ERR(priv->tc6)) {
+		ret = PTR_ERR(priv->tc6);
 		goto free_netdev;
 	}
 
diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
index 6fcc5f561d560..8c82bc8354ede 100644
--- a/drivers/net/ethernet/oa_tc6.c
+++ b/drivers/net/ethernet/oa_tc6.c
@@ -1453,7 +1453,7 @@ static int oa_tc6_check_ctrl_protection(struct oa_tc6 *tc6)
  * @quirks: device specific modifiers for the OA TC6 protocol.
  *
  * Return: pointer reference to the oa_tc6 structure if the MAC-PHY
- * initialization is successful otherwise NULL.
+ * initialization is successful otherwise an ERR_PTR.
  */
 struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
 			   struct oa_tc6_quirks *quirks)
@@ -1463,7 +1463,7 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
 
 	tc6 = devm_kzalloc(&spi->dev, sizeof(*tc6), GFP_KERNEL);
 	if (!tc6)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	tc6->spi = spi;
 	tc6->netdev = netdev;
@@ -1476,60 +1476,61 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
 
 	/* Set the SPI controller to pump at realtime priority */
 	tc6->spi->rt = true;
-	if (spi_setup(tc6->spi) < 0)
-		return NULL;
+	ret = spi_setup(tc6->spi);
+	if (ret < 0)
+		return ERR_PTR(ret);
 
 	tc6->spi_ctrl_tx_buf = devm_kzalloc(&tc6->spi->dev,
 					    OA_TC6_CTRL_SPI_BUF_SIZE,
 					    GFP_KERNEL);
 	if (!tc6->spi_ctrl_tx_buf)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	tc6->spi_ctrl_rx_buf = devm_kzalloc(&tc6->spi->dev,
 					    OA_TC6_CTRL_SPI_BUF_SIZE,
 					    GFP_KERNEL);
 	if (!tc6->spi_ctrl_rx_buf)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	tc6->spi_data_tx_buf = devm_kzalloc(&tc6->spi->dev,
 					    OA_TC6_SPI_DATA_BUF_SIZE,
 					    GFP_KERNEL);
 	if (!tc6->spi_data_tx_buf)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	tc6->spi_data_rx_buf = devm_kzalloc(&tc6->spi->dev,
 					    OA_TC6_SPI_DATA_BUF_SIZE,
 					    GFP_KERNEL);
 	if (!tc6->spi_data_rx_buf)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	/* Check the PROTE bit status so that we can reset the device */
 	ret = oa_tc6_check_ctrl_protection(tc6);
 	if (ret) {
 		dev_err(&tc6->spi->dev,
 			"Failed to check the protection mode: %d\n", ret);
-		return NULL;
+		return ERR_PTR(ret);
 	}
 
 	ret = oa_tc6_sw_reset_macphy(tc6);
 	if (ret) {
 		dev_err(&tc6->spi->dev,
 			"MAC-PHY software reset failed: %d\n", ret);
-		return NULL;
+		return ERR_PTR(ret);
 	}
 
 	ret = oa_tc6_unmask_macphy_error_interrupts(tc6);
 	if (ret) {
 		dev_err(&tc6->spi->dev,
 			"MAC-PHY error interrupts unmask failed: %d\n", ret);
-		return NULL;
+		return ERR_PTR(ret);
 	}
 
 	ret = oa_tc6_phy_init(tc6);
 	if (ret) {
 		dev_err(&tc6->spi->dev,
 			"MAC internal PHY initialization failed: %d\n", ret);
-		return NULL;
+		return ERR_PTR(ret);
 	}
 
 	ret = oa_tc6_enable_data_transfer(tc6);
@@ -1570,7 +1571,7 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
 
 phy_exit:
 	oa_tc6_phy_exit(tc6);
-	return NULL;
+	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(oa_tc6_init);
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v3 4/4] net: ethernet: oa_tc6: add reset-gpios support
  2026-09-18 22:49 Alessandro Zini
                   ` (2 preceding siblings ...)
  2026-09-18 22:49 ` [PATCH net-next v3 3/4] net: ethernet: oa_tc6: return ERR_PTR from oa_tc6_init() Alessandro Zini
@ 2026-09-18 22:49 ` Alessandro Zini
  3 siblings, 0 replies; 6+ messages in thread
From: Alessandro Zini @ 2026-09-18 22:49 UTC (permalink / raw)
  To: Parthiban Veerasooran, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Ciprian Regus, Qingfang Deng, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, netdev, devicetree, linux-kernel, Alessandro Zini

OPEN Alliance 10BASE-T1x MAC-PHY Serial Interface specification
(v1.1, section 8.2) defines an external RESET pin as an optional reset
source for the MAC-PHY.

Add support for an optional reset GPIO in oa_tc6_init(). The GPIO is
requested asserted, kept asserted for 10 us and, once deasserted, 1 ms of
settle time is allowed for the crystal oscillator startup before the
initial TC6 control protection check and software reset are performed.

As the reset handling lives in the common library, it is available to both
users of oa_tc6_init(), the lan865x and the adin1140 driver.

Suggested-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
Signed-off-by: Alessandro Zini <alessandro.zini@siemens.com>
---
Changes in v3:
- Request the GPIO with GPIOD_OUT_HIGH and drop the now redundant
  gpiod_set_value_cansleep(..., 1) call, as suggested by Qingfang Deng.
- Return the error from dev_err_probe() so that -EPROBE_DEFER is
  propagated to the driver core.
- Reworded comment to stay within 80 columns.
- Sorted the new includes into the existing include block.

Changes in v2:
- Moved reset GPIO handling from lan865x.c to common oa_tc6.c as suggested
  by Parthiban Veerasooran.
 drivers/net/ethernet/oa_tc6.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
index 8c82bc8354ede..364027c39fa4a 100644
--- a/drivers/net/ethernet/oa_tc6.c
+++ b/drivers/net/ethernet/oa_tc6.c
@@ -6,6 +6,8 @@
  */
 
 #include <linux/bitfield.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/iopoll.h>
 #include <linux/interrupt.h>
 #include <linux/mdio.h>
@@ -88,6 +90,7 @@ struct oa_tc6 {
 	bool disable_traffic;
 	bool prot_ctrl;
 	enum oa_tc6_quirk_flag quirk_flags;
+	struct gpio_desc *reset_gpio;
 };
 
 enum oa_tc6_header_type {
@@ -1504,6 +1507,22 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
 	if (!tc6->spi_data_rx_buf)
 		return ERR_PTR(-ENOMEM);
 
+	tc6->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset",
+						  GPIOD_OUT_HIGH);
+	if (IS_ERR(tc6->reset_gpio))
+		return ERR_PTR(dev_err_probe(&spi->dev,
+					     PTR_ERR(tc6->reset_gpio),
+					     "failed to get reset gpio\n"));
+
+	if (tc6->reset_gpio) {
+		/* Keep the reset asserted for 10 us and then allow 1 ms of
+		 * settle time for the crystal oscillator startup.
+		 */
+		fsleep(10);
+		gpiod_set_value_cansleep(tc6->reset_gpio, 0);
+		fsleep(1000);
+	}
+
 	/* Check the PROTE bit status so that we can reset the device */
 	ret = oa_tc6_check_ctrl_protection(tc6);
 	if (ret) {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v3 2/4] dt-bindings: net: adi,ad3306: add reset-gpios property
  2026-09-18 22:49 ` [PATCH net-next v3 2/4] dt-bindings: net: adi,ad3306: " Alessandro Zini
@ 2026-09-24 11:50   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-24 11:50 UTC (permalink / raw)
  To: Alessandro Zini
  Cc: Parthiban Veerasooran, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Ciprian Regus,
	Qingfang Deng, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	netdev, devicetree, linux-kernel

On Sat, Sep 19, 2026 at 12:49:32AM +0200, Alessandro Zini wrote:
> The ADIN1140/AD3306 MAC-PHY has an active-low hardware reset pin, and the
> driver binds to the common OA TC6 library which is gaining support for an
> optional reset GPIO. As the schema uses "unevaluatedProperties: false", a
> board description using the property would otherwise be rejected.

Whatever library takes or does, will not generate any warnings. I do not
see at all how unevaluatedFalse is relevant here. There is no way
changing library C code causes any warnings. At least as of now.

Also, no properties should be added because some library gets its
support. You add the property because hardware has it.

If the first sentence is correct, then it is enough and keep only this.

> Add the optional reset-gpios property to describe the connection to that
> pin.

This is also redundant, directly implied by the first one.

With drpoping of both:

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-24 11:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 22:49 Alessandro Zini
2026-09-18 22:49 ` [PATCH net-next v3 1/4] dt-bindings: net: microchip,lan8650: add reset-gpios property Alessandro Zini
2026-09-18 22:49 ` [PATCH net-next v3 2/4] dt-bindings: net: adi,ad3306: " Alessandro Zini
2026-09-24 11:50   ` Krzysztof Kozlowski
2026-09-18 22:49 ` [PATCH net-next v3 3/4] net: ethernet: oa_tc6: return ERR_PTR from oa_tc6_init() Alessandro Zini
2026-09-18 22:49 ` [PATCH net-next v3 4/4] net: ethernet: oa_tc6: add reset-gpios support Alessandro Zini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox