Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[safe/jmp/linux-2.6] / drivers / net / davinci_emac.c
index a876dce..34e0310 100644 (file)
@@ -2136,9 +2136,6 @@ static int emac_poll(struct napi_struct *napi, int budget)
        u32 status = 0;
        u32 num_pkts = 0;
 
-       if (!netif_running(ndev))
-               return 0;
-
        /* Check interrupt vectors and call packet processing */
        status = emac_read(EMAC_MACINVECTOR);
 
@@ -2217,7 +2214,7 @@ void emac_poll_controller(struct net_device *ndev)
        struct emac_priv *priv = netdev_priv(ndev);
 
        emac_int_disable(priv);
-       emac_irq(ndev->irq, priv);
+       emac_irq(ndev->irq, ndev);
        emac_int_enable(priv);
 }
 #endif
@@ -2275,7 +2272,7 @@ static int emac_mii_reset(struct mii_bus *bus)
        unsigned int clk_div;
        int mdio_bus_freq = emac_bus_frequency;
 
-       if (mdio_max_freq & mdio_bus_freq)
+       if (mdio_max_freq && mdio_bus_freq)
                clk_div = ((mdio_bus_freq / mdio_max_freq) - 1);
        else
                clk_div = 0xFF;
@@ -2806,11 +2803,33 @@ static int __devexit davinci_emac_remove(struct platform_device *pdev)
        return 0;
 }
 
+static
+int davinci_emac_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       struct net_device *dev = platform_get_drvdata(pdev);
+
+       if (netif_running(dev))
+               emac_dev_stop(dev);
+
+       clk_disable(emac_clk);
+
+       return 0;
+}
+
+static int davinci_emac_resume(struct platform_device *pdev)
+{
+       struct net_device *dev = platform_get_drvdata(pdev);
+
+       clk_enable(emac_clk);
+
+       if (netif_running(dev))
+               emac_dev_open(dev);
+
+       return 0;
+}
+
 /**
  * davinci_emac_driver: EMAC platform driver structure
- *
- * We implement only probe and remove functions - suspend/resume and
- * others not supported by this module
  */
 static struct platform_driver davinci_emac_driver = {
        .driver = {
@@ -2819,6 +2838,8 @@ static struct platform_driver davinci_emac_driver = {
        },
        .probe = davinci_emac_probe,
        .remove = __devexit_p(davinci_emac_remove),
+       .suspend = davinci_emac_suspend,
+       .resume = davinci_emac_resume,
 };
 
 /**