mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/5] net: cpsw: move generic setup code to probe
Date: Mon,  4 May 2020 09:50:19 +0200	[thread overview]
Message-ID: <20200504075022.28234-3-m.grzeschik@pengutronix.de> (raw)
In-Reply-To: <20200504075022.28234-1-m.grzeschik@pengutronix.de>

All generic cpsw code can move to probe, so the controller is only reset
and configured once.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-05-04  7:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04  7:50 [PATCH 0/5] net: cpsw: dual_emac mode Michael Grzeschik
2020-05-04  7:50 ` [PATCH 1/5] net: cpsw: fix cpsw_slave_regs register offsets Michael Grzeschik
2020-05-05  9:09   ` Michael Grzeschik
2020-05-04  7:50 ` Michael Grzeschik [this message]
2020-05-04  7:50 ` [PATCH 3/5] net: cpsw: cpsw_process should only handle rx channels for its own port Michael Grzeschik
2020-05-04  7:50 ` [PATCH 4/5] net: cpsw: add vlan handling for dual_emac mode Michael Grzeschik
2020-05-04  7:50 ` [PATCH 5/5] net: cpsw: make cpsw_send directional Michael Grzeschik
2020-05-05 10:22 ` [PATCH 0/5] net: cpsw: dual_emac mode Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200504075022.28234-3-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox