aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2008-11-03 19:51:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-03 19:51:36 -0500
commit3f007891da0ad3d9192e9aa13ce4e3aaf20c33fa (patch)
tree6eeb9db2e6100fd4e75bbd83f42852f7f3cfff0d /drivers/net/tg3.c
parentb2aee1545dc3c05c8d5cf116de1e92907e98009b (diff)
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 <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c76
1 files changed, 39 insertions, 37 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index e04cd9814e85..9bd1be48d0f5 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2014,6 +2014,43 @@ static void tg3_power_down_phy(struct tg3 *tp)
2014 tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); 2014 tg3_writephy(tp, MII_BMCR, BMCR_PDOWN);
2015} 2015}
2016 2016
2017/* tp->lock is held. */
2018static void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
2019{
2020 u32 addr_high, addr_low;
2021 int i;
2022
2023 addr_high = ((tp->dev->dev_addr[0] << 8) |
2024 tp->dev->dev_addr[1]);
2025 addr_low = ((tp->dev->dev_addr[2] << 24) |
2026 (tp->dev->dev_addr[3] << 16) |
2027 (tp->dev->dev_addr[4] << 8) |
2028 (tp->dev->dev_addr[5] << 0));
2029 for (i = 0; i < 4; i++) {
2030 if (i == 1 && skip_mac_1)
2031 continue;
2032 tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high);
2033 tw32(MAC_ADDR_0_LOW + (i * 8), addr_low);
2034 }
2035
2036 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
2037 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
2038 for (i = 0; i < 12; i++) {
2039 tw32(MAC_EXTADDR_0_HIGH + (i * 8), addr_high);
2040 tw32(MAC_EXTADDR_0_LOW + (i * 8), addr_low);
2041 }
2042 }
2043
2044 addr_high = (tp->dev->dev_addr[0] +
2045 tp->dev->dev_addr[1] +
2046 tp->dev->dev_addr[2] +
2047 tp->dev->dev_addr[3] +
2048 tp->dev->dev_addr[4] +
2049 tp->dev->dev_addr[5]) &
2050 TX_BACKOFF_SEED_MASK;
2051 tw32(MAC_TX_BACKOFF_SEED, addr_high);
2052}
2053
2017static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) 2054static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2018{ 2055{
2019 u32 misc_host_ctrl; 2056 u32 misc_host_ctrl;
@@ -2101,6 +2138,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2101 } 2138 }
2102 } 2139 }
2103 2140
2141 __tg3_set_mac_addr(tp, 0);
2142
2104 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { 2143 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
2105 u32 val; 2144 u32 val;
2106 2145
@@ -6901,43 +6940,6 @@ static int tg3_load_tso_firmware(struct tg3 *tp)
6901} 6940}
6902 6941
6903 6942
6904/* tp->lock is held. */
6905static void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
6906{
6907 u32 addr_high, addr_low;
6908 int i;
6909
6910 addr_high = ((tp->dev->dev_addr[0] << 8) |
6911 tp->dev->dev_addr[1]);
6912 addr_low = ((tp->dev->dev_addr[2] << 24) |
6913 (tp->dev->dev_addr[3] << 16) |
6914 (tp->dev->dev_addr[4] << 8) |
6915 (tp->dev->dev_addr[5] << 0));
6916 for (i = 0; i < 4; i++) {
6917 if (i == 1 && skip_mac_1)
6918 continue;
6919 tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high);
6920 tw32(MAC_ADDR_0_LOW + (i * 8), addr_low);
6921 }
6922
6923 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
6924 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
6925 for (i = 0; i < 12; i++) {
6926 tw32(MAC_EXTADDR_0_HIGH + (i * 8), addr_high);
6927 tw32(MAC_EXTADDR_0_LOW + (i * 8), addr_low);
6928 }
6929 }
6930
6931 addr_high = (tp->dev->dev_addr[0] +
6932 tp->dev->dev_addr[1] +
6933 tp->dev->dev_addr[2] +
6934 tp->dev->dev_addr[3] +
6935 tp->dev->dev_addr[4] +
6936 tp->dev->dev_addr[5]) &
6937 TX_BACKOFF_SEED_MASK;
6938 tw32(MAC_TX_BACKOFF_SEED, addr_high);
6939}
6940
6941static int tg3_set_mac_addr(struct net_device *dev, void *p) 6943static int tg3_set_mac_addr(struct net_device *dev, void *p)
6942{ 6944{
6943 struct tg3 *tp = netdev_priv(dev); 6945 struct tg3 *tp = netdev_priv(dev);