summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@gmail.com>2018-06-18 04:02:15 +0200
committerMarek Vasut <marek.vasut+renesas@gmail.com>2018-06-19 06:15:55 +0200
commit701db6e9c62ce1f61ec83a75b0367b4d46284e27 (patch)
tree58d94e8c09349d2dbad88118335993aa5f83432b /drivers
parent536fb5d47c350de0a67279c344470119a9f53886 (diff)
net: ravb: 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/ravb.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c
index 0dd2792c60..749562db96 100644
--- a/drivers/net/ravb.c
+++ b/drivers/net/ravb.c
@@ -466,6 +466,7 @@ static int ravb_probe(struct udevice *dev)
{
struct eth_pdata *pdata = dev_get_platdata(dev);
struct ravb_priv *eth = dev_get_priv(dev);
+ struct ofnode_phandle_args phandle_args;
struct mii_dev *mdiodev;
void __iomem *iobase;
int ret;
@@ -477,8 +478,16 @@ static int ravb_probe(struct udevice *dev)
if (ret < 0)
goto err_mdio_alloc;
- gpio_request_by_name(dev, "reset-gpios", 0, &eth->reset_gpio,
- GPIOD_IS_OUT);
+ ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0, &phandle_args);
+ if (!ret) {
+ gpio_request_by_name_nodev(phandle_args.node, "reset-gpios", 0,
+ &eth->reset_gpio, GPIOD_IS_OUT);
+ }
+
+ if (!dm_gpio_is_valid(&eth->reset_gpio)) {
+ gpio_request_by_name(dev, "reset-gpios", 0, &eth->reset_gpio,
+ GPIOD_IS_OUT);
+ }
mdiodev = mdio_alloc();
if (!mdiodev) {