From patchwork Thu Nov 5 04:41:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjith Lohithakshan X-Patchwork-Id: 37725 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 318B5B7BBB for ; Thu, 5 Nov 2009 15:51:31 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755193AbZKEEvS (ORCPT ); Wed, 4 Nov 2009 23:51:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755014AbZKEEvS (ORCPT ); Wed, 4 Nov 2009 23:51:18 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:49335 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754206AbZKEEvR (ORCPT ); Wed, 4 Nov 2009 23:51:17 -0500 Received: from dflp53.itg.ti.com ([128.247.5.6]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id nA54pLEi015908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 4 Nov 2009 22:51:21 -0600 Received: from tidmzi-ftp.india.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with SMTP id nA54pJnI021920; Wed, 4 Nov 2009 22:51:20 -0600 (CST) Received: from symphonyindia.ti.com (symphony-ftp [192.168.247.11]) by tidmzi-ftp.india.ext.ti.com (Postfix) with SMTP id 513FA38872; Thu, 5 Nov 2009 10:18:11 +0530 (IST) Received: from localhost.localdomain ([192.168.247.76]) by symphonyindia.ti.com (8.13.1/8.12.10) with ESMTP id nA54eibx000493; Thu, 5 Nov 2009 10:10:44 +0530 From: Ranjith Lohithakshan To: netdev@vger.kernel.org Cc: davem@davemloft.net, davinci-linux-open-source@linux.davincidsp.com, Ranjith Lohithakshan , Chaithrika U S Subject: [PATCH v2] TI DaVinci EMAC: Add suspend/resume capability Date: Thu, 5 Nov 2009 10:11:17 +0530 Message-Id: <1257396077-26882-1-git-send-email-ranjithl@ti.com> X-Mailer: git-send-email 1.5.6 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add suspend/resume capability to TI DaVinci EMAC driver. Signed-off-by: Ranjith Lohithakshan Signed-off-by: Chaithrika U S --- Applies to net-next-2.6 drivers/net/davinci_emac.c | 30 +++++++++++++++++++++++++++--- 1 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index a876dce..f1b09c0 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -2806,11 +2806,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 +2841,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, }; /**