Skip to content

Commit 8562056

Browse files
ffainellidavem330
authored andcommitted
net: bcmgenet: request Wake-on-LAN interrupt
Attempt to the request the Wake-on-LAN interrupt bit, and if successful, advertise wakeup capability instead of doing this unconditionnally. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b6e978e commit 8562056

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,15 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id)
19181918
return IRQ_HANDLED;
19191919
}
19201920

1921+
static irqreturn_t bcmgenet_wol_isr(int irq, void *dev_id)
1922+
{
1923+
struct bcmgenet_priv *priv = dev_id;
1924+
1925+
pm_wakeup_event(&priv->pdev->dev, 0);
1926+
1927+
return IRQ_HANDLED;
1928+
}
1929+
19211930
static void bcmgenet_umac_reset(struct bcmgenet_priv *priv)
19221931
{
19231932
u32 reg;
@@ -2046,8 +2055,6 @@ static int bcmgenet_open(struct net_device *dev)
20462055
bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
20472056
}
20482057

2049-
device_set_wakeup_capable(&dev->dev, 1);
2050-
20512058
/* Disable RX/TX DMA and flush TX queues */
20522059
dma_ctrl = bcmgenet_dma_disable(priv);
20532060

@@ -2473,6 +2480,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
24732480
priv = netdev_priv(dev);
24742481
priv->irq0 = platform_get_irq(pdev, 0);
24752482
priv->irq1 = platform_get_irq(pdev, 1);
2483+
priv->wol_irq = platform_get_irq(pdev, 2);
24762484
if (!priv->irq0 || !priv->irq1) {
24772485
dev_err(&pdev->dev, "can't find IRQs\n");
24782486
err = -EINVAL;
@@ -2507,6 +2515,13 @@ static int bcmgenet_probe(struct platform_device *pdev)
25072515
dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM |
25082516
NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM;
25092517

2518+
/* Request the WOL interrupt and advertise suspend if available */
2519+
priv->wol_irq_disabled = true;
2520+
err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0,
2521+
dev->name, priv);
2522+
if (!err)
2523+
device_set_wakeup_capable(&pdev->dev, 1);
2524+
25102525
/* Set the needed headroom to account for any possible
25112526
* features enabling/disabling at runtime
25122527
*/

drivers/net/ethernet/broadcom/genet/bcmgenet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ struct bcmgenet_priv {
569569
int irq1;
570570
unsigned int irq0_stat;
571571
unsigned int irq1_stat;
572+
int wol_irq;
573+
bool wol_irq_disabled;
572574

573575
/* HW descriptors/checksum variables */
574576
bool desc_64b_en;

0 commit comments

Comments
 (0)