aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/mediatek/mtk_eth_soc.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 7b760752d2c1..cd5d0c97f0ce 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1432,17 +1432,29 @@ static void mtk_pending_work(struct work_struct *work)
1432{ 1432{
1433 struct mtk_mac *mac = container_of(work, struct mtk_mac, pending_work); 1433 struct mtk_mac *mac = container_of(work, struct mtk_mac, pending_work);
1434 struct mtk_eth *eth = mac->hw; 1434 struct mtk_eth *eth = mac->hw;
1435 struct net_device *dev = eth->netdev[mac->id]; 1435 int err, i;
1436 int err; 1436 unsigned long restart = 0;
1437 1437
1438 rtnl_lock(); 1438 rtnl_lock();
1439 mtk_stop(dev);
1440 1439
1441 err = mtk_open(dev); 1440 /* stop all devices to make sure that dma is properly shut down */
1442 if (err) { 1441 for (i = 0; i < MTK_MAC_COUNT; i++) {
1443 netif_alert(eth, ifup, dev, 1442 if (!netif_oper_up(eth->netdev[i]))
1444 "Driver up/down cycle failed, closing device.\n"); 1443 continue;
1445 dev_close(dev); 1444 mtk_stop(eth->netdev[i]);
1445 __set_bit(i, &restart);
1446 }
1447
1448 /* restart DMA and enable IRQs */
1449 for (i = 0; i < MTK_MAC_COUNT; i++) {
1450 if (!test_bit(i, &restart))
1451 continue;
1452 err = mtk_open(eth->netdev[i]);
1453 if (err) {
1454 netif_alert(eth, ifup, eth->netdev[i],
1455 "Driver up/down cycle failed, closing device.\n");
1456 dev_close(eth->netdev[i]);
1457 }
1446 } 1458 }
1447 rtnl_unlock(); 1459 rtnl_unlock();
1448} 1460}