All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: gem: Workaround gmii2rgmii bridge DT node issue
@ 2022-01-14 12:08 Michal Simek
  2022-01-15 16:14 ` Ramon Fried
  2022-01-17  9:02 ` Michal Simek
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Simek @ 2022-01-14 12:08 UTC (permalink / raw)
  To: u-boot, git; +Cc: Ashok Reddy Soma, Joe Hershberger, Ramon Fried

From: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

For configurations with gmii2rgmii and external phy the DT nodes link
should be gem->gmii2rgmii->phy. But due to limitation in Linux driver
the DT is mentioned as gem->phy and gmii2rgmii->phy as shown in below DT.

ethernet@ff0c0000 {
	compatible = "cdns,zynqmp-gem\0cdns,gem";
	status = "okay";
	interrupt-parent = <0x04>;
	interrupts = <0x00 0x3b 0x04 0x00 0x3b 0x04>;
	reg = <0x00 0xff0c0000 0x00 0x1000>;
	clock-names = "pclk\0hclk\0tx_clk\0rx_clk\0tsu_clk";
	#address-cells = <0x01>;
	#size-cells = <0x00>;
	#stream-id-cells = <0x01>;
	iommus = <0x0d 0x875>;
	power-domains = <0x0c 0x1e>;
	clocks = <0x03 0x1f 0x03 0x69 0x03 0x2e 0x03 0x32 0x03 0x2c>;
	phy-handle = <0x0e>;
	phy-mode = "gmii";
	xlnx,ptp-enet-clock = <0x00>;
	local-mac-address = [ff ff ff ff ff ff];
	phandle = <0x4d>;

	mdio {
		#address-cells = <0x01>;
		#size-cells = <0x00>;
		phandle = <0x4e>;

		ethernet-phy@1 {
			reg = <0x01>;
			rxc-skew-ps = <0x708>;
			txc-skew-ps = <0x708>;
			phandle = <0x0e>;
		};

		gmii_to_rgmii_0@8 {
			compatible = "xlnx,gmii-to-rgmii-1.0";
			phy-handle = <0x0e>;
			reg = <0x08>;
			phandle = <0x4f>;
		};
	};
};

Since same DT is used in Linux and U-Boot we need to workaround this
issue by using the gmii2rgmii node which points to phy and we should
ignore the gem pointing to phy directly.

Do this workaround by updating priv->phydev->node value with
priv->phy_of_node only if it is not valid node.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/net/zynq_gem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index b751d28e611f..f238811786c6 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -338,7 +338,8 @@ static int zynq_phy_init(struct udevice *dev)
 				  ADVERTISED_Asym_Pause;
 
 	priv->phydev->advertising = priv->phydev->supported;
-	priv->phydev->node = priv->phy_of_node;
+	if (!ofnode_valid(priv->phydev->node))
+		priv->phydev->node = priv->phy_of_node;
 
 	return phy_config(priv->phydev);
 }
-- 
2.34.1


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

* Re: [PATCH] net: gem: Workaround gmii2rgmii bridge DT node issue
  2022-01-14 12:08 [PATCH] net: gem: Workaround gmii2rgmii bridge DT node issue Michal Simek
@ 2022-01-15 16:14 ` Ramon Fried
  2022-01-17  9:02 ` Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Ramon Fried @ 2022-01-15 16:14 UTC (permalink / raw)
  To: Michal Simek; +Cc: U-Boot Mailing List, git, Ashok Reddy Soma, Joe Hershberger

On Fri, Jan 14, 2022 at 2:08 PM Michal Simek <michal.simek@xilinx.com> wrote:
>
> From: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
>
> For configurations with gmii2rgmii and external phy the DT nodes link
> should be gem->gmii2rgmii->phy. But due to limitation in Linux driver
> the DT is mentioned as gem->phy and gmii2rgmii->phy as shown in below DT.
>
> ethernet@ff0c0000 {
>         compatible = "cdns,zynqmp-gem\0cdns,gem";
>         status = "okay";
>         interrupt-parent = <0x04>;
>         interrupts = <0x00 0x3b 0x04 0x00 0x3b 0x04>;
>         reg = <0x00 0xff0c0000 0x00 0x1000>;
>         clock-names = "pclk\0hclk\0tx_clk\0rx_clk\0tsu_clk";
>         #address-cells = <0x01>;
>         #size-cells = <0x00>;
>         #stream-id-cells = <0x01>;
>         iommus = <0x0d 0x875>;
>         power-domains = <0x0c 0x1e>;
>         clocks = <0x03 0x1f 0x03 0x69 0x03 0x2e 0x03 0x32 0x03 0x2c>;
>         phy-handle = <0x0e>;
>         phy-mode = "gmii";
>         xlnx,ptp-enet-clock = <0x00>;
>         local-mac-address = [ff ff ff ff ff ff];
>         phandle = <0x4d>;
>
>         mdio {
>                 #address-cells = <0x01>;
>                 #size-cells = <0x00>;
>                 phandle = <0x4e>;
>
>                 ethernet-phy@1 {
>                         reg = <0x01>;
>                         rxc-skew-ps = <0x708>;
>                         txc-skew-ps = <0x708>;
>                         phandle = <0x0e>;
>                 };
>
>                 gmii_to_rgmii_0@8 {
>                         compatible = "xlnx,gmii-to-rgmii-1.0";
>                         phy-handle = <0x0e>;
>                         reg = <0x08>;
>                         phandle = <0x4f>;
>                 };
>         };
> };
>
> Since same DT is used in Linux and U-Boot we need to workaround this
> issue by using the gmii2rgmii node which points to phy and we should
> ignore the gem pointing to phy directly.
>
> Do this workaround by updating priv->phydev->node value with
> priv->phy_of_node only if it is not valid node.
>
> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  drivers/net/zynq_gem.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index b751d28e611f..f238811786c6 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -338,7 +338,8 @@ static int zynq_phy_init(struct udevice *dev)
>                                   ADVERTISED_Asym_Pause;
>
>         priv->phydev->advertising = priv->phydev->supported;
> -       priv->phydev->node = priv->phy_of_node;
> +       if (!ofnode_valid(priv->phydev->node))
> +               priv->phydev->node = priv->phy_of_node;
>
>         return phy_config(priv->phydev);
>  }
> --
> 2.34.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

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

* Re: [PATCH] net: gem: Workaround gmii2rgmii bridge DT node issue
  2022-01-14 12:08 [PATCH] net: gem: Workaround gmii2rgmii bridge DT node issue Michal Simek
  2022-01-15 16:14 ` Ramon Fried
@ 2022-01-17  9:02 ` Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2022-01-17  9:02 UTC (permalink / raw)
  To: U-Boot, git; +Cc: Ashok Reddy Soma, Joe Hershberger, Ramon Fried

pá 14. 1. 2022 v 13:08 odesílatel Michal Simek <michal.simek@xilinx.com> napsal:
>
> From: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
>
> For configurations with gmii2rgmii and external phy the DT nodes link
> should be gem->gmii2rgmii->phy. But due to limitation in Linux driver
> the DT is mentioned as gem->phy and gmii2rgmii->phy as shown in below DT.
>
> ethernet@ff0c0000 {
>         compatible = "cdns,zynqmp-gem\0cdns,gem";
>         status = "okay";
>         interrupt-parent = <0x04>;
>         interrupts = <0x00 0x3b 0x04 0x00 0x3b 0x04>;
>         reg = <0x00 0xff0c0000 0x00 0x1000>;
>         clock-names = "pclk\0hclk\0tx_clk\0rx_clk\0tsu_clk";
>         #address-cells = <0x01>;
>         #size-cells = <0x00>;
>         #stream-id-cells = <0x01>;
>         iommus = <0x0d 0x875>;
>         power-domains = <0x0c 0x1e>;
>         clocks = <0x03 0x1f 0x03 0x69 0x03 0x2e 0x03 0x32 0x03 0x2c>;
>         phy-handle = <0x0e>;
>         phy-mode = "gmii";
>         xlnx,ptp-enet-clock = <0x00>;
>         local-mac-address = [ff ff ff ff ff ff];
>         phandle = <0x4d>;
>
>         mdio {
>                 #address-cells = <0x01>;
>                 #size-cells = <0x00>;
>                 phandle = <0x4e>;
>
>                 ethernet-phy@1 {
>                         reg = <0x01>;
>                         rxc-skew-ps = <0x708>;
>                         txc-skew-ps = <0x708>;
>                         phandle = <0x0e>;
>                 };
>
>                 gmii_to_rgmii_0@8 {
>                         compatible = "xlnx,gmii-to-rgmii-1.0";
>                         phy-handle = <0x0e>;
>                         reg = <0x08>;
>                         phandle = <0x4f>;
>                 };
>         };
> };
>
> Since same DT is used in Linux and U-Boot we need to workaround this
> issue by using the gmii2rgmii node which points to phy and we should
> ignore the gem pointing to phy directly.
>
> Do this workaround by updating priv->phydev->node value with
> priv->phy_of_node only if it is not valid node.
>
> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  drivers/net/zynq_gem.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index b751d28e611f..f238811786c6 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -338,7 +338,8 @@ static int zynq_phy_init(struct udevice *dev)
>                                   ADVERTISED_Asym_Pause;
>
>         priv->phydev->advertising = priv->phydev->supported;
> -       priv->phydev->node = priv->phy_of_node;
> +       if (!ofnode_valid(priv->phydev->node))
> +               priv->phydev->node = priv->phy_of_node;
>
>         return phy_config(priv->phydev);
>  }
> --
> 2.34.1
>

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

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

end of thread, other threads:[~2022-01-17  9:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 12:08 [PATCH] net: gem: Workaround gmii2rgmii bridge DT node issue Michal Simek
2022-01-15 16:14 ` Ramon Fried
2022-01-17  9:02 ` Michal Simek

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.