aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/stmmac/stmmac_main.c
diff options
context:
space:
mode:
authorGiuseppe Cavallaro <peppe.cavallaro@st.com>2010-09-25 00:27:41 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-25 00:27:41 -0400
commit543876c92837a8b208b5c99ec225c1f5a581900e (patch)
tree7a183a1bc3e8974b994e4bad1861ddd0f33ac7e7 /drivers/net/stmmac/stmmac_main.c
parent77555ee7228234257957fd54daa0b69178906320 (diff)
stmmac: review the wake-up support
If the PM support is available this is passed through the platform instead to be hard-coded in the core files. WoL on Magic Frame can be enabled by using the ethtool support. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/stmmac/stmmac_main.c')
-rw-r--r--drivers/net/stmmac/stmmac_main.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index a908f7201aae..823b9e6431d5 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1568,9 +1568,8 @@ static int stmmac_mac_device_setup(struct net_device *dev)
1568 1568
1569 priv->hw = device; 1569 priv->hw = device;
1570 1570
1571 priv->wolenabled = priv->hw->pmt; /* PMT supported */ 1571 if (device_can_wakeup(priv->device))
1572 if (priv->wolenabled == PMT_SUPPORTED) 1572 priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */
1573 priv->wolopts = WAKE_MAGIC; /* Magic Frame */
1574 1573
1575 return 0; 1574 return 0;
1576} 1575}
@@ -1709,6 +1708,12 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1709 priv->enh_desc = plat_dat->enh_desc; 1708 priv->enh_desc = plat_dat->enh_desc;
1710 priv->ioaddr = addr; 1709 priv->ioaddr = addr;
1711 1710
1711 /* PMT module is not integrated in all the MAC devices. */
1712 if (plat_dat->pmt) {
1713 pr_info("\tPMT module supported\n");
1714 device_set_wakeup_capable(&pdev->dev, 1);
1715 }
1716
1712 platform_set_drvdata(pdev, ndev); 1717 platform_set_drvdata(pdev, ndev);
1713 1718
1714 /* Set the I/O base addr */ 1719 /* Set the I/O base addr */
@@ -1836,13 +1841,11 @@ static int stmmac_suspend(struct platform_device *pdev, pm_message_t state)
1836 1841
1837 stmmac_mac_disable_tx(priv->ioaddr); 1842 stmmac_mac_disable_tx(priv->ioaddr);
1838 1843
1839 if (device_may_wakeup(&(pdev->dev))) { 1844 /* Enable Power down mode by programming the PMT regs */
1840 /* Enable Power down mode by programming the PMT regs */ 1845 if (device_can_wakeup(priv->device))
1841 if (priv->wolenabled == PMT_SUPPORTED) 1846 priv->hw->mac->pmt(priv->ioaddr, priv->wolopts);
1842 priv->hw->mac->pmt(priv->ioaddr, priv->wolopts); 1847 else
1843 } else {
1844 stmmac_mac_disable_rx(priv->ioaddr); 1848 stmmac_mac_disable_rx(priv->ioaddr);
1845 }
1846 } else { 1849 } else {
1847 priv->shutdown = 1; 1850 priv->shutdown = 1;
1848 /* Although this can appear slightly redundant it actually 1851 /* Although this can appear slightly redundant it actually
@@ -1877,9 +1880,8 @@ static int stmmac_resume(struct platform_device *pdev)
1877 * is received. Anyway, it's better to manually clear 1880 * is received. Anyway, it's better to manually clear
1878 * this bit because it can generate problems while resuming 1881 * this bit because it can generate problems while resuming
1879 * from another devices (e.g. serial console). */ 1882 * from another devices (e.g. serial console). */
1880 if (device_may_wakeup(&(pdev->dev))) 1883 if (device_can_wakeup(priv->device))
1881 if (priv->wolenabled == PMT_SUPPORTED) 1884 priv->hw->mac->pmt(priv->ioaddr, 0);
1882 priv->hw->mac->pmt(priv->ioaddr, 0);
1883 1885
1884 netif_device_attach(dev); 1886 netif_device_attach(dev);
1885 1887