Skip to content

Commit c80bed9

Browse files
committed
Merge branch 'net-bcm-asp2-fix-fallout-from-phylib-eee-changes'
Russell King says: ==================== net: bcm: asp2: fix fallout from phylib EEE changes This series addresses the fallout from the phylib changes in the Broadcom ASP2 driver. The first patch uses phylib's copy of the LPI timer setting, which means the driver no longer has to track this. It will be set in hardware each time the adjust_link function is called when the link is up, and will be read at initialisation time to set the current value. The second patch removes the driver's storage of tx_lpi_enabled, which has become redundant since phylib managed EEE was merged. The driver does nothing with this flag other than storing it. The last patch converts the driver to use phylib's enable_tx_lpi flag rather than trying to maintain its own copy. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 7a1723d + 21f56ad commit c80bed9

File tree

3 files changed

+14
-50
lines changed

3 files changed

+14
-50
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 & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -348,58 +348,19 @@ 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
{
367-
struct bcmasp_intf *intf = netdev_priv(dev);
368-
struct ethtool_keee *p = &intf->eee;
369-
370353
if (!dev->phydev)
371354
return -ENODEV;
372355

373-
e->tx_lpi_enabled = p->tx_lpi_enabled;
374-
e->tx_lpi_timer = umac_rl(intf, UMC_EEE_LPI_TIMER);
375-
376356
return phy_ethtool_get_eee(dev->phydev, e);
377357
}
378358

379359
static int bcmasp_set_eee(struct net_device *dev, struct ethtool_keee *e)
380360
{
381-
struct bcmasp_intf *intf = netdev_priv(dev);
382-
struct ethtool_keee *p = &intf->eee;
383-
int ret;
384-
385361
if (!dev->phydev)
386362
return -ENODEV;
387363

388-
if (!p->eee_enabled) {
389-
bcmasp_eee_enable_set(intf, false);
390-
} else {
391-
ret = phy_init_eee(dev->phydev, 0);
392-
if (ret) {
393-
netif_err(intf, hw, dev,
394-
"EEE initialization failed: %d\n", ret);
395-
return ret;
396-
}
397-
398-
umac_wl(intf, e->tx_lpi_timer, UMC_EEE_LPI_TIMER);
399-
intf->eee.tx_lpi_enabled = e->tx_lpi_enabled;
400-
bcmasp_eee_enable_set(intf, true);
401-
}
402-
403364
return phy_ethtool_set_eee(dev->phydev, e);
404365
}
405366

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

Lines changed: 14 additions & 8 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;
@@ -677,8 +676,13 @@ static void bcmasp_adj_link(struct net_device *dev)
677676
}
678677
umac_wl(intf, reg, UMC_CMD);
679678

680-
active = phy_init_eee(phydev, 0) >= 0;
681-
bcmasp_eee_enable_set(intf, active);
679+
umac_wl(intf, phydev->eee_cfg.tx_lpi_timer, UMC_EEE_LPI_TIMER);
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);
682686
}
683687

684688
reg = rgmii_rl(intf, RGMII_OOB_CNTRL);
@@ -1055,6 +1059,9 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)
10551059

10561060
/* Indicate that the MAC is responsible for PHY PM */
10571061
phydev->mac_managed_pm = true;
1062+
1063+
/* Set phylib's copy of the LPI timer */
1064+
phydev->eee_cfg.tx_lpi_timer = umac_rl(intf, UMC_EEE_LPI_TIMER);
10581065
}
10591066

10601067
umac_reset(intf);
@@ -1331,7 +1338,8 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf)
13311338
ASP_WAKEUP_INTR2_MASK_CLEAR);
13321339
}
13331340

1334-
if (intf->eee.eee_enabled && intf->parent->eee_fixup)
1341+
if (ndev->phydev && ndev->phydev->eee_cfg.eee_enabled &&
1342+
intf->parent->eee_fixup)
13351343
intf->parent->eee_fixup(intf, true);
13361344

13371345
netif_dbg(intf, wol, ndev, "entered WOL mode\n");
@@ -1373,7 +1381,8 @@ static void bcmasp_resume_from_wol(struct bcmasp_intf *intf)
13731381
{
13741382
u32 reg;
13751383

1376-
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)
13771386
intf->parent->eee_fixup(intf, false);
13781387

13791388
reg = umac_rl(intf, UMC_MPD_CTRL);
@@ -1404,9 +1413,6 @@ int bcmasp_interface_resume(struct bcmasp_intf *intf)
14041413

14051414
bcmasp_resume_from_wol(intf);
14061415

1407-
if (intf->eee.eee_enabled)
1408-
bcmasp_eee_enable_set(intf, true);
1409-
14101416
netif_device_attach(dev);
14111417

14121418
return 0;

0 commit comments

Comments
 (0)