@@ -392,7 +392,9 @@ static void umac_reset(struct bcmasp_intf *intf)
392
392
umac_wl (intf , 0x0 , UMC_CMD );
393
393
umac_wl (intf , UMC_CMD_SW_RESET , UMC_CMD );
394
394
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
+ */
396
398
}
397
399
398
400
static void umac_set_hw_addr (struct bcmasp_intf * intf ,
@@ -412,6 +414,8 @@ static void umac_enable_set(struct bcmasp_intf *intf, u32 mask,
412
414
u32 reg ;
413
415
414
416
reg = umac_rl (intf , UMC_CMD );
417
+ if (reg & UMC_CMD_SW_RESET )
418
+ return ;
415
419
if (enable )
416
420
reg |= mask ;
417
421
else
@@ -430,7 +434,6 @@ static void umac_init(struct bcmasp_intf *intf)
430
434
umac_wl (intf , 0x800 , UMC_FRM_LEN );
431
435
umac_wl (intf , 0xffff , UMC_PAUSE_CNTRL );
432
436
umac_wl (intf , 0x800 , UMC_RX_MAX_PKT_SZ );
433
- umac_enable_set (intf , UMC_CMD_PROMISC , 1 );
434
437
}
435
438
436
439
static int bcmasp_tx_poll (struct napi_struct * napi , int budget )
@@ -658,6 +661,12 @@ static void bcmasp_adj_link(struct net_device *dev)
658
661
UMC_CMD_HD_EN | UMC_CMD_RX_PAUSE_IGNORE |
659
662
UMC_CMD_TX_PAUSE_IGNORE );
660
663
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
+ }
661
670
umac_wl (intf , reg , UMC_CMD );
662
671
663
672
active = phy_init_eee (phydev , 0 ) >= 0 ;
@@ -1045,9 +1054,6 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
1045
1054
1046
1055
umac_init (intf );
1047
1056
1048
- /* Disable the UniMAC RX/TX */
1049
- umac_enable_set (intf , (UMC_CMD_RX_EN | UMC_CMD_TX_EN ), 0 );
1050
-
1051
1057
umac_set_hw_addr (intf , dev -> dev_addr );
1052
1058
1053
1059
intf -> old_duplex = -1 ;
@@ -1062,9 +1068,6 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
1062
1068
netif_napi_add (intf -> ndev , & intf -> rx_napi , bcmasp_rx_poll );
1063
1069
bcmasp_enable_rx (intf , 1 );
1064
1070
1065
- /* Turn on UniMAC TX/RX */
1066
- umac_enable_set (intf , (UMC_CMD_RX_EN | UMC_CMD_TX_EN ), 1 );
1067
-
1068
1071
intf -> crc_fwd = !!(umac_rl (intf , UMC_CMD ) & UMC_CMD_CRC_FWD );
1069
1072
1070
1073
bcmasp_netif_start (dev );
@@ -1306,7 +1309,14 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf)
1306
1309
if (intf -> wolopts & WAKE_FILTER )
1307
1310
bcmasp_netfilt_suspend (intf );
1308
1311
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
+
1310
1320
umac_enable_set (intf , UMC_CMD_RX_EN , 1 );
1311
1321
1312
1322
if (intf -> parent -> wol_irq > 0 ) {
0 commit comments