On 6/10/07, Török Edvin <[EMAIL PROTECTED]> wrote:
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...]

Ok, I need to shut down the PHY interface on the card, like this:

bw32(bp, B44_MAC_CTRL, MAC_CTRL_PHY_PDOWN);

Also doing a partial chip reset turns the LEDs off too.

I get 0.3-0.5 W power savings (after ifconfig eth0 down, or rmmod b44)!

I updated yesterday's patch. Can somebody else with a Broadcom card
confirm the power savings?

If yes, intend to post this patch to the b44 maintainer.

--- linux-2.6/drivers/net/b44.c 2007-04-28 18:42:06.000000000 +0300
+++ b/drivers/net/b44.c 2007-06-11 12:16:58.000000000 +0300
@@ -1283,7 +1283,7 @@
}

/* bp->lock is held. */
-static void b44_chip_reset(struct b44 *bp)
+static void b44_chip_reset(struct b44 *bp, int powerdown)
{
        if (ssb_is_core_up(bp)) {
                bw32(bp, B44_RCV_LAZY, 0);
@@ -1307,6 +1307,9 @@

        b44_clear_stats(bp);

+       if(powerdown)
+               return;/* don't enable PHY if we are going to power down */
+       
        /* Make PHY accessible. */
        bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
                             (0x0d & MDIO_CTRL_MAXF_MASK)));
@@ -1332,7 +1335,14 @@
static void b44_halt(struct b44 *bp)
{
        b44_disable_ints(bp);
-       b44_chip_reset(bp);
+       /* reset PHY */
+       b44_phy_reset(bp);
+       /* power down PHY */
+       printk(KERN_INFO "b44: powering down PHY\n");
+       bw32(bp, B44_MAC_CTRL, MAC_CTRL_PHY_PDOWN);
+       /* now reset the chip, but without enabling the MAC&PHY
+        * part of it. This has to be done _after_ we shut down the PHY */
+       b44_chip_reset(bp, 1);
}

/* bp->lock is held. */
@@ -1376,7 +1386,7 @@
{
        u32 val;

-       b44_chip_reset(bp);
+       b44_chip_reset(bp, 0);
        if (reset_kind == B44_FULL_RESET) {
                b44_phy_reset(bp);
                b44_setup_phy(bp);
@@ -1430,7 +1440,7 @@

        err = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev);
        if (unlikely(err < 0)) {
-               b44_chip_reset(bp);
+               b44_chip_reset(bp, 1);
                b44_free_rings(bp);
                b44_free_consistent(bp);
                goto out;
@@ -2126,6 +2136,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, "
@@ -2250,7 +2261,7 @@
        /* Chip reset provides power to the b44 MAC & PCI cores, which
         * is necessary for MAC register access.
         */
-       b44_chip_reset(bp);
+       b44_chip_reset(bp, 0);

        printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name);
        for (i = 0; i < 6; i++)
@@ -2284,6 +2295,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