[PATCH 3/4] net: cpsw: Always write mac_control register

Sascha Hauer s.hauer at pengutronix.de
Wed May 14 23:56:55 PDT 2014


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 at 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




More information about the barebox mailing list