Skip to content

Commit 36934ca

Browse files
tachicialexdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c0facc0 commit 36934ca

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/net/ethernet/adi/adin1110.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,9 +1082,30 @@ static void adin1110_adjust_link(struct net_device *dev)
10821082
*/
10831083
static int adin1110_check_spi(struct adin1110_priv *priv)
10841084
{
1085+
struct gpio_desc *reset_gpio;
10851086
int ret;
10861087
u32 val;
10871088

1089+
reset_gpio = devm_gpiod_get_optional(&priv->spidev->dev, "reset",
1090+
GPIOD_OUT_LOW);
1091+
if (reset_gpio) {
1092+
/* MISO pin is used for internal configuration, can't have
1093+
* anyone else disturbing the SDO line.
1094+
*/
1095+
spi_bus_lock(priv->spidev->controller);
1096+
1097+
gpiod_set_value(reset_gpio, 1);
1098+
fsleep(10000);
1099+
gpiod_set_value(reset_gpio, 0);
1100+
1101+
/* Need to wait 90 ms before interacting with
1102+
* the MAC after a HW reset.
1103+
*/
1104+
fsleep(90000);
1105+
1106+
spi_bus_unlock(priv->spidev->controller);
1107+
}
1108+
10881109
ret = adin1110_read_reg(priv, ADIN1110_PHY_ID, &val);
10891110
if (ret < 0)
10901111
return ret;

0 commit comments

Comments
 (0)