]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
macb: Basic suspend/resume support
authorHaavard Skinnemoen <hskinnemoen@atmel.com>
Tue, 4 Mar 2008 12:39:29 +0000 (13:39 +0100)
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Wed, 2 Jul 2008 09:05:00 +0000 (11:05 +0200)
This implements suspend and resume callbacks for the macb driver. We may
have to do some more to gracefully shut the MAC down, but this at least
prevents the macb from waking the system when hooked up to a busy
network.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Patrice Vilchez <patrice.vilchez@rfo.atmel.com>
Cc: Nicolas FERRE <nicolas.ferre@rfo.atmel.com>
drivers/net/macb.c

index 92dccd43bdcab39fbd0bcd374d3447a33961443c..0a5745a854c7bbbe562a5f4e7b88e464a8891b0d 100644 (file)
@@ -1277,8 +1277,45 @@ static int __exit macb_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM
+static int macb_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       struct net_device *netdev = platform_get_drvdata(pdev);
+       struct macb *bp = netdev_priv(netdev);
+
+       netif_device_detach(netdev);
+
+#ifndef CONFIG_ARCH_AT91
+       clk_disable(bp->hclk);
+#endif
+       clk_disable(bp->pclk);
+
+       return 0;
+}
+
+static int macb_resume(struct platform_device *pdev)
+{
+       struct net_device *netdev = platform_get_drvdata(pdev);
+       struct macb *bp = netdev_priv(netdev);
+
+       clk_enable(bp->pclk);
+#ifndef CONFIG_ARCH_AT91
+       clk_enable(bp->hclk);
+#endif
+
+       netif_device_attach(netdev);
+
+       return 0;
+}
+#else
+#define macb_suspend   NULL
+#define macb_resume    NULL
+#endif
+
 static struct platform_driver macb_driver = {
        .remove         = __exit_p(macb_remove),
+       .suspend        = macb_suspend,
+       .resume         = macb_resume,
        .driver         = {
                .name           = "macb",
                .owner  = THIS_MODULE,