diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-07-02 00:08:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-07 23:56:47 -0400 |
commit | 18e21b01fb94d8f6125cf73a477fdb3f88820608 (patch) | |
tree | 2c741938a11f6c713e10bcc5ad9e38f53ae5c9f5 /drivers/net/ethernet/broadcom/bcmsysport.c | |
parent | 4710d806fcb825156e0a7b3a81104915c5e90f5d (diff) |
net: systemport: update umac_enable_set to take a bitmask
Quite often we need to enable either the transmitter or the receiver
bits in UMAC_CMD, use umac_enable_set() to do that for us.
This is a preliminary change to introduce suspend/resume support in the
driver.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bcmsysport.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bcmsysport.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 141160ef249a..bbe74494c629 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -1236,15 +1236,15 @@ static void bcm_sysport_set_rx_mode(struct net_device *dev) | |||
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | static inline void umac_enable_set(struct bcm_sysport_priv *priv, | 1238 | static inline void umac_enable_set(struct bcm_sysport_priv *priv, |
1239 | unsigned int enable) | 1239 | u32 mask, unsigned int enable) |
1240 | { | 1240 | { |
1241 | u32 reg; | 1241 | u32 reg; |
1242 | 1242 | ||
1243 | reg = umac_readl(priv, UMAC_CMD); | 1243 | reg = umac_readl(priv, UMAC_CMD); |
1244 | if (enable) | 1244 | if (enable) |
1245 | reg |= CMD_RX_EN | CMD_TX_EN; | 1245 | reg |= mask; |
1246 | else | 1246 | else |
1247 | reg &= ~(CMD_RX_EN | CMD_TX_EN); | 1247 | reg &= ~mask; |
1248 | umac_writel(priv, reg, UMAC_CMD); | 1248 | umac_writel(priv, reg, UMAC_CMD); |
1249 | 1249 | ||
1250 | /* UniMAC stops on a packet boundary, wait for a full-sized packet | 1250 | /* UniMAC stops on a packet boundary, wait for a full-sized packet |
@@ -1313,7 +1313,7 @@ static int bcm_sysport_open(struct net_device *dev) | |||
1313 | topctrl_flush(priv); | 1313 | topctrl_flush(priv); |
1314 | 1314 | ||
1315 | /* Disable the UniMAC RX/TX */ | 1315 | /* Disable the UniMAC RX/TX */ |
1316 | umac_enable_set(priv, 0); | 1316 | umac_enable_set(priv, CMD_RX_EN | CMD_TX_EN, 0); |
1317 | 1317 | ||
1318 | /* Enable RBUF 2bytes alignment and Receive Status Block */ | 1318 | /* Enable RBUF 2bytes alignment and Receive Status Block */ |
1319 | reg = rbuf_readl(priv, RBUF_CONTROL); | 1319 | reg = rbuf_readl(priv, RBUF_CONTROL); |
@@ -1398,7 +1398,7 @@ static int bcm_sysport_open(struct net_device *dev) | |||
1398 | napi_enable(&priv->napi); | 1398 | napi_enable(&priv->napi); |
1399 | 1399 | ||
1400 | /* Turn on UniMAC TX/RX */ | 1400 | /* Turn on UniMAC TX/RX */ |
1401 | umac_enable_set(priv, 1); | 1401 | umac_enable_set(priv, CMD_RX_EN | CMD_TX_EN, 1); |
1402 | 1402 | ||
1403 | phy_start(priv->phydev); | 1403 | phy_start(priv->phydev); |
1404 | 1404 | ||
@@ -1429,7 +1429,6 @@ static int bcm_sysport_stop(struct net_device *dev) | |||
1429 | { | 1429 | { |
1430 | struct bcm_sysport_priv *priv = netdev_priv(dev); | 1430 | struct bcm_sysport_priv *priv = netdev_priv(dev); |
1431 | unsigned int i; | 1431 | unsigned int i; |
1432 | u32 reg; | ||
1433 | int ret; | 1432 | int ret; |
1434 | 1433 | ||
1435 | /* stop all software from updating hardware */ | 1434 | /* stop all software from updating hardware */ |
@@ -1444,9 +1443,7 @@ static int bcm_sysport_stop(struct net_device *dev) | |||
1444 | intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | 1443 | intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); |
1445 | 1444 | ||
1446 | /* Disable UniMAC RX */ | 1445 | /* Disable UniMAC RX */ |
1447 | reg = umac_readl(priv, UMAC_CMD); | 1446 | umac_enable_set(priv, CMD_RX_EN, 0); |
1448 | reg &= ~CMD_RX_EN; | ||
1449 | umac_writel(priv, reg, UMAC_CMD); | ||
1450 | 1447 | ||
1451 | ret = tdma_enable_set(priv, 0); | 1448 | ret = tdma_enable_set(priv, 0); |
1452 | if (ret) { | 1449 | if (ret) { |
@@ -1464,9 +1461,7 @@ static int bcm_sysport_stop(struct net_device *dev) | |||
1464 | } | 1461 | } |
1465 | 1462 | ||
1466 | /* Disable UniMAC TX */ | 1463 | /* Disable UniMAC TX */ |
1467 | reg = umac_readl(priv, UMAC_CMD); | 1464 | umac_enable_set(priv, CMD_TX_EN, 0); |
1468 | reg &= ~CMD_TX_EN; | ||
1469 | umac_writel(priv, reg, UMAC_CMD); | ||
1470 | 1465 | ||
1471 | /* Free RX/TX rings SW structures */ | 1466 | /* Free RX/TX rings SW structures */ |
1472 | for (i = 0; i < dev->num_tx_queues; i++) | 1467 | for (i = 0; i < dev->num_tx_queues; i++) |