Skip to content

Commit b02e6d9

Browse files
ffainellidavem330
authored andcommitted
net: systemport: add bcm_sysport_netif_{enable,stop}
Factor common code that either enables or disables the network interface with the networking stack. We are going to reuse these functions for suspend/resume callbacks. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 18e21b0 commit b02e6d9

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,22 @@ static void topctrl_flush(struct bcm_sysport_priv *priv)
12951295
topctrl_writel(priv, 0, TX_FLUSH_CNTL);
12961296
}
12971297

1298+
static void bcm_sysport_netif_start(struct net_device *dev)
1299+
{
1300+
struct bcm_sysport_priv *priv = netdev_priv(dev);
1301+
1302+
/* Enable NAPI */
1303+
napi_enable(&priv->napi);
1304+
1305+
phy_start(priv->phydev);
1306+
1307+
/* Enable TX interrupts for the 32 TXQs */
1308+
intrl2_1_mask_clear(priv, 0xffffffff);
1309+
1310+
/* Last call before we start the real business */
1311+
netif_tx_start_all_queues(dev);
1312+
}
1313+
12981314
static int bcm_sysport_open(struct net_device *dev)
12991315
{
13001316
struct bcm_sysport_priv *priv = netdev_priv(dev);
@@ -1394,19 +1410,10 @@ static int bcm_sysport_open(struct net_device *dev)
13941410
if (ret)
13951411
goto out_clear_rx_int;
13961412

1397-
/* Enable NAPI */
1398-
napi_enable(&priv->napi);
1399-
14001413
/* Turn on UniMAC TX/RX */
14011414
umac_enable_set(priv, CMD_RX_EN | CMD_TX_EN, 1);
14021415

1403-
phy_start(priv->phydev);
1404-
1405-
/* Enable TX interrupts for the 32 TXQs */
1406-
intrl2_1_mask_clear(priv, 0xffffffff);
1407-
1408-
/* Last call before we start the real business */
1409-
netif_tx_start_all_queues(dev);
1416+
bcm_sysport_netif_start(dev);
14101417

14111418
return 0;
14121419

@@ -1425,11 +1432,9 @@ static int bcm_sysport_open(struct net_device *dev)
14251432
return ret;
14261433
}
14271434

1428-
static int bcm_sysport_stop(struct net_device *dev)
1435+
static void bcm_sysport_netif_stop(struct net_device *dev)
14291436
{
14301437
struct bcm_sysport_priv *priv = netdev_priv(dev);
1431-
unsigned int i;
1432-
int ret;
14331438

14341439
/* stop all software from updating hardware */
14351440
netif_tx_stop_all_queues(dev);
@@ -1441,6 +1446,15 @@ static int bcm_sysport_stop(struct net_device *dev)
14411446
intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
14421447
intrl2_1_mask_set(priv, 0xffffffff);
14431448
intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
1449+
}
1450+
1451+
static int bcm_sysport_stop(struct net_device *dev)
1452+
{
1453+
struct bcm_sysport_priv *priv = netdev_priv(dev);
1454+
unsigned int i;
1455+
int ret;
1456+
1457+
bcm_sysport_netif_stop(dev);
14441458

14451459
/* Disable UniMAC RX */
14461460
umac_enable_set(priv, CMD_RX_EN, 0);

0 commit comments

Comments
 (0)