@@ -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 ;
@@ -1035,19 +1044,12 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
1035
1044
1036
1045
/* Indicate that the MAC is responsible for PHY PM */
1037
1046
phydev -> mac_managed_pm = true;
1038
- } else if (!intf -> wolopts ) {
1039
- ret = phy_resume (dev -> phydev );
1040
- if (ret )
1041
- goto err_phy_disable ;
1042
1047
}
1043
1048
1044
1049
umac_reset (intf );
1045
1050
1046
1051
umac_init (intf );
1047
1052
1048
- /* Disable the UniMAC RX/TX */
1049
- umac_enable_set (intf , (UMC_CMD_RX_EN | UMC_CMD_TX_EN ), 0 );
1050
-
1051
1053
umac_set_hw_addr (intf , dev -> dev_addr );
1052
1054
1053
1055
intf -> old_duplex = -1 ;
@@ -1062,9 +1064,6 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
1062
1064
netif_napi_add (intf -> ndev , & intf -> rx_napi , bcmasp_rx_poll );
1063
1065
bcmasp_enable_rx (intf , 1 );
1064
1066
1065
- /* Turn on UniMAC TX/RX */
1066
- umac_enable_set (intf , (UMC_CMD_RX_EN | UMC_CMD_TX_EN ), 1 );
1067
-
1068
1067
intf -> crc_fwd = !!(umac_rl (intf , UMC_CMD ) & UMC_CMD_CRC_FWD );
1069
1068
1070
1069
bcmasp_netif_start (dev );
@@ -1306,7 +1305,14 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf)
1306
1305
if (intf -> wolopts & WAKE_FILTER )
1307
1306
bcmasp_netfilt_suspend (intf );
1308
1307
1309
- /* UniMAC receive needs to be turned on */
1308
+ /* Bring UniMAC out of reset if needed and enable RX */
1309
+ reg = umac_rl (intf , UMC_CMD );
1310
+ if (reg & UMC_CMD_SW_RESET )
1311
+ reg &= ~UMC_CMD_SW_RESET ;
1312
+
1313
+ reg |= UMC_CMD_RX_EN | UMC_CMD_PROMISC ;
1314
+ umac_wl (intf , reg , UMC_CMD );
1315
+
1310
1316
umac_enable_set (intf , UMC_CMD_RX_EN , 1 );
1311
1317
1312
1318
if (intf -> parent -> wol_irq > 0 ) {
@@ -1324,7 +1330,6 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf)
1324
1330
{
1325
1331
struct device * kdev = & intf -> parent -> pdev -> dev ;
1326
1332
struct net_device * dev = intf -> ndev ;
1327
- int ret = 0 ;
1328
1333
1329
1334
if (!netif_running (dev ))
1330
1335
return 0 ;
@@ -1334,10 +1339,6 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf)
1334
1339
bcmasp_netif_deinit (dev );
1335
1340
1336
1341
if (!intf -> wolopts ) {
1337
- ret = phy_suspend (dev -> phydev );
1338
- if (ret )
1339
- goto out ;
1340
-
1341
1342
if (intf -> internal_phy )
1342
1343
bcmasp_ephy_enable_set (intf , false);
1343
1344
else
@@ -1354,11 +1355,7 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf)
1354
1355
1355
1356
clk_disable_unprepare (intf -> parent -> clk );
1356
1357
1357
- return ret ;
1358
-
1359
- out :
1360
- bcmasp_netif_init (dev , false);
1361
- return ret ;
1358
+ return 0 ;
1362
1359
}
1363
1360
1364
1361
static void bcmasp_resume_from_wol (struct bcmasp_intf * intf )
0 commit comments