@@ -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 ;
@@ -1035,19 +1044,12 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
10351044
10361045 /* Indicate that the MAC is responsible for PHY PM */
10371046 phydev -> mac_managed_pm = true;
1038- } else if (!intf -> wolopts ) {
1039- ret = phy_resume (dev -> phydev );
1040- if (ret )
1041- goto err_phy_disable ;
10421047 }
10431048
10441049 umac_reset (intf );
10451050
10461051 umac_init (intf );
10471052
1048- /* Disable the UniMAC RX/TX */
1049- umac_enable_set (intf , (UMC_CMD_RX_EN | UMC_CMD_TX_EN ), 0 );
1050-
10511053 umac_set_hw_addr (intf , dev -> dev_addr );
10521054
10531055 intf -> old_duplex = -1 ;
@@ -1062,9 +1064,6 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
10621064 netif_napi_add (intf -> ndev , & intf -> rx_napi , bcmasp_rx_poll );
10631065 bcmasp_enable_rx (intf , 1 );
10641066
1065- /* Turn on UniMAC TX/RX */
1066- umac_enable_set (intf , (UMC_CMD_RX_EN | UMC_CMD_TX_EN ), 1 );
1067-
10681067 intf -> crc_fwd = !!(umac_rl (intf , UMC_CMD ) & UMC_CMD_CRC_FWD );
10691068
10701069 bcmasp_netif_start (dev );
@@ -1306,7 +1305,14 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf)
13061305 if (intf -> wolopts & WAKE_FILTER )
13071306 bcmasp_netfilt_suspend (intf );
13081307
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+
13101316 umac_enable_set (intf , UMC_CMD_RX_EN , 1 );
13111317
13121318 if (intf -> parent -> wol_irq > 0 ) {
@@ -1324,7 +1330,6 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf)
13241330{
13251331 struct device * kdev = & intf -> parent -> pdev -> dev ;
13261332 struct net_device * dev = intf -> ndev ;
1327- int ret = 0 ;
13281333
13291334 if (!netif_running (dev ))
13301335 return 0 ;
@@ -1334,10 +1339,6 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf)
13341339 bcmasp_netif_deinit (dev );
13351340
13361341 if (!intf -> wolopts ) {
1337- ret = phy_suspend (dev -> phydev );
1338- if (ret )
1339- goto out ;
1340-
13411342 if (intf -> internal_phy )
13421343 bcmasp_ephy_enable_set (intf , false);
13431344 else
@@ -1354,11 +1355,7 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf)
13541355
13551356 clk_disable_unprepare (intf -> parent -> clk );
13561357
1357- return ret ;
1358-
1359- out :
1360- bcmasp_netif_init (dev , false);
1361- return ret ;
1358+ return 0 ;
13621359}
13631360
13641361static void bcmasp_resume_from_wol (struct bcmasp_intf * intf )
0 commit comments