aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDeepak Sikri <deepak.sikri@st.com>2011-09-01 17:51:37 -0400
committerDavid S. Miller <davem@davemloft.net>2011-09-15 15:40:01 -0400
commit3172d3afa998ffb8f1971746ca960cbe98d62444 (patch)
treef7f97b57388edf50fa65958b0186b612b60f9ab7 /drivers
parent26a051cc2c4ccac8d124906a3df946044037b76d (diff)
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 <deepak.sikri@st.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c14
3 files changed, 16 insertions, 3 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index de1929b2641..619e3af9740 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -72,6 +72,7 @@ struct stmmac_priv {
72 spinlock_t lock; 72 spinlock_t lock;
73 int wolopts; 73 int wolopts;
74 int wolenabled; 74 int wolenabled;
75 int wol_irq;
75#ifdef CONFIG_STMMAC_TIMER 76#ifdef CONFIG_STMMAC_TIMER
76 struct stmmac_timer *tm; 77 struct stmmac_timer *tm;
77#endif 78#endif
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 7ed8fb6c211..79df79dc6a6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -321,10 +321,10 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
321 if (wol->wolopts) { 321 if (wol->wolopts) {
322 pr_info("stmmac: wakeup enable\n"); 322 pr_info("stmmac: wakeup enable\n");
323 device_set_wakeup_enable(priv->device, 1); 323 device_set_wakeup_enable(priv->device, 1);
324 enable_irq_wake(dev->irq); 324 enable_irq_wake(priv->wol_irq);
325 } else { 325 } else {
326 device_set_wakeup_enable(priv->device, 0); 326 device_set_wakeup_enable(priv->device, 0);
327 disable_irq_wake(dev->irq); 327 disable_irq_wake(priv->wol_irq);
328 } 328 }
329 329
330 spin_lock_irq(&priv->lock); 330 spin_lock_irq(&priv->lock);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 579f2673fd2..5aea21e587d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1515,7 +1515,7 @@ static int stmmac_mac_device_setup(struct net_device *dev)
1515 1515
1516 if (device_can_wakeup(priv->device)) { 1516 if (device_can_wakeup(priv->device)) {
1517 priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */ 1517 priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */
1518 enable_irq_wake(dev->irq); 1518 enable_irq_wake(priv->wol_irq);
1519 } 1519 }
1520 1520
1521 return 0; 1521 return 0;
@@ -1588,6 +1588,18 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1588 pr_info("\tPMT module supported\n"); 1588 pr_info("\tPMT module supported\n");
1589 device_set_wakeup_capable(&pdev->dev, 1); 1589 device_set_wakeup_capable(&pdev->dev, 1);
1590 } 1590 }
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
1591 1603
1592 platform_set_drvdata(pdev, ndev); 1604 platform_set_drvdata(pdev, ndev);
1593 1605