All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qingfang Deng <qingfang.deng@linux.dev>
To: Alessandro Zini <alessandro.zini@siemens.com>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Parthiban Veerasooran <parthiban.veerasooran@microchip.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next v2 2/2] net: ethernet: oa_tc6: add reset-gpios support
Date: Wed, 16 Sep 2026 16:40:34 +0800	[thread overview]
Message-ID: <d29a20bc-eaf1-4745-9470-188613965c46@linux.dev> (raw)
In-Reply-To: <20260916075349.21822-3-alessandro.zini@siemens.com>

Hi,

On 2026/9/16 15:53, Alessandro Zini wrote:
> 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(). If specified in
> the device tree, assert the hardware reset line for 10 us and allow 1 ms
> settle time for crystal oscillator startup before performing the initial
> TC6 control protection check and software reset.
>
> Suggested-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
> Signed-off-by: Alessandro Zini <alessandro.zini@siemens.com>
> ---
> 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 | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
>
> diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
> index 6fcc5f561d560..a697e2cb99cd8 100644
> --- a/drivers/net/ethernet/oa_tc6.c
> +++ b/drivers/net/ethernet/oa_tc6.c
> @@ -11,6 +11,8 @@
>   #include <linux/mdio.h>
>   #include <linux/phy.h>
>   #include <linux/oa_tc6.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/delay.h>
>   
>   /* Control command header */
>   #define OA_TC6_CTRL_HEADER_DATA_NOT_CTRL	BIT(31)
> @@ -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 {
> @@ -1503,6 +1506,24 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
>   	if (!tc6->spi_data_rx_buf)
>   		return NULL;
>   
> +	tc6->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset",
> +						  GPIOD_OUT_LOW);

Please use GPIOD_OUT_HIGH here, so the reset pin is initially asserted, 
and the first gpiod_set_value_cansleep below can be removed. See 
function __mdiobus_register as an example.

> +	if (IS_ERR(tc6->reset_gpio)) {
> +		dev_err_probe(&spi->dev, PTR_ERR(tc6->reset_gpio),
> +			      "Failed to get reset GPIO\n");
> +		return NULL;
> +	}
> +
> +	if (tc6->reset_gpio) {
> +		/* Assert hardware reset for 10 us (datasheet specifies min 5 us)
> +		 * and allow 1 ms settle time for crystal oscillator startup.
> +		 */
> +		gpiod_set_value_cansleep(tc6->reset_gpio, 1);
> +		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) {

Kind regards,


  reply	other threads:[~2026-09-16  8:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  7:53 [PATCH net-next v2 0/2] net: ethernet: oa_tc6: add reset-gpios support Alessandro Zini
2026-09-16  7:53 ` [PATCH net-next v2 1/2] dt-bindings: net: microchip,lan8650: add reset-gpios property Alessandro Zini
2026-09-18  9:43   ` Krzysztof Kozlowski
2026-09-16  7:53 ` [PATCH net-next v2 2/2] net: ethernet: oa_tc6: add reset-gpios support Alessandro Zini
2026-09-16  8:40   ` Qingfang Deng [this message]
2026-09-17  7:54   ` sashiko-bot
2026-09-17  8:45   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d29a20bc-eaf1-4745-9470-188613965c46@linux.dev \
    --to=qingfang.deng@linux.dev \
    --cc=alessandro.zini@siemens.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.