* [PATCH 2/4] net: cpsw: print slave_num in dev_dbg
2014-05-15 6:56 [PATCH 1/4] net: cpsw: Pass correct slave Sascha Hauer
@ 2014-05-15 6:56 ` Sascha Hauer
2014-05-15 6:56 ` [PATCH 3/4] net: cpsw: Always write mac_control register Sascha Hauer
2014-05-15 6:56 ` [PATCH 4/4] net: cpsw: Allow multiple slaves Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2014-05-15 6:56 UTC (permalink / raw)
To: barebox
Since the cpsw has two slaves which handle one network interface
each the slave number is interesting during debugging. Print the
number.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/cpsw.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index f11b2d9..46fa53d 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -542,7 +542,7 @@ static int cpsw_get_hwaddr(struct eth_device *edev, unsigned char *mac)
struct cpsw_slave *slave = edev->priv;
struct cpsw_priv *priv = slave->cpsw;
- dev_dbg(priv->dev, "* %s\n", __func__);
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
return -1;
}
@@ -552,7 +552,7 @@ static int cpsw_set_hwaddr(struct eth_device *edev, unsigned char *mac)
struct cpsw_slave *slave = edev->priv;
struct cpsw_priv *priv = slave->cpsw;
- dev_dbg(priv->dev, "* %s\n", __func__);
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
memcpy(&priv->mac_addr, mac, sizeof(priv->mac_addr));
@@ -568,7 +568,7 @@ static void cpsw_slave_update_link(struct cpsw_slave *slave,
struct phy_device *phydev = slave->edev.phydev;
u32 mac_control = 0;
- dev_dbg(priv->dev, "* %s\n", __func__);
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
if (!phydev)
return;
@@ -609,7 +609,7 @@ static int cpsw_update_link(struct cpsw_slave *slave, struct cpsw_priv *priv)
{
int link = 0;
- dev_dbg(priv->dev, "* %s\n", __func__);
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
cpsw_slave_update_link(slave, priv, &link);
@@ -621,7 +621,7 @@ static void cpsw_adjust_link(struct eth_device *edev)
struct cpsw_slave *slave = edev->priv;
struct cpsw_priv *priv = slave->cpsw;
- dev_dbg(priv->dev, "* %s\n", __func__);
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
cpsw_update_link(slave, priv);
}
@@ -638,7 +638,7 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv)
{
u32 slave_port;
- dev_dbg(priv->dev, "* %s\n", __func__);
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
soft_reset(priv, &slave->sliver->soft_reset);
@@ -769,7 +769,7 @@ static int cpsw_open(struct eth_device *edev)
struct cpsw_priv *priv = slave->cpsw;
int i, ret;
- dev_dbg(priv->dev, "* %s\n", __func__);
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
ret = phy_device_connect(edev, &priv->miibus, slave->phy_id,
cpsw_adjust_link, 0, slave->phy_if);
@@ -855,6 +855,8 @@ static void cpsw_halt(struct eth_device *edev)
struct cpsw_slave *slave = edev->priv;
struct cpsw_priv *priv = slave->cpsw;
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
+
writel(0, priv->dma_regs + CPDMA_TXCONTROL);
writel(0, priv->dma_regs + CPDMA_RXCONTROL);
@@ -872,7 +874,7 @@ static int cpsw_send(struct eth_device *edev, void *packet, int length)
void *buffer;
int ret, len;
- dev_dbg(priv->dev, "* %s\n", __func__);
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
/* first reap completed packets */
while (cpdma_process(priv, &priv->tx_chan, &buffer, &len) >= 0);
@@ -917,7 +919,7 @@ static int cpsw_slave_setup(struct cpsw_slave *slave, int slave_num,
void *regs = priv->regs;
struct eth_device *edev = &slave->edev;
- dev_dbg(priv->dev, "* %s\n", __func__);
+ dev_dbg(priv->dev, "* %s slave %d\n", __func__, slave->slave_num);
slave->slave_num = slave_num;
slave->regs = regs + priv->slave_ofs + priv->slave_size * slave_num;
--
2.0.0.rc0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/4] net: cpsw: Always write mac_control register
2014-05-15 6:56 [PATCH 1/4] net: cpsw: Pass correct slave Sascha Hauer
2014-05-15 6:56 ` [PATCH 2/4] net: cpsw: print slave_num in dev_dbg Sascha Hauer
@ 2014-05-15 6:56 ` Sascha Hauer
2014-05-15 6:56 ` [PATCH 4/4] net: cpsw: Allow multiple slaves Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2014-05-15 6:56 UTC (permalink / raw)
To: barebox
Instead of keeping track of the mac_control register value and
only writing to it when it changed just always write it. This is
more safe anyway since the mac_control register content is altered
in the soft_reset functions.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/cpsw.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 46fa53d..d31cbb6 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -178,7 +178,6 @@ struct cpsw_slave {
struct cpsw_slave_regs *regs;
struct cpsw_sliver_regs *sliver;
int slave_num;
- u32 mac_control;
int phy_id;
phy_interface_t phy_if;
struct eth_device edev;
@@ -590,9 +589,6 @@ static void cpsw_slave_update_link(struct cpsw_slave *slave,
mac_control |= BIT(0); /* FULLDUPLEXEN */
}
- if (mac_control == slave->mac_control)
- return;
-
if (mac_control) {
dev_dbg(priv->dev, "link up on port %d, speed %d, %s duplex\n",
slave->slave_num, phydev->speed,
@@ -602,7 +598,6 @@ static void cpsw_slave_update_link(struct cpsw_slave *slave,
}
writel(mac_control, &slave->sliver->mac_control);
- slave->mac_control = mac_control;
}
static int cpsw_update_link(struct cpsw_slave *slave, struct cpsw_priv *priv)
@@ -649,8 +644,6 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv)
/* setup max packet size, and mac address */
writel(PKT_MAX, &slave->sliver->rx_maxlen);
- slave->mac_control = 0; /* no link yet */
-
/* enable forwarding */
slave_port = cpsw_get_slave_port(priv, slave->slave_num);
cpsw_ale_port_state(priv, slave_port, ALE_PORT_STATE_FORWARD);
--
2.0.0.rc0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread