From: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Parthiban Veerasooran <parthiban.veerasooran@microchip.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Marcelo Schmitt <marcelo.schmitt@analog.com>
Cc: <netdev@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Ciprian Regus <ciprian.regus@analog.com>,
Iustin Stolniceanu <iustin.stolniceanu@analog.com>
Subject: [PATCH net-next 1/5] net: ethernet: oa_tc6: Allow custom reset settle time values
Date: Tue, 3 Nov 2026 18:09:14 +0200 [thread overview]
Message-ID: <20261103160918.409701-2-iustin.stolniceanu@analog.com> (raw)
In-Reply-To: <20261103160918.409701-1-iustin.stolniceanu@analog.com>
From: Ciprian Regus <ciprian.regus@analog.com>
oa_tc6_init() waits a fixed 1 ms after deasserting the reset GPIO
before accessing the MAC-PHY. The reset timing parameters of a MAC-PHY
device are outside of the OA TC6 scope. For example, the ADIN1110 needs
up to 50 ms after RESET is deasserted before its registers can be
accessed.
Add a reset_settle_us field to struct oa_tc6_quirks so drivers can
set this time. If it is not set, the GPIO reset keeps the existing
1 ms wait.
When set, also apply the wait after the software reset, before polling
STATUS0 for RESETC. This is needed for devices that tristate their SDO
pin during a reset. Drivers that don't set reset_settle_us keep the
current behaviour.
Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Co-developed-by: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
Signed-off-by: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
---
drivers/net/ethernet/oa_tc6.c | 18 ++++++++++++++----
include/linux/oa_tc6.h | 2 ++
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
index 364027c39fa4..68437b226528 100644
--- a/drivers/net/ethernet/oa_tc6.c
+++ b/drivers/net/ethernet/oa_tc6.c
@@ -89,6 +89,7 @@ struct oa_tc6 {
bool int_flag;
bool disable_traffic;
bool prot_ctrl;
+ u32 reset_settle_us;
enum oa_tc6_quirk_flag quirk_flags;
struct gpio_desc *reset_gpio;
};
@@ -652,6 +653,9 @@ static int oa_tc6_sw_reset_macphy(struct oa_tc6 *tc6)
if (ret)
return ret;
+ if (tc6->reset_settle_us)
+ fsleep(tc6->reset_settle_us);
+
/* Poll for soft reset complete for every 1ms until 1s timeout */
ret = readx_poll_timeout(oa_tc6_read_status0, tc6, regval,
regval & OA_TC6_STATUS0_RESETC,
@@ -1474,8 +1478,10 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
mutex_init(&tc6->spi_ctrl_lock);
spin_lock_init(&tc6->tx_skb_lock);
- if (quirks)
+ if (quirks) {
tc6->quirk_flags = quirks->quirk_flags;
+ tc6->reset_settle_us = quirks->reset_settle_us;
+ }
/* Set the SPI controller to pump at realtime priority */
tc6->spi->rt = true;
@@ -1515,12 +1521,16 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
"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.
+ /* Keep the reset asserted for 10 us and then allow the reset
+ * settle time (1 ms by default) for the crystal oscillator
+ * startup.
*/
fsleep(10);
gpiod_set_value_cansleep(tc6->reset_gpio, 0);
- fsleep(1000);
+ if (tc6->reset_settle_us)
+ fsleep(tc6->reset_settle_us);
+ else
+ fsleep(1000);
}
/* Check the PROTE bit status so that we can reset the device */
diff --git a/include/linux/oa_tc6.h b/include/linux/oa_tc6.h
index 27f652d4920b..139dd4c33950 100644
--- a/include/linux/oa_tc6.h
+++ b/include/linux/oa_tc6.h
@@ -72,6 +72,8 @@ enum oa_tc6_quirk_flag {
struct oa_tc6_quirks {
enum oa_tc6_quirk_flag quirk_flags;
+ /* Wait after the GPIO reset (default 1 ms) and the software reset */
+ u32 reset_settle_us;
};
struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
--
2.43.0
next prev parent reply other threads:[~2026-11-03 16:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 16:09 [PATCH net-next 0/5] net: ethernet: adi: adin1110: Add OPEN Alliance TC6 support Iustin Stolniceanu
2026-11-03 16:09 ` Iustin Stolniceanu [this message]
2026-11-03 16:09 ` [PATCH net-next 2/5] net: ethernet: oa_tc6: Add support for MDIO indirect access Iustin Stolniceanu
2026-11-03 16:09 ` [PATCH net-next 3/5] dt-bindings: net: adi,adin1110: Add adi,spi-oa-tc6 Iustin Stolniceanu
2026-11-03 16:09 ` [PATCH net-next 4/5] net: ethernet: adi: adin1110: Add OA TC6 protocol support for ADIN1110 Iustin Stolniceanu
2026-11-03 16:09 ` [PATCH net-next 5/5] net: phy: adin1100: Skip the soft reset on ADIN1110/ADIN2111 Iustin Stolniceanu
2026-11-03 20:49 ` [PATCH net-next 0/5] net: ethernet: adi: adin1110: Add OPEN Alliance TC6 support Andrew Lunn
2026-11-03 20:54 ` Andrew Lunn
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=20261103160918.409701-2-iustin.stolniceanu@analog.com \
--to=iustin.stolniceanu@analog.com \
--cc=andrew+netdev@lunn.ch \
--cc=ciprian.regus@analog.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=marcelo.schmitt@analog.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®