linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [NETDEV] [004] dmfe : Add suspend/resume support
@ 2007-02-07 18:33 Levitsky Maxim
  2007-02-09 20:54 ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: Levitsky Maxim @ 2007-02-07 18:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: tori, netdev, pavel

From: Maxim Levitsky <maximlevitsky@yahoo.com>
Subject: [PATCH] [NETDEV] [004] dmfe : Add suspend/resume support

Adds support for suspend/resume

---


--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:46:13.000000000 +0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:50:52.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.
 
@@ -2027,11 +2024,59 @@ 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)
+{
+    u32 tmp;
+
+    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);
+    u32 tmp;
+
+    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");



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [NETDEV] [004] dmfe : Add suspend/resume support
  2007-02-07 18:33 [PATCH] [NETDEV] [004] dmfe : Add suspend/resume support Levitsky Maxim
@ 2007-02-09 20:54 ` Pavel Machek
  2007-02-11 21:05   ` Maxim
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2007-02-09 20:54 UTC (permalink / raw)
  To: Levitsky Maxim; +Cc: linux-kernel, tori, netdev

Hi!

> From: Maxim Levitsky <maximlevitsky@yahoo.com>
> Subject: [PATCH] [NETDEV] [004] dmfe : Add suspend/resume support
> 
> Adds support for suspend/resume

Patch looks ok, but your mailer damaged it heavily.

> --- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:46:13.000000000 +0200
> +++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:50:52.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.
>  
> @@ -2027,11 +2024,59 @@ 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)
> +{

							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [NETDEV] [004] dmfe : Add suspend/resume support
  2007-02-09 20:54 ` Pavel Machek
@ 2007-02-11 21:05   ` Maxim
  0 siblings, 0 replies; 3+ messages in thread
From: Maxim @ 2007-02-11 21:05 UTC (permalink / raw)
  To: Pavel Machek, pavel; +Cc: linux-kernel, tori, netdev

On Friday 09 February 2007 22:54:52 Pavel Machek wrote:
> Hi!
>
> > From: Maxim Levitsky <maximlevitsky@yahoo.com>
> > Subject: [PATCH] [NETDEV] [004] dmfe : Add suspend/resume support
> >
> > Adds support for suspend/resume
>
> Patch looks ok, but your mailer damaged it heavily.
>
> > --- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07
> > 18:46:13.000000000 +0200 +++
> > linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:50:52.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.
> >  
> > @@ -2027,11 +2024,59 @@ 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)
> > +{
>
> 							Pavel


Hi , thanks for reply , I will send them again, and this time I will check 
that mailer doesn't mess with patches.

I fixed word wrap problem.

I also want to note that my address is now maximlevitsky@gmail.com , the 
address I took recently because yahoo is only aviable via webmail
and it is not good for patches.

Thanks for reply, 

regards , Maxim Levitsky


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-11 21:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 18:33 [PATCH] [NETDEV] [004] dmfe : Add suspend/resume support Levitsky Maxim
2007-02-09 20:54 ` Pavel Machek
2007-02-11 21:05   ` Maxim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).