net: zynq_gem: Wait for SGMII PCS link in zynq_gem_init()
authorStefan Roese <sr@denx.de>
Wed, 25 Jan 2023 07:09:08 +0000 (08:09 +0100)
committerMichal Simek <michal.simek@amd.com>
Fri, 27 Jan 2023 07:47:37 +0000 (08:47 +0100)
commita33ad8051e0fdcc2af34259006c470899ad8cd77
treeee0cd91187aba953b6375d5d819d9149bf4fe554
parentb387c258240c761f61fbcd0c9b33039275219002
net: zynq_gem: Wait for SGMII PCS link in zynq_gem_init()

In our system using ZynqMP with an external SGMII PHY it's necessary
to wait for the PCS link and auto negotiation to finish before the xfer
starts. Otherwise the first packet(s) might get dropped, resulting in a
delay at the start of the ethernet transfers.

This is only done when the PHY link is already up, which is done in
phy_startup(). As waiting for the PHY link bits via pcsstatus does not
make much sense, when the link is not available in general (e.g. no
cable connected).

This patch adds the necessary code including a minimal delay of 1 ms
which fixes problems of dropped first packages.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Katakam Harini <harini.katakam@amd.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Sean Anderson <sean.anderson@seco.com>
Link: https://lore.kernel.org/r/20230125070908.1343256-1-sr@denx.de
Signed-off-by: Michal Simek <michal.simek@amd.com>
drivers/net/zynq_gem.c