aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJie Yang <jie.yang@atheros.com>2009-04-27 15:42:03 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-28 04:53:10 -0400
commit52fbc1007eb071c40a367462476eee695b412578 (patch)
treed046b8c29284da6eec4862e77fa77082e3398b8a /drivers
parent36e7b1b8dac1a785abca3a121b6b0b79f1a8d7df (diff)
atl1c: disable L1/L0s when link detected
Disable L1/L0s when link detected. We enable L1/L0s when link connected before, but there is some hareware error on some platform. So just diable this feature when link connected. This feature is about power saving. Signed-off-by: Jie Yang <jie.yang@atheros.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/atl1c/atl1c_main.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index deb7b53167ee..8b17278c4a58 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -220,11 +220,11 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter)
220 /* link down */ 220 /* link down */
221 if (netif_carrier_ok(netdev)) { 221 if (netif_carrier_ok(netdev)) {
222 hw->hibernate = true; 222 hw->hibernate = true;
223 atl1c_set_aspm(hw, false);
224 if (atl1c_stop_mac(hw) != 0) 223 if (atl1c_stop_mac(hw) != 0)
225 if (netif_msg_hw(adapter)) 224 if (netif_msg_hw(adapter))
226 dev_warn(&pdev->dev, 225 dev_warn(&pdev->dev,
227 "stop mac failed\n"); 226 "stop mac failed\n");
227 atl1c_set_aspm(hw, false);
228 } 228 }
229 netif_carrier_off(netdev); 229 netif_carrier_off(netdev);
230 } else { 230 } else {
@@ -240,10 +240,10 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter)
240 adapter->link_duplex != duplex) { 240 adapter->link_duplex != duplex) {
241 adapter->link_speed = speed; 241 adapter->link_speed = speed;
242 adapter->link_duplex = duplex; 242 adapter->link_duplex = duplex;
243 atl1c_set_aspm(hw, true);
243 atl1c_enable_tx_ctrl(hw); 244 atl1c_enable_tx_ctrl(hw);
244 atl1c_enable_rx_ctrl(hw); 245 atl1c_enable_rx_ctrl(hw);
245 atl1c_setup_mac_ctrl(adapter); 246 atl1c_setup_mac_ctrl(adapter);
246 atl1c_set_aspm(hw, true);
247 if (netif_msg_link(adapter)) 247 if (netif_msg_link(adapter))
248 dev_info(&pdev->dev, 248 dev_info(&pdev->dev,
249 "%s: %s NIC Link is Up<%d Mbps %s>\n", 249 "%s: %s NIC Link is Up<%d Mbps %s>\n",
@@ -1242,9 +1242,7 @@ static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
1242 1242
1243 AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data); 1243 AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data);
1244 1244
1245 pm_ctrl_data &= PM_CTRL_SERDES_PD_EX_L1; 1245 pm_ctrl_data &= ~PM_CTRL_SERDES_PD_EX_L1;
1246 pm_ctrl_data |= ~PM_CTRL_SERDES_BUDS_RX_L1_EN;
1247 pm_ctrl_data |= ~PM_CTRL_SERDES_L1_EN;
1248 pm_ctrl_data &= ~(PM_CTRL_L1_ENTRY_TIMER_MASK << 1246 pm_ctrl_data &= ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
1249 PM_CTRL_L1_ENTRY_TIMER_SHIFT); 1247 PM_CTRL_L1_ENTRY_TIMER_SHIFT);
1250 1248
@@ -1254,19 +1252,11 @@ static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
1254 pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN; 1252 pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN;
1255 pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1; 1253 pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1;
1256 1254
1257 if (hw->ctrl_flags & ATL1C_ASPM_L1_SUPPORT) { 1255 pm_ctrl_data |= PM_CTRL_SERDES_BUDS_RX_L1_EN;
1258 pm_ctrl_data |= AT_ASPM_L1_TIMER << 1256 pm_ctrl_data |= PM_CTRL_SERDES_L1_EN;
1259 PM_CTRL_L1_ENTRY_TIMER_SHIFT;
1260 pm_ctrl_data |= PM_CTRL_ASPM_L1_EN;
1261 } else
1262 pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
1263
1264 if (hw->ctrl_flags & ATL1C_ASPM_L0S_SUPPORT)
1265 pm_ctrl_data |= PM_CTRL_ASPM_L0S_EN;
1266 else
1267 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
1268
1269 } else { 1257 } else {
1258 pm_ctrl_data &= ~PM_CTRL_SERDES_BUDS_RX_L1_EN;
1259 pm_ctrl_data &= ~PM_CTRL_SERDES_L1_EN;
1270 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN; 1260 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
1271 pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN; 1261 pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN;
1272 1262