aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-03-09 11:58:23 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-10 04:56:13 -0500
commit683644b74783725971e5ff61618bd932c5361c3f (patch)
treecd38d85069a587c273fe14e20c0143a561811ee1 /drivers/net/tg3.c
parent4143470c10ab5c2bbd0522efe92935416332c5e8 (diff)
tg3: Refine VAux decision process
In the near future, the VAux switching decision process is going to get more complicated. This patch refines and consolidates the existing algorithm in anticipation of the new scheme. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-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.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 73eacbd5c94f..159eb230f1aa 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2120,7 +2120,7 @@ out:
2120 2120
2121static void tg3_frob_aux_power(struct tg3 *tp) 2121static void tg3_frob_aux_power(struct tg3 *tp)
2122{ 2122{
2123 struct tg3 *tp_peer = tp; 2123 bool need_vaux = false;
2124 2124
2125 /* The GPIOs do something completely different on 57765. */ 2125 /* The GPIOs do something completely different on 57765. */
2126 if ((tp->tg3_flags2 & TG3_FLG2_IS_NIC) == 0 || 2126 if ((tp->tg3_flags2 & TG3_FLG2_IS_NIC) == 0 ||
@@ -2128,23 +2128,32 @@ static void tg3_frob_aux_power(struct tg3 *tp)
2128 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765) 2128 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
2129 return; 2129 return;
2130 2130
2131 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || 2131 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
2132 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714 || 2132 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714 ||
2133 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { 2133 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) &&
2134 tp->pdev_peer != tp->pdev) {
2134 struct net_device *dev_peer; 2135 struct net_device *dev_peer;
2135 2136
2136 dev_peer = pci_get_drvdata(tp->pdev_peer); 2137 dev_peer = pci_get_drvdata(tp->pdev_peer);
2138
2137 /* remove_one() may have been run on the peer. */ 2139 /* remove_one() may have been run on the peer. */
2138 if (!dev_peer) 2140 if (dev_peer) {
2139 tp_peer = tp; 2141 struct tg3 *tp_peer = netdev_priv(dev_peer);
2140 else 2142
2141 tp_peer = netdev_priv(dev_peer); 2143 if (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE)
2144 return;
2145
2146 if ((tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) ||
2147 (tp_peer->tg3_flags & TG3_FLAG_ENABLE_ASF))
2148 need_vaux = true;
2149 }
2142 } 2150 }
2143 2151
2144 if ((tp->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 || 2152 if ((tp->tg3_flags & TG3_FLAG_WOL_ENABLE) ||
2145 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0 || 2153 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF))
2146 (tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 || 2154 need_vaux = true;
2147 (tp_peer->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0) { 2155
2156 if (need_vaux) {
2148 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 2157 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
2149 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) { 2158 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
2150 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 2159 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
@@ -2174,10 +2183,6 @@ static void tg3_frob_aux_power(struct tg3 *tp)
2174 u32 no_gpio2; 2183 u32 no_gpio2;
2175 u32 grc_local_ctrl = 0; 2184 u32 grc_local_ctrl = 0;
2176 2185
2177 if (tp_peer != tp &&
2178 (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0)
2179 return;
2180
2181 /* Workaround to prevent overdrawing Amps. */ 2186 /* Workaround to prevent overdrawing Amps. */
2182 if (GET_ASIC_REV(tp->pci_chip_rev_id) == 2187 if (GET_ASIC_REV(tp->pci_chip_rev_id) ==
2183 ASIC_REV_5714) { 2188 ASIC_REV_5714) {
@@ -2216,10 +2221,6 @@ static void tg3_frob_aux_power(struct tg3 *tp)
2216 } else { 2221 } else {
2217 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 && 2222 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
2218 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { 2223 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) {
2219 if (tp_peer != tp &&
2220 (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0)
2221 return;
2222
2223 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 2224 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
2224 (GRC_LCLCTRL_GPIO_OE1 | 2225 (GRC_LCLCTRL_GPIO_OE1 |
2225 GRC_LCLCTRL_GPIO_OUTPUT1), 100); 2226 GRC_LCLCTRL_GPIO_OUTPUT1), 100);