From 566bdb96dae585e02e688519b189e0440098e811 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Wed, 25 Mar 2020 10:01:48 +0100 Subject: [PATCH] net: bcmgenet: move PHY initialization from probe() to start() Fix random network failures on subsequent network access by forcing PHY initialization on every network access. This also fixes sudden link drop from 100baseT to 10baseT observed from time to time. Signed-off-by: Marek Szyprowski Change-Id: I5bb55ce6546dec5449afea1bef036458563f287c --- drivers/net/bcmgenet.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/bcmgenet.c b/drivers/net/bcmgenet.c index ace1331362..628dd774d3 100644 --- a/drivers/net/bcmgenet.c +++ b/drivers/net/bcmgenet.c @@ -466,11 +466,17 @@ static int bcmgenet_adjust_link(struct bcmgenet_eth_priv *priv) return 0; } +static int bcmgenet_phy_init(struct bcmgenet_eth_priv *priv, void *dev); + static int bcmgenet_gmac_eth_start(struct udevice *dev) { struct bcmgenet_eth_priv *priv = dev_get_priv(dev); int ret; + ret = bcmgenet_phy_init(priv, dev); + if (ret) + return ret; + priv->tx_desc_base = priv->mac_reg + GENET_TX_OFF; priv->rx_desc_base = priv->mac_reg + GENET_RX_OFF; @@ -664,7 +670,7 @@ static int bcmgenet_eth_probe(struct udevice *dev) priv->bus = miiphy_get_dev_by_name(name); - return bcmgenet_phy_init(priv, dev); + return 0; } static void bcmgenet_gmac_eth_stop(struct udevice *dev) -- 2.34.1