@@ -392,7 +392,9 @@ static void umac_reset(struct bcmasp_intf *intf)
392392 umac_wl (intf , 0x0 , UMC_CMD );
393393 umac_wl (intf , UMC_CMD_SW_RESET , UMC_CMD );
394394 usleep_range (10 , 100 );
395- umac_wl (intf , 0x0 , UMC_CMD );
395+ /* We hold the umac in reset and bring it out of
396+ * reset when phy link is up.
397+ */
396398}
397399
398400static void umac_set_hw_addr (struct bcmasp_intf * intf ,
@@ -412,6 +414,8 @@ static void umac_enable_set(struct bcmasp_intf *intf, u32 mask,
412414 u32 reg ;
413415
414416 reg = umac_rl (intf , UMC_CMD );
417+ if (reg & UMC_CMD_SW_RESET )
418+ return ;
415419 if (enable )
416420 reg |= mask ;
417421 else
@@ -430,7 +434,6 @@ static void umac_init(struct bcmasp_intf *intf)
430434 umac_wl (intf , 0x800 , UMC_FRM_LEN );
431435 umac_wl (intf , 0xffff , UMC_PAUSE_CNTRL );
432436 umac_wl (intf , 0x800 , UMC_RX_MAX_PKT_SZ );
433- umac_enable_set (intf , UMC_CMD_PROMISC , 1 );
434437}
435438
436439static int bcmasp_tx_poll (struct napi_struct * napi , int budget )
@@ -658,6 +661,12 @@ static void bcmasp_adj_link(struct net_device *dev)
658661 UMC_CMD_HD_EN | UMC_CMD_RX_PAUSE_IGNORE |
659662 UMC_CMD_TX_PAUSE_IGNORE );
660663 reg |= cmd_bits ;
664+ if (reg & UMC_CMD_SW_RESET ) {
665+ reg &= ~UMC_CMD_SW_RESET ;
666+ umac_wl (intf , reg , UMC_CMD );
667+ udelay (2 );
668+ reg |= UMC_CMD_TX_EN | UMC_CMD_RX_EN | UMC_CMD_PROMISC ;
669+ }
661670 umac_wl (intf , reg , UMC_CMD );
662671
663672 active = phy_init_eee (phydev , 0 ) >= 0 ;
@@ -1045,9 +1054,6 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
10451054
10461055 umac_init (intf );
10471056
1048- /* Disable the UniMAC RX/TX */
1049- umac_enable_set (intf , (UMC_CMD_RX_EN | UMC_CMD_TX_EN ), 0 );
1050-
10511057 umac_set_hw_addr (intf , dev -> dev_addr );
10521058
10531059 intf -> old_duplex = -1 ;
@@ -1062,9 +1068,6 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
10621068 netif_napi_add (intf -> ndev , & intf -> rx_napi , bcmasp_rx_poll );
10631069 bcmasp_enable_rx (intf , 1 );
10641070
1065- /* Turn on UniMAC TX/RX */
1066- umac_enable_set (intf , (UMC_CMD_RX_EN | UMC_CMD_TX_EN ), 1 );
1067-
10681071 intf -> crc_fwd = !!(umac_rl (intf , UMC_CMD ) & UMC_CMD_CRC_FWD );
10691072
10701073 bcmasp_netif_start (dev );
@@ -1306,7 +1309,14 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf)
13061309 if (intf -> wolopts & WAKE_FILTER )
13071310 bcmasp_netfilt_suspend (intf );
13081311
1309- /* UniMAC receive needs to be turned on */
1312+ /* Bring UniMAC out of reset if needed and enable RX */
1313+ reg = umac_rl (intf , UMC_CMD );
1314+ if (reg & UMC_CMD_SW_RESET )
1315+ reg &= ~UMC_CMD_SW_RESET ;
1316+
1317+ reg |= UMC_CMD_RX_EN | UMC_CMD_PROMISC ;
1318+ umac_wl (intf , reg , UMC_CMD );
1319+
13101320 umac_enable_set (intf , UMC_CMD_RX_EN , 1 );
13111321
13121322 if (intf -> parent -> wol_irq > 0 ) {
0 commit comments