net: zynq_gem: Add a 10ms delay in zynq_gem_init()
Subsystems (2)
PATCH 1/1 net: zynq_gem: Add a 10ms delay in zynq_gem_init()
In our system using ZynqMP with an external SGMII PHY it's necessary to wait a short while after the configuration in zynq_gem_init() before the xfer starts. Otherwise the first packet(s) might get dropped, resulting in a delay at the start of the ethernet transfers.
This patch adds a minimal delay of 10ms which fixes problems of dropped first packages.
--- drivers/net/zynq_gem.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/zynq_gem.c +7 -0
@@ -522,6 +522,13 @@ static int zynq_gem_init(struct udevice *dev)return ret; } } + +/* +* Some additional minimal delay seems to be needed so that +* the first packet will be sent correctly +*/ +mdelay (10 ); +setbits_le32 (®s->nwctrl,ZYNQ_GEM_NWCTRL_RXEN_MASK |ZYNQ_GEM_NWCTRL_TXEN_MASK );
Signature · 1 line
2.39.0
+
Hi Stefan,
Quoted 29 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Stefan Roese
Sent: Wednesday, January 11, 2023 1:01 PM
To: [email protected]
Cc: Michal Simek <[email protected]>; Ramon Fried <[email protected]>; Sean Anderson <[email protected]>
Subject: [PATCH] net:zynq_gem: Add a 10ms delay inzynq_gem_init()In our system using ZynqMP with an external SGMII PHY it's necessary to wait a short while after the configuration in
zynq_gem_init()before the xfer starts. Otherwise the first packet(s) might get dropped, resulting in a delay at the start of the ethernet transfers.This patch adds a minimal delay of 10ms which fixes problems of dropped first packages.
Signed-off-by Stefan Roese <[email protected]>Cc Michal Simek <[email protected]>Cc Ramon Fried <[email protected]>Cc Sean Anderson <[email protected]>--- drivers/net/zynq_gem.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/net/zynq_gem.c index renamed from drivers/net/zynq_gem.c +0
-0
507b19b75975..26e468766871100644
drivers/net/zynq_gem.c static int zynq_gem_init(struct udevice *dev) · line 531
Quoted 10 lines
drivers/net/zynq_gem.c +7
-0@@ -522,6 +522,13 @@ static int zynq_gem_init(struct udevice *dev)return ret; } } + +/* +* Some additional minimal delay seems to be needed so that +* the first packet will be sent correctly +*/ +mdelay (10 ); +
Thanks for the patch. The PCS status check in your v1 seems valid. However, this delay of 10 msecs should not be necessary. If the PCS status (when autoneg is enabled with the external PHY on your board) shows link up, that's enough. Could you please consider the following to investigate why initial packets are lost?
-> If the external PHY on your board has a hardware reset please consider updating the reset-assert-us and reset-deassert-us properties to ensure PHY is ready before access.
-> Can you please check if there's any link stability issues in the initial msecs? Monitoring the serdes/GTR SGMII lane that's setup on ZynqMP will be useful.
Regards,
Harini
Hi Harini,
Quoted 39 lines · Harini
+
Hi Stefan,Quoted 36 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Stefan Roese
Sent: Wednesday, January 11, 2023 1:01 PM
To: [email protected]
Cc: Michal Simek <[email protected]>; Ramon Fried <[email protected]>; Sean Anderson <[email protected]>
Subject: [PATCH] net:zynq_gem: Add a 10ms delay inzynq_gem_init()In our system using ZynqMP with an external SGMII PHY it's necessary to wait a short while after the configuration in
zynq_gem_init()before the xfer starts. Otherwise the first packet(s) might get dropped, resulting in a delay at the start of the ethernet transfers.This patch adds a minimal delay of 10ms which fixes problems of dropped first packages.
Signed-off-by Stefan Roese <[email protected]>Cc Michal Simek <[email protected]>Cc Ramon Fried <[email protected]>Cc Sean Anderson <[email protected]>--- drivers/net/zynq_gem.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/net/zynq_gem.c index renamed from drivers/net/zynq_gem.c +0
-0
507b19b75975..26e468766871100644drivers/net/zynq_gem.c +4
-0@@ -522,6 +522,13 @@ static int zynq_gem_init(struct udevice *dev)return ret; } } + +/* +* Some additional minimal delay seems to be needed so that +* the first packet will be sent correctly
Quoted 8 lines
drivers/net/zynq_gem.c static int zynq_gem_init(struct udevice *dev) · line 531
Quoted 3 lines
drivers/net/zynq_gem.c +3
-0+*/ +mdelay (10 ); +Thanks for the patch. The PCS status check in your v1 seems valid. However, this delay of 10 msecs should not be necessary. If the PCS status (when autoneg is enabled with the external PHY on your board) shows link up, that's enough.
Unfortunately this is not the case. Regardless of using the PCS check from the v1 patch from yesterday, such a minimal delay is necessary on our setup.
Quoted 5 lines
Could you please consider the following
to investigate why initial packets are lost?
-> If the external PHY on your board has a hardware reset please consider updating the reset-assert-us and reset-deassert-us properties to ensure PHY is ready before access.
Not sure if this will help. See my comment at the end please for this.
Quoted 3 lines
-> Can you please check if there's any link stability issues in the initial msecs? Monitoring the serdes/GTR SGMII lane that's setup on ZynqMP will be useful.
I tested 2 situations:
a) Starting network traffic very early in U-Boot, before the aneg link establishment has finished (preboot=ping 192.168.1.5):
[8.448005 0.007878] Net:
[8.453711 0.005706] ZYNQ GEM: ff0d0000, mdio bus ff0d0000, phyaddr 0, interface sgmii [8.454449 0.000739] eth0: ethernet@ff0d0000
[8.454752 0.000303] ethernet@ff0d0000 Waiting for PHY auto negotiation to complete..... done [10.915882 2.461130] Using ethernet@ff0d0000 device
[10.916228 0.000346] host 192.168.1.5 is alive
[10.917247 0.001019] Hit any key to stop autoboot: 0
b) Late in U-Boot, after waiting for some seconds (or even minutes, it makes no difference) on the prompt (preboot=sleep 10;ping 192.168.1.5):
[4.655932 0.007849] Net:
[4.661612 0.005680] ZYNQ GEM: ff0d0000, mdio bus ff0d0000, phyaddr 0, interface sgmii [4.662367 0.000755] eth0: ethernet@ff0d0000
[14.671655 10.009288] Using ethernet@ff0d0000 device
[14.672018 0.000364] host 192.168.1.5 is alive
[14.673032 0.001014] Hit any key to stop autoboot: 0
The delay is needed in both cases. In a) you see, that the PHY aneg takes a bit of time to finish. The link is established at this time.
My feeling is that configuration of "pcscntrl" (or some other register) after phy_startup() in zynq_gem_init() introduces this necessity of this additional delay.
Thanks,
Stefan
Michal Simek
maintainerHi Stefan,
Quoted 90 lines · Stefan Roese
Hi Harini,
Quoted 39 lines · Harini
+
Hi Stefan,Quoted 36 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Stefan Roese
Sent: Wednesday, January 11, 2023 1:01 PM
To: [email protected]
Cc: Michal Simek <[email protected]>; Ramon Fried <[email protected]>; Sean Anderson <[email protected]>
Subject: [PATCH] net:zynq_gem: Add a 10ms delay inzynq_gem_init()In our system using ZynqMP with an external SGMII PHY it's necessary to wait a short while after the configuration in
zynq_gem_init()before the xfer starts. Otherwise the first packet(s) might get dropped, resulting in a delay at the start of the ethernet transfers.This patch adds a minimal delay of 10ms which fixes problems of dropped first packages.
Signed-off-by Stefan Roese <[email protected]>Cc Michal Simek <[email protected]>Cc Ramon Fried <[email protected]>Cc Sean Anderson <[email protected]>---
drivers/net/zynq_gem.c| 7 +++++++1 file changed, 7 insertions(+)drivers/net/zynq_gem.c index renamed from drivers/net/zynq_gem.c +0
-0
507b19b75975..26e468766871100644drivers/net/zynq_gem.c +4
-0@@ -522,6 +522,13 @@ static int zynq_gem_init(struct udevice *dev) return ret; } } + + /* +* Some additional minimal delay seems to be needed so that +* the first packet will be sent correctly Quoted 8 lines
drivers/net/zynq_gem.c static int zynq_gem_init(struct udevice *dev) · line 531
Quoted 3 lines
drivers/net/zynq_gem.c +3
-0+*/ + mdelay(10); +Thanks for the patch. The PCS status check in your v1 seems valid. However, this delay of 10 msecs should not be necessary. If the PCS status (when autoneg is enabled with the external PHY on your board) shows link up, that's enough.
Unfortunately this is not the case. Regardless of using the PCS check from the v1 patch from yesterday, such a minimal delay is necessary on our setup.
Quoted 5 lines
Could you please consider the following
to investigate why initial packets are lost?
-> If the external PHY on your board has a hardware reset please consider updating the reset-assert-us and reset-deassert-us properties to ensure PHY is ready before access.Not sure if this will help. See my comment at the end please for this.
Quoted 3 lines
-> Can you please check if there's any link stability issues in the initial msecs? Monitoring the serdes/GTR SGMII lane that's setup on ZynqMP will be useful.
I tested 2 situations:
a) Starting network traffic very early in U-Boot, before the aneg link establishment has finished (preboot=ping 192.168.1.5):
[8.448005 0.007878] Net:
[8.453711 0.005706] ZYNQ GEM:ff0d0000, mdio busff0d0000, phyaddr 0, interface sgmii [8.454449 0.000739] eth0: ethernet@ff0d0000
[8.454752 0.000303] ethernet@ff0d0000 Waiting for PHY auto negotiation to complete..... done [10.915882 2.461130] Using ethernet@ff0d0000 device
[10.916228 0.000346] host 192.168.1.5 is alive
[10.917247 0.001019] Hit any key to stop autoboot: 0b) Late in U-Boot, after waiting for some seconds (or even minutes, it makes no difference) on the prompt (preboot=sleep 10;ping 192.168.1.5):
[4.655932 0.007849] Net:
[4.661612 0.005680] ZYNQ GEM:ff0d0000, mdio busff0d0000, phyaddr 0, interface sgmii [4.662367 0.000755] eth0: ethernet@ff0d0000
[14.671655 10.009288] Using ethernet@ff0d0000 device
[14.672018 0.000364] host 192.168.1.5 is alive
[14.673032 0.001014] Hit any key to stop autoboot: 0
Quoted 6 lines
The delay is needed in both cases. In a) you see, that the PHY aneg takes a bit of time to finish. The link is established at this time.
My feeling is that configuration of "pcscntrl" (or some other register) after
phy_startup()inzynq_gem_init()introduces this necessity of this additional delay.
I think this will require further investigation what it is really happening.
If this is related to SGMII only or also RGMII. Obviously adding some delay without proper explanation is not the right way to go. Pretty much if something is not stable there should be a way to pooling any bit.
There is ongoing effort on moving clock from direct register access to using firmware interface. And maybe this issue will be resolve by that that simply clock is not stable at the time when driver tries to enable RX/TX. And current clock driver is not waiting for clock to be stable but firmware base driver does it.
Thanks,
Michal
Hi Michal,
Quoted 97 lines · Michal Simek
Hi Stefan,
Quoted 94 lines · Stefan Roese
Hi Harini,
Quoted 39 lines · Harini
+
Hi Stefan,Quoted 36 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Stefan Roese
Sent: Wednesday, January 11, 2023 1:01 PM
To: [email protected]
Cc: Michal Simek <[email protected]>; Ramon Fried <[email protected]>; Sean Anderson <[email protected]>
Subject: [PATCH] net:zynq_gem: Add a 10ms delay inzynq_gem_init()In our system using ZynqMP with an external SGMII PHY it's necessary to wait a short while after the configuration in
zynq_gem_init()before the xfer starts. Otherwise the first packet(s) might get dropped, resulting in a delay at the start of the ethernet transfers.This patch adds a minimal delay of 10ms which fixes problems of dropped first packages.
Signed-off-by Stefan Roese <[email protected]>Cc Michal Simek <[email protected]>Cc Ramon Fried <[email protected]>Cc Sean Anderson <[email protected]>---
drivers/net/zynq_gem.c| 7 +++++++1 file changed, 7 insertions(+)drivers/net/zynq_gem.c index renamed from drivers/net/zynq_gem.c +0
-0
507b19b75975..26e468766871100644drivers/net/zynq_gem.c +4
-0@@ -522,6 +522,13 @@ static int zynq_gem_init(struct udevice *dev) return ret; } } + + /* +* Some additional minimal delay seems to be needed so that +* the first packet will be sent correctly Quoted 8 lines
drivers/net/zynq_gem.c static int zynq_gem_init(struct udevice *dev) · line 531
Quoted 3 lines
drivers/net/zynq_gem.c +3
-0+*/ + mdelay(10); +Thanks for the patch. The PCS status check in your v1 seems valid. However, this delay of 10 msecs should not be necessary. If the PCS status (when autoneg is enabled with the external PHY on your board) shows link up, that's enough.
Unfortunately this is not the case. Regardless of using the PCS check from the v1 patch from yesterday, such a minimal delay is necessary on our setup.
Quoted 5 lines
Could you please consider the following
to investigate why initial packets are lost?
-> If the external PHY on your board has a hardware reset please consider updating the reset-assert-us and reset-deassert-us properties to ensure PHY is ready before access.Not sure if this will help. See my comment at the end please for this.
Quoted 4 lines
-> Can you please check if there's any link stability issues in the initial
msecs? Monitoring the serdes/GTR SGMII lane that's setup on ZynqMP will be useful.I tested 2 situations:
a) Starting network traffic very early in U-Boot, before the aneg link establishment has finished (preboot=ping 192.168.1.5):
[8.448005 0.007878] Net:
[8.453711 0.005706] ZYNQ GEM:ff0d0000, mdio busff0d0000, phyaddr 0, interface sgmii [8.454449 0.000739] eth0: ethernet@ff0d0000
[8.454752 0.000303] ethernet@ff0d0000 Waiting for PHY auto negotiation to complete..... done [10.915882 2.461130] Using ethernet@ff0d0000 device
[10.916228 0.000346] host 192.168.1.5 is alive
[10.917247 0.001019] Hit any key to stop autoboot: 0b) Late in U-Boot, after waiting for some seconds (or even minutes, it makes no difference) on the prompt (preboot=sleep 10;ping 192.168.1.5):
[4.655932 0.007849] Net:
[4.661612 0.005680] ZYNQ GEM:ff0d0000, mdio busff0d0000, phyaddr 0, interface sgmii [4.662367 0.000755] eth0: ethernet@ff0d0000
[14.671655 10.009288] Using ethernet@ff0d0000 device
[14.672018 0.000364] host 192.168.1.5 is alive
[14.673032 0.001014] Hit any key to stop autoboot: 0The delay is needed in both cases. In a) you see, that the PHY aneg takes a bit of time to finish. The link is established at this time.
Quoted 6 lines
Quoted 3 lines
My feeling is that configuration of "pcscntrl" (or some other register) after
phy_startup()inzynq_gem_init()introduces this necessity of this additional delay.I think this will require further investigation what it is really happening.
If this is related to SGMII only or also RGMII. Obviously adding some delay without proper explanation is not the right way to go.
Agreed. I'm also not 100% satisfied with this "solution".
Quoted 1 line
Pretty much if something is not stable there should be a way to pooling any bit.
You mean polling (instead of pooling)? Again, the link is already established when "pcscntrl" is configured. I can try to double-check again, if I can poll for something in this "pcscntrl".
Quoted 2 lines
There is ongoing effort on moving clock from direct register access to using firmware interface. And maybe this issue will be resolve by that that simply clock is not stable at the time when driver tries to enable RX/TX. And current clock driver is not waiting for clock to be stable but firmware base driver does it.
As mentioned above, my feeling is that configuration of "pcscntrl" (or some other register) after phy_startup() in zynq_gem_init() introduces this necessity of this additional delay. If this is the case, then changes in the clock access won't make any difference here IIUTC.
Still I will do some more tests with this "pcscntrl" hopefully later today and will report back. Stay tuned...
Thanks,
Stefan