tg3: Preserve LAA when device control is released
Subsystems (2)
PATCH 4/15 tg3: Preserve LAA when device control is released
This patch moves the __tg3_set_mac_addr() function earlier in the file listing, to avoid a function prototype, and calls the function to restore the LAA after a driver unload chip reset. With this code in place, the administrator can wake the machine using the LAA.
Signed-off-by Matt Carlson <[email protected]>
Signed-off-by Michael Chan <[email protected]>
--- drivers/net/tg3.c | 76 +++++++++++++++++++++++++++------------------------- 1 files changed, 39 insertions(+), 37 deletions(-)
drivers/net/tg3.c +39 -37
@@ -2014,6 +2014,43 @@ static void tg3_power_down_phy(struct tg3 *tp)tg3_writephy (tp,MII_BMCR ,BMCR_PDOWN ); } +/* tp->lock is held. */ +static void __tg3_set_mac_addr (struct tg3 *tp,int skip_mac_1) +{ +u32 addr_high, addr_low; +int i; + + addr_high = ((tp->dev->dev_addr[0 ] <<8 ) | + tp->dev->dev_addr[1 ]); + addr_low = ((tp->dev->dev_addr[2 ] <<24 ) | + (tp->dev->dev_addr[3 ] <<16 ) | + (tp->dev->dev_addr[4 ] <<8 ) | + (tp->dev->dev_addr[5 ] <<0 )); +for (i =0 ; i <4 ; i++) { +if (i ==1 && skip_mac_1) +continue ; +tw32 (MAC_ADDR_0_HIGH + (i *8 ), addr_high); +tw32 (MAC_ADDR_0_LOW + (i *8 ), addr_low); + } + +if (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5703 || +GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5704 ) { +for (i =0 ; i <12 ; i++) { +tw32 (MAC_EXTADDR_0_HIGH + (i *8 ), addr_high); +tw32 (MAC_EXTADDR_0_LOW + (i *8 ), addr_low); + } + } + + addr_high = (tp->dev->dev_addr[0 ] + + tp->dev->dev_addr[1 ] + + tp->dev->dev_addr[2 ] + + tp->dev->dev_addr[3 ] + + tp->dev->dev_addr[4 ] + + tp->dev->dev_addr[5 ]) & +TX_BACKOFF_SEED_MASK ; +tw32 (MAC_TX_BACKOFF_SEED , addr_high); +} +static int tg3_set_power_state (struct tg3 *tp,pci_power_t state) {u32 misc_host_ctrl;
@@ -2101,6 +2138,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) } } +__tg3_set_mac_addr (tp,0 ); +if (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5906 ) {u32 val;
@@ -6901,43 +6940,6 @@ static int tg3_load_tso_firmware(struct tg3 *tp) } -/* tp->lock is held. */ -static void __tg3_set_mac_addr (struct tg3 *tp,int skip_mac_1) -{ -u32 addr_high, addr_low; -int i; - - addr_high = ((tp->dev->dev_addr[0 ] <<8 ) | - tp->dev->dev_addr[1 ]); - addr_low = ((tp->dev->dev_addr[2 ] <<24 ) | - (tp->dev->dev_addr[3 ] <<16 ) | - (tp->dev->dev_addr[4 ] <<8 ) | - (tp->dev->dev_addr[5 ] <<0 )); -for (i =0 ; i <4 ; i++) { -if (i ==1 && skip_mac_1) -continue ; -tw32 (MAC_ADDR_0_HIGH + (i *8 ), addr_high); -tw32 (MAC_ADDR_0_LOW + (i *8 ), addr_low); - } - -if (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5703 || -GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5704 ) { -for (i =0 ; i <12 ; i++) { -tw32 (MAC_EXTADDR_0_HIGH + (i *8 ), addr_high); -tw32 (MAC_EXTADDR_0_LOW + (i *8 ), addr_low); - } - } - - addr_high = (tp->dev->dev_addr[0 ] + - tp->dev->dev_addr[1 ] + - tp->dev->dev_addr[2 ] + - tp->dev->dev_addr[3 ] + - tp->dev->dev_addr[4 ] + - tp->dev->dev_addr[5 ]) & -TX_BACKOFF_SEED_MASK ; -tw32 (MAC_TX_BACKOFF_SEED , addr_high); -} -static int tg3_set_mac_addr (struct net_device *dev,void *p) {struct tg3 *tp =netdev_priv (dev);
Signature · 1 line
1.5.6.4
From: "Matt Carlson" <[email protected]>
Date: Mon, 3 Nov 2008 02:11:19 -0800
Quoted 7 lines
This patch moves the
__tg3_set_mac_addr()function earlier in the file listing, to avoid a function prototype, and calls the function to restore the LAA after a driver unload chip reset. With this code in place, the administrator can wake the machine using the LAA.Signed-off-by Matt Carlson <[email protected]>Signed-off-by Michael Chan <[email protected]>
Applied.