]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
stmmac: support wake up irq from external sources (v3)
authorDeepak Sikri <deepak.sikri@st.com>
Thu, 1 Sep 2011 21:51:37 +0000 (21:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 15 Sep 2011 19:40:01 +0000 (15:40 -0400)
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>
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index de1929b2641bca97baf2e20e4db03c5fd991ad00..619e3af9740484a4c66b5f96c9cc7dac50040332 100644 (file)
@@ -72,6 +72,7 @@ struct stmmac_priv {
        spinlock_t lock;
        int wolopts;
        int wolenabled;
+       int wol_irq;
 #ifdef CONFIG_STMMAC_TIMER
        struct stmmac_timer *tm;
 #endif
index 7ed8fb6c2117250e7c55ceb6eef9a009e3223dae..79df79dc6a69debfa1de834d0c6b1c126ec8e332 100644 (file)
@@ -321,10 +321,10 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
        if (wol->wolopts) {
                pr_info("stmmac: wakeup enable\n");
                device_set_wakeup_enable(priv->device, 1);
-               enable_irq_wake(dev->irq);
+               enable_irq_wake(priv->wol_irq);
        } else {
                device_set_wakeup_enable(priv->device, 0);
-               disable_irq_wake(dev->irq);
+               disable_irq_wake(priv->wol_irq);
        }
 
        spin_lock_irq(&priv->lock);
index 579f2673fd2e136efff2df883fd6cdafa6e17f7d..5aea21e587dd3ebe9aaff37fd8d30da413b29572 100644 (file)
@@ -1515,7 +1515,7 @@ static int stmmac_mac_device_setup(struct net_device *dev)
 
        if (device_can_wakeup(priv->device)) {
                priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */
-               enable_irq_wake(dev->irq);
+               enable_irq_wake(priv->wol_irq);
        }
 
        return 0;
@@ -1588,6 +1588,18 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
                pr_info("\tPMT module supported\n");
                device_set_wakeup_capable(&pdev->dev, 1);
        }
+       /*
+        * On some platforms e.g. SPEAr the wake up irq differs from the mac irq
+        * The external wake up irq can be passed through the platform code
+        * 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)
+        */
+       priv->wol_irq = platform_get_irq_byname(pdev, "eth_wake_irq");
+       if (priv->wol_irq == -ENXIO)
+               priv->wol_irq = ndev->irq;
+
 
        platform_set_drvdata(pdev, ndev);