lkml.org 
[lkml]   [2007]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2.6.20 4/5] dmfe: Add support for suspend/resume
Date
From Maxim Levitsky <maximlevitsky@gmail.com>
Subject: [PATCH 2.6.20 4/5] dmfe: Add support for suspend/resume

This adds support for suspend resume

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>

---

--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c 2007-02-08 21:49:19.000000000
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c 2007-02-08 22:02:03.000000000
+0200
@@ -55,9 +55,6 @@

TODO

- Implement pci_driver::suspend() and pci_driver::resume()
- power management methods.
-
Check on 64 bit boxes.
Check and fix on big endian boxes.

@@ -2054,11 +2051,56 @@ static struct pci_device_id dmfe_pci_tbl
MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl);


+
+static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state)
+{
+ struct net_device *dev = pci_get_drvdata(pci_dev);
+ struct dmfe_board_info *db = netdev_priv(dev);
+
+ /* Disable upper layer interface */
+ netif_device_detach (dev);
+
+ /* Disable Tx/Rx */
+ db->cr6_data &= ~(CR6_RXSC | CR6_TXSC);
+ update_cr6(db->cr6_data, dev->base_addr);
+
+ /* Disable Interrupt */
+ outl (0, dev->base_addr + DCR7);
+ outl (inl (dev->base_addr + DCR5), dev->base_addr + DCR5);
+
+ /* Fre RX buffers */
+ dmfe_free_rxbuffer (db);
+
+ /* Power down device*/
+ pci_set_power_state (pci_dev, pci_choose_state (pci_dev,state));
+ pci_save_state (pci_dev);
+
+ return 0;
+}
+
+static int dmfe_resume (struct pci_dev *pci_dev)
+{
+ struct net_device *dev = pci_get_drvdata (pci_dev);
+
+ pci_restore_state(pci_dev);
+ pci_set_power_state(pci_dev ,PCI_D0);
+
+ /* Re-initilize DM910X board */
+ dmfe_init_dm910x(dev);
+
+ /* Restart upper layer interface */
+ netif_device_attach(dev);
+
+ return 0;
+}
+
static struct pci_driver dmfe_driver = {
.name = "dmfe",
.id_table = dmfe_pci_tbl,
.probe = dmfe_init_one,
.remove = __devexit_p(dmfe_remove_one),
+ .suspend = dmfe_suspend,
+ .resume = dmfe_resume
};

MODULE_AUTHOR("Sten Wang, sten_wang@davicom.com.tw");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-02-08 22:21    [W:0.040 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site