All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next 1/2] net: ethernet: adi: adin1110: add reset GPIO
@ 2022-10-19 17:13 Alexandru Tachici
  2022-10-19 17:13 ` [net-next 2/2] dt-bindings: net: adin1110: Document reset Alexandru Tachici
  2022-10-21 12:20 ` [net-next 1/2] net: ethernet: adi: adin1110: add reset GPIO patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Alexandru Tachici @ 2022-10-19 17:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: andrew, linux, davem, edumazet, kuba, pabeni, netdev, devicetree,
	krzysztof.kozlowski+dt, robh+dt

Add an optional GPIO to be used for a hardware reset of the IC.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
---
 drivers/net/ethernet/adi/adin1110.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/ethernet/adi/adin1110.c b/drivers/net/ethernet/adi/adin1110.c
index 78ded19dd8c1..3e090ff9b966 100644
--- a/drivers/net/ethernet/adi/adin1110.c
+++ b/drivers/net/ethernet/adi/adin1110.c
@@ -1082,9 +1082,30 @@ static void adin1110_adjust_link(struct net_device *dev)
  */
 static int adin1110_check_spi(struct adin1110_priv *priv)
 {
+	struct gpio_desc *reset_gpio;
 	int ret;
 	u32 val;
 
+	reset_gpio = devm_gpiod_get_optional(&priv->spidev->dev, "reset",
+					     GPIOD_OUT_LOW);
+	if (reset_gpio) {
+		/* MISO pin is used for internal configuration, can't have
+		 * anyone else disturbing the SDO line.
+		 */
+		spi_bus_lock(priv->spidev->controller);
+
+		gpiod_set_value(reset_gpio, 1);
+		fsleep(10000);
+		gpiod_set_value(reset_gpio, 0);
+
+		/* Need to wait 90 ms before interacting with
+		 * the MAC after a HW reset.
+		 */
+		fsleep(90000);
+
+		spi_bus_unlock(priv->spidev->controller);
+	}
+
 	ret = adin1110_read_reg(priv, ADIN1110_PHY_ID, &val);
 	if (ret < 0)
 		return ret;
-- 
2.34.1


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

* [net-next 2/2] dt-bindings: net: adin1110: Document reset
  2022-10-19 17:13 [net-next 1/2] net: ethernet: adi: adin1110: add reset GPIO Alexandru Tachici
@ 2022-10-19 17:13 ` Alexandru Tachici
  2022-10-20 23:48   ` Krzysztof Kozlowski
  2022-10-21 12:20 ` [net-next 1/2] net: ethernet: adi: adin1110: add reset GPIO patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Alexandru Tachici @ 2022-10-19 17:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: andrew, linux, davem, edumazet, kuba, pabeni, netdev, devicetree,
	krzysztof.kozlowski+dt, robh+dt

Document GPIO for HW reset.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
---
 Documentation/devicetree/bindings/net/adi,adin1110.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/adi,adin1110.yaml b/Documentation/devicetree/bindings/net/adi,adin1110.yaml
index b6bd8ee38a18..9de865295d7a 100644
--- a/Documentation/devicetree/bindings/net/adi,adin1110.yaml
+++ b/Documentation/devicetree/bindings/net/adi,adin1110.yaml
@@ -46,6 +46,10 @@ properties:
   interrupts:
     maxItems: 1
 
+  reset-gpios:
+    maxItems: 1
+    description: GPIO connected to active low reset
+
 required:
   - compatible
   - reg
-- 
2.34.1


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

* Re: [net-next 2/2] dt-bindings: net: adin1110: Document reset
  2022-10-19 17:13 ` [net-next 2/2] dt-bindings: net: adin1110: Document reset Alexandru Tachici
@ 2022-10-20 23:48   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-20 23:48 UTC (permalink / raw)
  To: Alexandru Tachici, linux-kernel
  Cc: andrew, linux, davem, edumazet, kuba, pabeni, netdev, devicetree,
	krzysztof.kozlowski+dt, robh+dt

On 19/10/2022 13:13, Alexandru Tachici wrote:
> Document GPIO for HW reset.
> 
> Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
> ---

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [net-next 1/2] net: ethernet: adi: adin1110: add reset GPIO
  2022-10-19 17:13 [net-next 1/2] net: ethernet: adi: adin1110: add reset GPIO Alexandru Tachici
  2022-10-19 17:13 ` [net-next 2/2] dt-bindings: net: adin1110: Document reset Alexandru Tachici
@ 2022-10-21 12:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-10-21 12:20 UTC (permalink / raw)
  To: Alexandru Tachici
  Cc: linux-kernel, andrew, linux, davem, edumazet, kuba, pabeni,
	netdev, devicetree, krzysztof.kozlowski+dt, robh+dt

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 19 Oct 2022 20:13:13 +0300 you wrote:
> Add an optional GPIO to be used for a hardware reset of the IC.
> 
> Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
> ---
>  drivers/net/ethernet/adi/adin1110.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)

Here is the summary with links:
  - [net-next,1/2] net: ethernet: adi: adin1110: add reset GPIO
    https://git.kernel.org/netdev/net-next/c/36934cac7aaf
  - [net-next,2/2] dt-bindings: net: adin1110: Document reset
    https://git.kernel.org/netdev/net-next/c/3bd5549bd479

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-10-21 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19 17:13 [net-next 1/2] net: ethernet: adi: adin1110: add reset GPIO Alexandru Tachici
2022-10-19 17:13 ` [net-next 2/2] dt-bindings: net: adin1110: Document reset Alexandru Tachici
2022-10-20 23:48   ` Krzysztof Kozlowski
2022-10-21 12:20 ` [net-next 1/2] net: ethernet: adi: adin1110: add reset GPIO patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.