[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221019171314.86325-1-alexandru.tachici@analog.com>
Date: Wed, 19 Oct 2022 20:13:13 +0300
From: Alexandru Tachici <alexandru.tachici@...log.com>
To: <linux-kernel@...r.kernel.org>
CC: <andrew@...n.ch>, <linux@...linux.org.uk>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
<netdev@...r.kernel.org>, <devicetree@...r.kernel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <robh+dt@...nel.org>
Subject: [net-next 1/2] net: ethernet: adi: adin1110: add reset GPIO
Add an optional GPIO to be used for a hardware reset of the IC.
Signed-off-by: Alexandru Tachici <alexandru.tachici@...log.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
Powered by blists - more mailing lists