netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* de2104x: fix power management
@ 2010-09-25  9:57 Ondrej Zary
  2010-09-25 17:16 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Ondrej Zary @ 2010-09-25  9:57 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, Kernel development list

At least my 21041 cards come out of suspend with bus mastering disabled so
they did not work after resume(no data transferred).
After adding pci_set_master(), the driver oopsed immediately on resume -
because de_clean_rings() is called on suspend but de_init_rings() call
was missing in resume.

Also disable link (reset SIA) before sleep (de4x5 does this too).

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

--- linux-2.6.36-rc3-/drivers/net/tulip/de2104x.c	2010-09-25 11:27:26.000000000 +0200
+++ linux-2.6.36-rc3/drivers/net/tulip/de2104x.c	2010-09-25 11:29:22.000000000 +0200
@@ -1231,6 +1231,7 @@ static void de_adapter_sleep (struct de_
 	if (de->de21040)
 		return;
 
+	dw32(CSR13, 0); /* Reset phy */
 	pci_read_config_dword(de->pdev, PCIPM, &pmctl);
 	pmctl |= PM_Sleep;
 	pci_write_config_dword(de->pdev, PCIPM, pmctl);
@@ -2166,6 +2167,8 @@ static int de_resume (struct pci_dev *pd
 		dev_err(&dev->dev, "pci_enable_device failed in resume\n");
 		goto out;
 	}
+	pci_set_master(pdev);
+	de_init_rings(de);
 	de_init_hw(de);
 out_attach:
 	netif_device_attach(dev);


-- 
Ondrej Zary

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

* Re: de2104x: fix power management
  2010-09-25  9:57 de2104x: fix power management Ondrej Zary
@ 2010-09-25 17:16 ` Jeff Garzik
  2010-09-26 22:49   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2010-09-25 17:16 UTC (permalink / raw)
  To: Ondrej Zary; +Cc: netdev, Kernel development list

On 09/25/2010 05:57 AM, Ondrej Zary wrote:
> At least my 21041 cards come out of suspend with bus mastering disabled so
> they did not work after resume(no data transferred).
> After adding pci_set_master(), the driver oopsed immediately on resume -
> because de_clean_rings() is called on suspend but de_init_rings() call
> was missing in resume.
>
> Also disable link (reset SIA) before sleep (de4x5 does this too).
>
> Signed-off-by: Ondrej Zary<linux@rainbow-software.org>
>
> --- linux-2.6.36-rc3-/drivers/net/tulip/de2104x.c	2010-09-25 11:27:26.000000000 +0200
> +++ linux-2.6.36-rc3/drivers/net/tulip/de2104x.c	2010-09-25 11:29:22.000000000 +0200
> @@ -1231,6 +1231,7 @@ static void de_adapter_sleep (struct de_
>   	if (de->de21040)
>   		return;
>
> +	dw32(CSR13, 0); /* Reset phy */
>   	pci_read_config_dword(de->pdev, PCIPM,&pmctl);
>   	pmctl |= PM_Sleep;
>   	pci_write_config_dword(de->pdev, PCIPM, pmctl);
> @@ -2166,6 +2167,8 @@ static int de_resume (struct pci_dev *pd
>   		dev_err(&dev->dev, "pci_enable_device failed in resume\n");
>   		goto out;
>   	}
> +	pci_set_master(pdev);
> +	de_init_rings(de);
>   	de_init_hw(de);
>   out_attach:
>   	netif_device_attach(dev);

Acked-by: Jeff Garzik <jgarzik@redhat.com>

IMO suspend/resume could use another look; if netif_running is false 
(interface is down), de2104x does not put the PCI device to sleep, which 
seems strange.

I also wonder if rtnl_lock() couldn't be eliminated, as other net 
drivers don't need it in suspend/resume.


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

* Re: de2104x: fix power management
  2010-09-25 17:16 ` Jeff Garzik
@ 2010-09-26 22:49   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-09-26 22:49 UTC (permalink / raw)
  To: jgarzik; +Cc: linux, netdev, linux-kernel

From: Jeff Garzik <jgarzik@pobox.com>
Date: Sat, 25 Sep 2010 13:16:56 -0400

> On 09/25/2010 05:57 AM, Ondrej Zary wrote:
>> At least my 21041 cards come out of suspend with bus mastering
>> disabled so
>> they did not work after resume(no data transferred).
>> After adding pci_set_master(), the driver oopsed immediately on resume
>> -
>> because de_clean_rings() is called on suspend but de_init_rings() call
>> was missing in resume.
>>
>> Also disable link (reset SIA) before sleep (de4x5 does this too).
>>
>> Signed-off-by: Ondrej Zary<linux@rainbow-software.org>
 ...
> Acked-by: Jeff Garzik <jgarzik@redhat.com>

I'll apply this, thanks guys.

> IMO suspend/resume could use another look; if netif_running is false
> (interface is down), de2104x does not put the PCI device to sleep,
> which seems strange.

TG3 does the same.

The reason is that until we bringing the device up (and thus
netif_running becomes true) the device is left in the most appropriate
powered down state.

At least that is my understanding.

What is appropriate for any driver in this situation depends upon how
it programs the device before ->open() occurs.

> I also wonder if rtnl_lock() couldn't be eliminated, as other net
> drivers don't need it in suspend/resume.

I suspect the RTNL stuff here can be safely removed.

I think it's using it to guard the netif_running() check but that
isn't necessary.

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

end of thread, other threads:[~2010-09-26 22:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-25  9:57 de2104x: fix power management Ondrej Zary
2010-09-25 17:16 ` Jeff Garzik
2010-09-26 22:49   ` David Miller

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).