All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] net: ravb: Support reset GPIO both in mac and phy node
@ 2018-06-18  2:30 Marek Vasut
  2018-06-18  2:30 ` [U-Boot] [PATCH 2/3] net: sh_eth: " Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Marek Vasut @ 2018-06-18  2:30 UTC (permalink / raw)
  To: u-boot

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>
---
 drivers/net/ravb.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c
index 999894f0f6..d66fcef4e7 100644
--- a/drivers/net/ravb.c
+++ b/drivers/net/ravb.c
@@ -469,6 +469,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;
@@ -480,8 +481,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) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/3] net: sh_eth: Support reset GPIO both in mac and phy node
  2018-06-18  2:30 [U-Boot] [PATCH 1/3] net: ravb: Support reset GPIO both in mac and phy node Marek Vasut
@ 2018-06-18  2:30 ` Marek Vasut
  2018-06-18 21:09   ` Joe Hershberger
  2018-06-18  2:30 ` [U-Boot] [PATCH 3/3] ARM: dts: rmobile: Move the PHY reset GPIOs into PHY nodes Marek Vasut
  2018-06-18 21:08 ` [U-Boot] [PATCH 1/3] net: ravb: Support reset GPIO both in mac and phy node Joe Hershberger
  2 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2018-06-18  2:30 UTC (permalink / raw)
  To: u-boot

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>
---
 drivers/net/sh_eth.c | 13 +++++++++++--
 1 file 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) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 3/3] ARM: dts: rmobile: Move the PHY reset GPIOs into PHY nodes
  2018-06-18  2:30 [U-Boot] [PATCH 1/3] net: ravb: Support reset GPIO both in mac and phy node Marek Vasut
  2018-06-18  2:30 ` [U-Boot] [PATCH 2/3] net: sh_eth: " Marek Vasut
@ 2018-06-18  2:30 ` Marek Vasut
  2018-06-18 21:08 ` [U-Boot] [PATCH 1/3] net: ravb: Support reset GPIO both in mac and phy node Joe Hershberger
  2 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2018-06-18  2:30 UTC (permalink / raw)
  To: u-boot

Both the RAVB and SH ether driver now support parsing the PHY reset
GPIOs from both the PHY nodes and the MAC nodes, move the reset GPIOs
back into the PHY nodes to minimize DT difference between U-Boot and
Linux.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 arch/arm/dts/r8a77970-eagle.dts   | 2 +-
 arch/arm/dts/salvator-common.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/r8a77970-eagle.dts b/arch/arm/dts/r8a77970-eagle.dts
index 5b8b2f8704..5dcad63492 100644
--- a/arch/arm/dts/r8a77970-eagle.dts
+++ b/arch/arm/dts/r8a77970-eagle.dts
@@ -39,13 +39,13 @@
 	phy-handle = <&phy0>;
 	phy-mode = "rgmii-id";
 	status = "okay";
-	reset-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
 
 	phy0: ethernet-phy at 0 {
 		rxc-skew-ps = <1500>;
 		reg = <0>;
 		interrupt-parent = <&gpio1>;
 		interrupts = <17 IRQ_TYPE_LEVEL_LOW>;
+		reset-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
 	};
 };
 
diff --git a/arch/arm/dts/salvator-common.dtsi b/arch/arm/dts/salvator-common.dtsi
index 6b176ea36a..514c57b2c8 100644
--- a/arch/arm/dts/salvator-common.dtsi
+++ b/arch/arm/dts/salvator-common.dtsi
@@ -257,7 +257,6 @@
 	pinctrl-names = "default";
 	phy-handle = <&phy0>;
 	phy-mode = "rgmii-txid";
-	reset-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
 	status = "okay";
 
 	phy0: ethernet-phy at 0 {
@@ -265,6 +264,7 @@
 		reg = <0>;
 		interrupt-parent = <&gpio2>;
 		interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+		reset-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
 	};
 };
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/3] net: ravb: Support reset GPIO both in mac and phy node
  2018-06-18  2:30 [U-Boot] [PATCH 1/3] net: ravb: Support reset GPIO both in mac and phy node Marek Vasut
  2018-06-18  2:30 ` [U-Boot] [PATCH 2/3] net: sh_eth: " Marek Vasut
  2018-06-18  2:30 ` [U-Boot] [PATCH 3/3] ARM: dts: rmobile: Move the PHY reset GPIOs into PHY nodes Marek Vasut
@ 2018-06-18 21:08 ` Joe Hershberger
  2 siblings, 0 replies; 5+ messages in thread
From: Joe Hershberger @ 2018-06-18 21:08 UTC (permalink / raw)
  To: u-boot

On Sun, Jun 17, 2018 at 9:30 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> 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>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/3] net: sh_eth: Support reset GPIO both in mac and phy node
  2018-06-18  2:30 ` [U-Boot] [PATCH 2/3] net: sh_eth: " Marek Vasut
@ 2018-06-18 21:09   ` Joe Hershberger
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Hershberger @ 2018-06-18 21:09 UTC (permalink / raw)
  To: u-boot

On Sun, Jun 17, 2018 at 9:30 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> 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>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-18 21:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18  2:30 [U-Boot] [PATCH 1/3] net: ravb: Support reset GPIO both in mac and phy node Marek Vasut
2018-06-18  2:30 ` [U-Boot] [PATCH 2/3] net: sh_eth: " Marek Vasut
2018-06-18 21:09   ` Joe Hershberger
2018-06-18  2:30 ` [U-Boot] [PATCH 3/3] ARM: dts: rmobile: Move the PHY reset GPIOs into PHY nodes Marek Vasut
2018-06-18 21:08 ` [U-Boot] [PATCH 1/3] net: ravb: Support reset GPIO both in mac and phy node Joe Hershberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.