Skip to content

Commit 21f56ad

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: bcm: asp2: convert to phylib managed EEE
Convert the Broadcom ASP2 driver to use phylib managed EEE support. Signed-off-by: Russell King (Oracle) <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Tested-by: Florian Fainelli <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent df8017e commit 21f56ad

File tree

3 files changed

+10
-43
lines changed

3 files changed

+10
-43
lines changed

drivers/net/ethernet/broadcom/asp2/bcmasp.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,6 @@ struct bcmasp_intf {
348348
/* Used if per intf wol irq */
349349
int wol_irq;
350350
unsigned int wol_irq_enabled:1;
351-
352-
struct ethtool_keee eee;
353351
};
354352

355353
#define NUM_NET_FILTERS 32
@@ -601,5 +599,4 @@ int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,
601599

602600
void bcmasp_netfilt_suspend(struct bcmasp_intf *intf);
603601

604-
void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable);
605602
#endif

drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -348,20 +348,6 @@ static int bcmasp_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
348348
return err;
349349
}
350350

351-
void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable)
352-
{
353-
u32 reg;
354-
355-
reg = umac_rl(intf, UMC_EEE_CTRL);
356-
if (enable)
357-
reg |= EEE_EN;
358-
else
359-
reg &= ~EEE_EN;
360-
umac_wl(intf, reg, UMC_EEE_CTRL);
361-
362-
intf->eee.eee_enabled = enable;
363-
}
364-
365351
static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
366352
{
367353
if (!dev->phydev)
@@ -372,26 +358,9 @@ static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
372358

373359
static int bcmasp_set_eee(struct net_device *dev, struct ethtool_keee *e)
374360
{
375-
struct bcmasp_intf *intf = netdev_priv(dev);
376-
struct ethtool_keee *p = &intf->eee;
377-
int ret;
378-
379361
if (!dev->phydev)
380362
return -ENODEV;
381363

382-
if (!p->eee_enabled) {
383-
bcmasp_eee_enable_set(intf, false);
384-
} else {
385-
ret = phy_init_eee(dev->phydev, 0);
386-
if (ret) {
387-
netif_err(intf, hw, dev,
388-
"EEE initialization failed: %d\n", ret);
389-
return ret;
390-
}
391-
392-
bcmasp_eee_enable_set(intf, true);
393-
}
394-
395364
return phy_ethtool_set_eee(dev->phydev, e);
396365
}
397366

drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,6 @@ static void bcmasp_adj_link(struct net_device *dev)
619619
struct phy_device *phydev = dev->phydev;
620620
u32 cmd_bits = 0, reg;
621621
int changed = 0;
622-
bool active;
623622

624623
if (intf->old_link != phydev->link) {
625624
changed = 1;
@@ -678,9 +677,12 @@ static void bcmasp_adj_link(struct net_device *dev)
678677
umac_wl(intf, reg, UMC_CMD);
679678

680679
umac_wl(intf, phydev->eee_cfg.tx_lpi_timer, UMC_EEE_LPI_TIMER);
681-
682-
active = phy_init_eee(phydev, 0) >= 0;
683-
bcmasp_eee_enable_set(intf, active);
680+
reg = umac_rl(intf, UMC_EEE_CTRL);
681+
if (phydev->enable_tx_lpi)
682+
reg |= EEE_EN;
683+
else
684+
reg &= ~EEE_EN;
685+
umac_wl(intf, reg, UMC_EEE_CTRL);
684686
}
685687

686688
reg = rgmii_rl(intf, RGMII_OOB_CNTRL);
@@ -1336,7 +1338,8 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf)
13361338
ASP_WAKEUP_INTR2_MASK_CLEAR);
13371339
}
13381340

1339-
if (intf->eee.eee_enabled && intf->parent->eee_fixup)
1341+
if (ndev->phydev && ndev->phydev->eee_cfg.eee_enabled &&
1342+
intf->parent->eee_fixup)
13401343
intf->parent->eee_fixup(intf, true);
13411344

13421345
netif_dbg(intf, wol, ndev, "entered WOL mode\n");
@@ -1378,7 +1381,8 @@ static void bcmasp_resume_from_wol(struct bcmasp_intf *intf)
13781381
{
13791382
u32 reg;
13801383

1381-
if (intf->eee.eee_enabled && intf->parent->eee_fixup)
1384+
if (intf->ndev->phydev && intf->ndev->phydev->eee_cfg.eee_enabled &&
1385+
intf->parent->eee_fixup)
13821386
intf->parent->eee_fixup(intf, false);
13831387

13841388
reg = umac_rl(intf, UMC_MPD_CTRL);
@@ -1409,9 +1413,6 @@ int bcmasp_interface_resume(struct bcmasp_intf *intf)
14091413

14101414
bcmasp_resume_from_wol(intf);
14111415

1412-
if (intf->eee.eee_enabled)
1413-
bcmasp_eee_enable_set(intf, true);
1414-
14151416
netif_device_attach(dev);
14161417

14171418
return 0;

0 commit comments

Comments
 (0)