All generic cpsw code can move to probe, so the controller is only reset and configured once. Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx> --- drivers/net/cpsw.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index d745737aa3..55d7ad5f5b 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -801,7 +801,7 @@ static int cpsw_open(struct eth_device *edev) { struct cpsw_slave *slave = edev->priv; struct cpsw_priv *priv = slave->cpsw; - int i, ret; + int ret; dev_dbg(&slave->dev, "* %s\n", __func__); @@ -810,6 +810,16 @@ static int cpsw_open(struct eth_device *edev) if (ret) return ret; + cpsw_slave_init(slave, priv); + + return 0; +} + +static int cpsw_setup(struct device_d *dev) +{ + struct cpsw_priv *priv = dev->priv; + int i, ret; + /* soft reset the controller and initialize priv */ soft_reset(priv, &priv->regs->soft_reset); @@ -834,9 +844,6 @@ static int cpsw_open(struct eth_device *edev) cpsw_ale_add_ucast(priv, priv->mac_addr, priv->host_port, ALE_SECURE); cpsw_ale_add_mcast(priv, ethbdaddr, 1 << priv->host_port); - - cpsw_slave_init(slave, priv); - /* init descriptor pool */ for (i = 0; i < NUM_DESCS; i++) { u32 val = (i == (NUM_DESCS - 1)) ? 0 : (u32)&priv->descs[i + 1]; @@ -875,7 +882,7 @@ static int cpsw_open(struct eth_device *edev) ret = cpdma_submit(priv, &priv->rx_chan, NetRxPackets[i], PKTSIZE); if (ret < 0) { - dev_err(&slave->dev, "error %d submitting rx desc\n", ret); + dev_err(dev, "error %d submitting rx desc\n", ret); break; } } @@ -1248,6 +1255,8 @@ static int cpsw_probe(struct device_d *dev) dev->priv = priv; + cpsw_setup(dev); + return 0; out: free(priv->slaves); -- 2.26.2 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox