Skip to content

Commit

Permalink
net: ethernet: adi: adin1110: add reset GPIO
Browse files Browse the repository at this point in the history
Add an optional GPIO to be used for a hardware reset of the IC.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexandru Tachici authored and David S. Miller committed Oct 21, 2022
1 parent c0facc0 commit 36934ca
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions drivers/net/ethernet/adi/adin1110.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 36934ca

Please sign in to comment.