[PATCH 0/4] atl1: fix suspend, resume, wake-on-lan - Kernel

This is a discussion on [PATCH 0/4] atl1: fix suspend, resume, wake-on-lan - Kernel ; These patches fix suspend, resume, and wake-on-lan. Please merge for 2.6.27. Diffstat drivers/net/atlx/atl1.c | 157 +++++++++++++++++++++++++++++------------------ drivers/net/atlx/atl1.h | 2 +- drivers/net/atlx/atlx.c | 2 +- drivers/net/atlx/atlx.h | 7 ++- 4 files changed, 105 insertions(+), 63 deletions(-) -- To unsubscribe from this ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: [PATCH 0/4] atl1: fix suspend, resume, wake-on-lan

  1. [PATCH 0/4] atl1: fix suspend, resume, wake-on-lan


    These patches fix suspend, resume, and wake-on-lan. Please merge for 2.6.27.

    Diffstat

    drivers/net/atlx/atl1.c | 157 +++++++++++++++++++++++++++++------------------
    drivers/net/atlx/atl1.h | 2 +-
    drivers/net/atlx/atlx.c | 2 +-
    drivers/net/atlx/atlx.h | 7 ++-
    4 files changed, 105 insertions(+), 63 deletions(-)

    --
    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/

  2. [PATCH 4/4] atl1: bump version number

    atl1-2.1.3.

    Signed-off-by: Jay Cliburn
    ---
    drivers/net/atlx/atl1.c | 2 +-
    drivers/net/atlx/atl1.h | 2 +-
    drivers/net/atlx/atlx.c | 2 +-
    drivers/net/atlx/atlx.h | 4 ++--
    4 files changed, 5 insertions(+), 5 deletions(-)

    diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
    index b7092a3..9c2394d 100644
    --- a/drivers/net/atlx/atl1.c
    +++ b/drivers/net/atlx/atl1.c
    @@ -1,7 +1,7 @@
    /*
    * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
    * Copyright(c) 2006 - 2007 Chris Snook
    - * Copyright(c) 2006 Jay Cliburn
    + * Copyright(c) 2006 - 2008 Jay Cliburn
    *
    * Derived from Intel e1000 driver
    * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
    diff --git a/drivers/net/atlx/atl1.h b/drivers/net/atlx/atl1.h
    index 51893d6..a5015b1 100644
    --- a/drivers/net/atlx/atl1.h
    +++ b/drivers/net/atlx/atl1.h
    @@ -1,7 +1,7 @@
    /*
    * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
    * Copyright(c) 2006 - 2007 Chris Snook
    - * Copyright(c) 2006 Jay Cliburn
    + * Copyright(c) 2006 - 2008 Jay Cliburn
    *
    * Derived from Intel e1000 driver
    * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
    diff --git a/drivers/net/atlx/atlx.c b/drivers/net/atlx/atlx.c
    index f06b854..b3e7fcf 100644
    --- a/drivers/net/atlx/atlx.c
    +++ b/drivers/net/atlx/atlx.c
    @@ -2,7 +2,7 @@
    *
    * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
    * Copyright(c) 2006 - 2007 Chris Snook
    - * Copyright(c) 2006 Jay Cliburn
    + * Copyright(c) 2006 - 2008 Jay Cliburn
    * Copyright(c) 2007 Atheros Corporation. All rights reserved.
    *
    * Derived from Intel e1000 driver
    diff --git a/drivers/net/atlx/atlx.h b/drivers/net/atlx/atlx.h
    index 9672188..297a03d 100644
    --- a/drivers/net/atlx/atlx.h
    +++ b/drivers/net/atlx/atlx.h
    @@ -2,7 +2,7 @@
    *
    * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
    * Copyright(c) 2006 - 2007 Chris Snook
    - * Copyright(c) 2006 Jay Cliburn
    + * Copyright(c) 2006 - 2008 Jay Cliburn
    * Copyright(c) 2007 Atheros Corporation. All rights reserved.
    *
    * Derived from Intel e1000 driver
    @@ -29,7 +29,7 @@
    #include
    #include

    -#define ATLX_DRIVER_VERSION "2.1.1"
    +#define ATLX_DRIVER_VERSION "2.1.3"
    MODULE_AUTHOR("Xiong Huang , \
    Chris Snook , Jay Cliburn ");
    MODULE_LICENSE("GPL");
    --
    1.5.4.1

    --
    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/

  3. [PATCH 3/4] atl1: add shutdown callback

    Add a shutdown callback that points to atl1_suspend(). This, along
    with a working suspend function, fixes wake-on-lan.

    Tested-by: Per Olofsson
    Signed-off-by: Jay Cliburn
    ---
    drivers/net/atlx/atl1.c | 11 +++++++++--
    1 files changed, 9 insertions(+), 2 deletions(-)

    diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
    index 12fb3e5..b7092a3 100644
    --- a/drivers/net/atlx/atl1.c
    +++ b/drivers/net/atlx/atl1.c
    @@ -36,7 +36,6 @@
    * A very incomplete list of things that need to be dealt with:
    *
    * TODO:
    - * Wake on LAN.
    * Add more ethtool functions.
    * Fix abstruse irq enable/disable condition described here:
    * http://marc.theaimsgroup.com/?l=linu...8508500553&w=2
    @@ -2908,6 +2907,13 @@ static int atl1_resume(struct pci_dev *pdev)
    #define atl1_resume NULL
    #endif

    +static void atl1_shutdown(struct pci_dev *pdev)
    +{
    +#ifdef CONFIG_PM
    + atl1_suspend(pdev, PMSG_SUSPEND);
    +#endif
    +}
    +
    #ifdef CONFIG_NET_POLL_CONTROLLER
    static void atl1_poll_controller(struct net_device *netdev)
    {
    @@ -3154,7 +3160,8 @@ static struct pci_driver atl1_driver = {
    .probe = atl1_probe,
    .remove = __devexit_p(atl1_remove),
    .suspend = atl1_suspend,
    - .resume = atl1_resume
    + .resume = atl1_resume,
    + .shutdown = atl1_shutdown
    };

    /*
    --
    1.5.4.1

    --
    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/

  4. [PATCH 2/4] atl1: fix broken suspend and resume

    Fix atl1_suspend() and atl1_resume() so they actually work. We'll use
    the suspend function for wake-on-lan in addition to just suspending.

    Signed-off-by: Jay Cliburn
    ---
    drivers/net/atlx/atl1.c | 125 ++++++++++++++++++++++++++++++-----------------
    1 files changed, 80 insertions(+), 45 deletions(-)

    diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
    index 3beb44e..12fb3e5 100644
    --- a/drivers/net/atlx/atl1.c
    +++ b/drivers/net/atlx/atl1.c
    @@ -2781,64 +2781,93 @@ static int atl1_suspend(struct pci_dev *pdev, pm_message_t state)
    struct atl1_hw *hw = &adapter->hw;
    u32 ctrl = 0;
    u32 wufc = adapter->wol;
    + u32 val;
    + int retval;
    + u16 speed;
    + u16 duplex;

    netif_device_detach(netdev);
    if (netif_running(netdev))
    atl1_down(adapter);

    + retval = pci_save_state(pdev);
    + if (retval)
    + return retval;
    +
    atl1_read_phy_reg(hw, MII_BMSR, (u16 *) & ctrl);
    atl1_read_phy_reg(hw, MII_BMSR, (u16 *) & ctrl);
    - if (ctrl & BMSR_LSTATUS)
    + val = ctrl & BMSR_LSTATUS;
    + if (val)
    wufc &= ~ATLX_WUFC_LNKC;

    - /* reduce speed to 10/100M */
    - if (wufc) {
    - atl1_phy_enter_power_saving(hw);
    - /* if resume, let driver to re- setup link */
    - hw->phy_configured = false;
    - atl1_set_mac_addr(hw);
    - atlx_set_multi(netdev);
    + if (val && wufc) {
    + val = atl1_get_speed_and_duplex(hw, &speed, &duplex);
    + if (val) {
    + if (netif_msg_ifdown(adapter))
    + dev_printk(KERN_DEBUG, &pdev->dev,
    + "error getting speed/duplex\n");
    + goto disable_wol;
    + }

    ctrl = 0;
    - /* turn on magic packet wol */
    - if (wufc & ATLX_WUFC_MAG)
    - ctrl = WOL_MAGIC_EN | WOL_MAGIC_PME_EN;

    - /* turn on Link change WOL */
    - if (wufc & ATLX_WUFC_LNKC)
    - ctrl |= (WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN);
    + /* enable magic packet WOL */
    + if (wufc & ATLX_WUFC_MAG)
    + ctrl |= (WOL_MAGIC_EN | WOL_MAGIC_PME_EN);
    iowrite32(ctrl, hw->hw_addr + REG_WOL_CTRL);
    -
    - /* turn on all-multi mode if wake on multicast is enabled */
    - ctrl = ioread32(hw->hw_addr + REG_MAC_CTRL);
    - ctrl &= ~MAC_CTRL_DBG;
    - ctrl &= ~MAC_CTRL_PROMIS_EN;
    - if (wufc & ATLX_WUFC_MC)
    - ctrl |= MAC_CTRL_MC_ALL_EN;
    - else
    - ctrl &= ~MAC_CTRL_MC_ALL_EN;
    -
    - /* turn on broadcast mode if wake on-BC is enabled */
    - if (wufc & ATLX_WUFC_BC)
    + ioread32(hw->hw_addr + REG_WOL_CTRL);
    +
    + /* configure the mac */
    + ctrl = MAC_CTRL_RX_EN;
    + ctrl |= ((u32)((speed == SPEED_1000) ? MAC_CTRL_SPEED_1000 :
    + MAC_CTRL_SPEED_10_100) << MAC_CTRL_SPEED_SHIFT);
    + if (duplex == FULL_DUPLEX)
    + ctrl |= MAC_CTRL_DUPLX;
    + ctrl |= (((u32)adapter->hw.preamble_len &
    + MAC_CTRL_PRMLEN_MASK) << MAC_CTRL_PRMLEN_SHIFT);
    + if (adapter->vlgrp)
    + ctrl |= MAC_CTRL_RMV_VLAN;
    + if (wufc & ATLX_WUFC_MAG)
    ctrl |= MAC_CTRL_BC_EN;
    - else
    - ctrl &= ~MAC_CTRL_BC_EN;
    -
    - /* enable RX */
    - ctrl |= MAC_CTRL_RX_EN;
    iowrite32(ctrl, hw->hw_addr + REG_MAC_CTRL);
    - pci_enable_wake(pdev, PCI_D3hot, 1);
    - pci_enable_wake(pdev, PCI_D3cold, 1);
    - } else {
    - iowrite32(0, hw->hw_addr + REG_WOL_CTRL);
    - pci_enable_wake(pdev, PCI_D3hot, 0);
    - pci_enable_wake(pdev, PCI_D3cold, 0);
    + ioread32(hw->hw_addr + REG_MAC_CTRL);
    +
    + /* poke the PHY */
    + ctrl = ioread32(hw->hw_addr + REG_PCIE_PHYMISC);
    + ctrl |= PCIE_PHYMISC_FORCE_RCV_DET;
    + iowrite32(ctrl, hw->hw_addr + REG_PCIE_PHYMISC);
    + ioread32(hw->hw_addr + REG_PCIE_PHYMISC);
    +
    + pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
    + goto exit;
    }

    - pci_save_state(pdev);
    + if (!val && wufc) {
    + ctrl |= (WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN);
    + iowrite32(ctrl, hw->hw_addr + REG_WOL_CTRL);
    + ioread32(hw->hw_addr + REG_WOL_CTRL);
    + iowrite32(0, hw->hw_addr + REG_MAC_CTRL);
    + ioread32(hw->hw_addr + REG_MAC_CTRL);
    + hw->phy_configured = false;
    + pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
    + goto exit;
    + }
    +
    +disable_wol:
    + iowrite32(0, hw->hw_addr + REG_WOL_CTRL);
    + ioread32(hw->hw_addr + REG_WOL_CTRL);
    + ctrl = ioread32(hw->hw_addr + REG_PCIE_PHYMISC);
    + ctrl |= PCIE_PHYMISC_FORCE_RCV_DET;
    + iowrite32(ctrl, hw->hw_addr + REG_PCIE_PHYMISC);
    + ioread32(hw->hw_addr + REG_PCIE_PHYMISC);
    + atl1_phy_enter_power_saving(hw);
    + hw->phy_configured = false;
    + pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
    +exit:
    + if (netif_running(netdev))
    + pci_disable_msi(adapter->pdev);
    pci_disable_device(pdev);
    -
    - pci_set_power_state(pdev, PCI_D3hot);
    + pci_set_power_state(pdev, pci_choose_state(pdev, state));

    return 0;
    }
    @@ -2852,20 +2881,26 @@ static int atl1_resume(struct pci_dev *pdev)
    pci_set_power_state(pdev, PCI_D0);
    pci_restore_state(pdev);

    - /* FIXME: check and handle */
    err = pci_enable_device(pdev);
    + if (err) {
    + if (netif_msg_ifup(adapter))
    + dev_printk(KERN_DEBUG, &pdev->dev,
    + "error enabling pci device\n");
    + return err;
    + }
    +
    + pci_set_master(pdev);
    + iowrite32(0, adapter->hw.hw_addr + REG_WOL_CTRL);
    pci_enable_wake(pdev, PCI_D3hot, 0);
    pci_enable_wake(pdev, PCI_D3cold, 0);

    - iowrite32(0, adapter->hw.hw_addr + REG_WOL_CTRL);
    - atl1_reset(adapter);
    + atl1_reset_hw(&adapter->hw);
    + adapter->cmb.cmb->int_stats = 0;

    if (netif_running(netdev))
    atl1_up(adapter);
    netif_device_attach(netdev);

    - atl1_via_workaround(adapter);
    -
    return 0;
    }
    #else
    --
    1.5.4.1

    --
    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/

  5. [PATCH 1/4] atl1: add PHY power save mode

    Using vendor-provided magic, add code to enter power save mode
    on the PHY. We'll need this for suspend and wake-on-lan.

    Signed-off-by: Jay Cliburn
    ---
    drivers/net/atlx/atl1.c | 19 ++++++++-----------
    drivers/net/atlx/atlx.h | 3 +++
    2 files changed, 11 insertions(+), 11 deletions(-)

    diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
    index 0afe522..3beb44e 100644
    --- a/drivers/net/atlx/atl1.c
    +++ b/drivers/net/atlx/atl1.c
    @@ -638,21 +638,18 @@ static s32 atl1_phy_leave_power_saving(struct atl1_hw *hw)
    }

    /*
    - *TODO: do something or get rid of this
    + * Force the PHY into power saving mode using vendor magic.
    */
    #ifdef CONFIG_PM
    -static s32 atl1_phy_enter_power_saving(struct atl1_hw *hw)
    +static void atl1_phy_enter_power_saving(struct atl1_hw *hw)
    {
    -/* s32 ret_val;
    - * u16 phy_data;
    - */
    + atl1_write_phy_reg(hw, MII_DBG_ADDR, 0);
    + atl1_write_phy_reg(hw, MII_DBG_DATA, 0x124E);
    + atl1_write_phy_reg(hw, MII_DBG_ADDR, 2);
    + atl1_write_phy_reg(hw, MII_DBG_DATA, 0x3000);
    + atl1_write_phy_reg(hw, MII_DBG_ADDR, 3);
    + atl1_write_phy_reg(hw, MII_DBG_DATA, 0);

    -/*
    - ret_val = atl1_write_phy_reg(hw, ...);
    - ret_val = atl1_write_phy_reg(hw, ...);
    - ....
    -*/
    - return 0;
    }
    #endif

    diff --git a/drivers/net/atlx/atlx.h b/drivers/net/atlx/atlx.h
    index 3be7c09..9672188 100644
    --- a/drivers/net/atlx/atlx.h
    +++ b/drivers/net/atlx/atlx.h
    @@ -460,6 +460,9 @@ MODULE_VERSION(ATLX_DRIVER_VERSION);
    #define MII_ATLX_PSSR_100MBS 0x4000 /* 01=100Mbs */
    #define MII_ATLX_PSSR_1000MBS 0x8000 /* 10=1000Mbs */

    +#define MII_DBG_ADDR 0x1D
    +#define MII_DBG_DATA 0x1E
    +
    /* PCI Command Register Bit Definitions */
    #define PCI_REG_COMMAND 0x04 /* PCI Command Register */
    #define CMD_IO_SPACE 0x0001
    --
    1.5.4.1

    --
    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/

  6. Re: [PATCH 1/4] atl1: add PHY power save mode

    Jay Cliburn wrote:
    > Using vendor-provided magic, add code to enter power save mode
    > on the PHY. We'll need this for suspend and wake-on-lan.
    >
    > Signed-off-by: Jay Cliburn
    > ---
    > drivers/net/atlx/atl1.c | 19 ++++++++-----------
    > drivers/net/atlx/atlx.h | 3 +++
    > 2 files changed, 11 insertions(+), 11 deletions(-)


    applied 1-4


    --
    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/

+ Reply to Thread