Skip to content

Commit 3172d3a

Browse files
Deepak Sikridavem330
authored andcommitted
stmmac: support wake up irq from external sources (v3)
On some platforms e.g. SPEAr the wake up irq differs from the GMAC interrupt source. With this patch an external wake up irq can be passed through the platform code and named as "eth_wake_irq". In case the wake up interrupt is not passed from the platform so the driver will continue to use the mac irq (ndev->irq) Signed-off-by: Deepak Sikri <[email protected]> Signed-off-by: Giuseppe Cavallaro <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 26a051c commit 3172d3a

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ struct stmmac_priv {
7272
spinlock_t lock;
7373
int wolopts;
7474
int wolenabled;
75+
int wol_irq;
7576
#ifdef CONFIG_STMMAC_TIMER
7677
struct stmmac_timer *tm;
7778
#endif

drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,10 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
321321
if (wol->wolopts) {
322322
pr_info("stmmac: wakeup enable\n");
323323
device_set_wakeup_enable(priv->device, 1);
324-
enable_irq_wake(dev->irq);
324+
enable_irq_wake(priv->wol_irq);
325325
} else {
326326
device_set_wakeup_enable(priv->device, 0);
327-
disable_irq_wake(dev->irq);
327+
disable_irq_wake(priv->wol_irq);
328328
}
329329

330330
spin_lock_irq(&priv->lock);

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ static int stmmac_mac_device_setup(struct net_device *dev)
15151515

15161516
if (device_can_wakeup(priv->device)) {
15171517
priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */
1518-
enable_irq_wake(dev->irq);
1518+
enable_irq_wake(priv->wol_irq);
15191519
}
15201520

15211521
return 0;
@@ -1588,6 +1588,18 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
15881588
pr_info("\tPMT module supported\n");
15891589
device_set_wakeup_capable(&pdev->dev, 1);
15901590
}
1591+
/*
1592+
* On some platforms e.g. SPEAr the wake up irq differs from the mac irq
1593+
* The external wake up irq can be passed through the platform code
1594+
* named as "eth_wake_irq"
1595+
*
1596+
* In case the wake up interrupt is not passed from the platform
1597+
* so the driver will continue to use the mac irq (ndev->irq)
1598+
*/
1599+
priv->wol_irq = platform_get_irq_byname(pdev, "eth_wake_irq");
1600+
if (priv->wol_irq == -ENXIO)
1601+
priv->wol_irq = ndev->irq;
1602+
15911603

15921604
platform_set_drvdata(pdev, ndev);
15931605

0 commit comments

Comments
 (0)