Hi,

When shutting down the broadcom network card (via ifconfig eth0 down,
or rmmod b44),
it still stays in D0 state.

Attached patch makes it go into D3cold state. Also it activates the
power management on the card (using code similar to setup_wol).
If I apply this patch, shut down the network card, _and_ pull the
ethernet cable, I get 0.2W savings.

If I leave the cable in, or use D3hot state (instead of D3cold) I get
no power savings.
Its strange why the card still generates link carrier signal, even if
shut down (pci_disable_device), and in D3cold state. [and
netif_carrier_down is called...]

Patch has been tested on 2.6.21 kernel, but should work with 2.6.22-rc4 too.

--Edwin
--- linux-2.6/drivers/net/b44.c	2007-04-28 18:42:06.000000000 +0300
+++ b/drivers/net/b44.c	2007-06-10 19:46:19.000000000 +0300
@@ -1635,6 +1635,15 @@
 	if (bp->flags & B44_FLAG_WOL_ENABLE) {
 		b44_init_hw(bp, B44_PARTIAL_RESET);
 		b44_setup_wol(bp);
+	} else {
+		u32 val;
+		u16 pmval;
+		/* enable PM even if WOL is inactive */
+		val = br32(bp, B44_SBTMSLOW);
+		bw32(bp, B44_SBTMSLOW, val | SBTMSLOW_PE);
+
+		pci_read_config_word(bp->pdev, SSB_PMCSR, &pmval);
+		pci_write_config_word(bp->pdev, SSB_PMCSR, pmval | SSB_PE);
 	}
 
 	b44_free_consistent(bp);
@@ -2126,6 +2135,7 @@
 	if (b44_version_printed++ == 0)
 		printk(KERN_INFO "%s", version);
 
+	pci_set_power_state(pdev, PCI_D0);
 	err = pci_enable_device(pdev);
 	if (err) {
 		dev_err(&pdev->dev, "Cannot enable PCI device, "
@@ -2284,6 +2294,7 @@
 	free_netdev(dev);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
+	pci_set_power_state(pdev, PCI_D3cold);
 	pci_set_drvdata(pdev, NULL);
 }
 
_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to