diff options
author | Marek Vasut <marek.vasut+renesas@gmail.com> | 2018-06-18 04:03:01 +0200 |
---|---|---|
committer | Marek Vasut <marek.vasut+renesas@gmail.com> | 2018-06-19 06:15:55 +0200 |
commit | 159b3292266aab1064a594063f7ac5565140121a (patch) | |
tree | bd2031552aa4a130115426619e54ca556db2c5fb /drivers | |
parent | 701db6e9c62ce1f61ec83a75b0367b4d46284e27 (diff) |
net: sh_eth: Support reset GPIO both in mac and phy node
The recent DTs have the PHY reset GPIO in the PHY node rather than
the ethernet MAC node, support extracting the PHY reset GPIO info
from both the PHY node and ethernet MAC node.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/sh_eth.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 645cde8e4a..2e1123c488 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -810,6 +810,7 @@ static int sh_ether_probe(struct udevice *udev) struct eth_pdata *pdata = dev_get_platdata(udev); struct sh_ether_priv *priv = dev_get_priv(udev); struct sh_eth_dev *eth = &priv->shdev; + struct ofnode_phandle_args phandle_args; struct mii_dev *mdiodev; int ret; @@ -819,8 +820,16 @@ static int sh_ether_probe(struct udevice *udev) if (ret < 0) return ret; - gpio_request_by_name(udev, "reset-gpios", 0, &priv->reset_gpio, - GPIOD_IS_OUT); + ret = dev_read_phandle_with_args(udev, "phy-handle", NULL, 0, 0, &phandle_args); + if (!ret) { + gpio_request_by_name_nodev(phandle_args.node, "reset-gpios", 0, + &priv->reset_gpio, GPIOD_IS_OUT); + } + + if (!dm_gpio_is_valid(&priv->reset_gpio)) { + gpio_request_by_name(udev, "reset-gpios", 0, &priv->reset_gpio, + GPIOD_IS_OUT); + } mdiodev = mdio_alloc(); if (!mdiodev) { |