aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atl1c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-15 12:40:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-15 12:40:05 -0400
commit2ed0e21b30b53d3a94e204196e523e6c8f732b56 (patch)
treede2635426477d86338a9469ce09ba0626052288f /drivers/net/atl1c
parent0fa213310cd8fa7a51071cdcf130e26fa56e9549 (diff)
parent9cbc1cb8cd46ce1f7645b9de249b2ce8460129bb (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1244 commits) pkt_sched: Rename PSCHED_US2NS and PSCHED_NS2US ipv4: Fix fib_trie rebalancing Bluetooth: Fix issue with uninitialized nsh.type in DTL-1 driver Bluetooth: Fix Kconfig issue with RFKILL integration PIM-SM: namespace changes ipv4: update ARPD help text net: use a deferred timer in rt_check_expire ieee802154: fix kconfig bool/tristate muckup bonding: initialization rework bonding: use is_zero_ether_addr bonding: network device names are case sensative bonding: elminate bad refcount code bonding: fix style issues bonding: fix destructor bonding: remove bonding read/write semaphore bonding: initialize before registration bonding: bond_create always called with default parameters x_tables: Convert printk to pr_err netfilter: conntrack: optional reliable conntrack event delivery list_nulls: add hlist_nulls_add_head and hlist_nulls_del ...
Diffstat (limited to 'drivers/net/atl1c')
-rw-r--r--drivers/net/atl1c/atl1c_ethtool.c2
-rw-r--r--drivers/net/atl1c/atl1c_main.c73
2 files changed, 31 insertions, 44 deletions
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
index 45c5b7332cd3..e4afbd628c23 100644
--- a/drivers/net/atl1c/atl1c_ethtool.c
+++ b/drivers/net/atl1c/atl1c_ethtool.c
@@ -271,7 +271,7 @@ static int atl1c_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
271 struct atl1c_adapter *adapter = netdev_priv(netdev); 271 struct atl1c_adapter *adapter = netdev_priv(netdev);
272 272
273 if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE | 273 if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE |
274 WAKE_MCAST | WAKE_BCAST | WAKE_MCAST)) 274 WAKE_UCAST | WAKE_BCAST | WAKE_MCAST))
275 return -EOPNOTSUPP; 275 return -EOPNOTSUPP;
276 /* these settings will always override what we currently have */ 276 /* these settings will always override what we currently have */
277 adapter->wol = 0; 277 adapter->wol = 0;
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 83a12125b94e..cd547a205fb9 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -164,6 +164,24 @@ static inline void atl1c_irq_reset(struct atl1c_adapter *adapter)
164} 164}
165 165
166/* 166/*
167 * atl1c_wait_until_idle - wait up to AT_HW_MAX_IDLE_DELAY reads
168 * of the idle status register until the device is actually idle
169 */
170static u32 atl1c_wait_until_idle(struct atl1c_hw *hw)
171{
172 int timeout;
173 u32 data;
174
175 for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
176 AT_READ_REG(hw, REG_IDLE_STATUS, &data);
177 if ((data & IDLE_STATUS_MASK) == 0)
178 return 0;
179 msleep(1);
180 }
181 return data;
182}
183
184/*
167 * atl1c_phy_config - Timer Call-back 185 * atl1c_phy_config - Timer Call-back
168 * @data: pointer to netdev cast into an unsigned long 186 * @data: pointer to netdev cast into an unsigned long
169 */ 187 */
@@ -220,11 +238,11 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter)
220 /* link down */ 238 /* link down */
221 if (netif_carrier_ok(netdev)) { 239 if (netif_carrier_ok(netdev)) {
222 hw->hibernate = true; 240 hw->hibernate = true;
223 atl1c_set_aspm(hw, false);
224 if (atl1c_stop_mac(hw) != 0) 241 if (atl1c_stop_mac(hw) != 0)
225 if (netif_msg_hw(adapter)) 242 if (netif_msg_hw(adapter))
226 dev_warn(&pdev->dev, 243 dev_warn(&pdev->dev,
227 "stop mac failed\n"); 244 "stop mac failed\n");
245 atl1c_set_aspm(hw, false);
228 } 246 }
229 netif_carrier_off(netdev); 247 netif_carrier_off(netdev);
230 } else { 248 } else {
@@ -240,10 +258,10 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter)
240 adapter->link_duplex != duplex) { 258 adapter->link_duplex != duplex) {
241 adapter->link_speed = speed; 259 adapter->link_speed = speed;
242 adapter->link_duplex = duplex; 260 adapter->link_duplex = duplex;
261 atl1c_set_aspm(hw, true);
243 atl1c_enable_tx_ctrl(hw); 262 atl1c_enable_tx_ctrl(hw);
244 atl1c_enable_rx_ctrl(hw); 263 atl1c_enable_rx_ctrl(hw);
245 atl1c_setup_mac_ctrl(adapter); 264 atl1c_setup_mac_ctrl(adapter);
246 atl1c_set_aspm(hw, true);
247 if (netif_msg_link(adapter)) 265 if (netif_msg_link(adapter))
248 dev_info(&pdev->dev, 266 dev_info(&pdev->dev,
249 "%s: %s NIC Link is Up<%d Mbps %s>\n", 267 "%s: %s NIC Link is Up<%d Mbps %s>\n",
@@ -1106,7 +1124,6 @@ static void atl1c_configure_dma(struct atl1c_adapter *adapter)
1106static int atl1c_stop_mac(struct atl1c_hw *hw) 1124static int atl1c_stop_mac(struct atl1c_hw *hw)
1107{ 1125{
1108 u32 data; 1126 u32 data;
1109 int timeout;
1110 1127
1111 AT_READ_REG(hw, REG_RXQ_CTRL, &data); 1128 AT_READ_REG(hw, REG_RXQ_CTRL, &data);
1112 data &= ~(RXQ1_CTRL_EN | RXQ2_CTRL_EN | 1129 data &= ~(RXQ1_CTRL_EN | RXQ2_CTRL_EN |
@@ -1117,25 +1134,13 @@ static int atl1c_stop_mac(struct atl1c_hw *hw)
1117 data &= ~TXQ_CTRL_EN; 1134 data &= ~TXQ_CTRL_EN;
1118 AT_WRITE_REG(hw, REG_TWSI_CTRL, data); 1135 AT_WRITE_REG(hw, REG_TWSI_CTRL, data);
1119 1136
1120 for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) { 1137 atl1c_wait_until_idle(hw);
1121 AT_READ_REG(hw, REG_IDLE_STATUS, &data);
1122 if ((data & (IDLE_STATUS_RXQ_NO_IDLE |
1123 IDLE_STATUS_TXQ_NO_IDLE)) == 0)
1124 break;
1125 msleep(1);
1126 }
1127 1138
1128 AT_READ_REG(hw, REG_MAC_CTRL, &data); 1139 AT_READ_REG(hw, REG_MAC_CTRL, &data);
1129 data &= ~(MAC_CTRL_TX_EN | MAC_CTRL_RX_EN); 1140 data &= ~(MAC_CTRL_TX_EN | MAC_CTRL_RX_EN);
1130 AT_WRITE_REG(hw, REG_MAC_CTRL, data); 1141 AT_WRITE_REG(hw, REG_MAC_CTRL, data);
1131 1142
1132 for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) { 1143 return (int)atl1c_wait_until_idle(hw);
1133 AT_READ_REG(hw, REG_IDLE_STATUS, &data);
1134 if ((data & IDLE_STATUS_MASK) == 0)
1135 return 0;
1136 msleep(1);
1137 }
1138 return data;
1139} 1144}
1140 1145
1141static void atl1c_enable_rx_ctrl(struct atl1c_hw *hw) 1146static void atl1c_enable_rx_ctrl(struct atl1c_hw *hw)
@@ -1178,8 +1183,6 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
1178{ 1183{
1179 struct atl1c_adapter *adapter = (struct atl1c_adapter *)hw->adapter; 1184 struct atl1c_adapter *adapter = (struct atl1c_adapter *)hw->adapter;
1180 struct pci_dev *pdev = adapter->pdev; 1185 struct pci_dev *pdev = adapter->pdev;
1181 u32 idle_status_data = 0;
1182 int timeout = 0;
1183 int ret; 1186 int ret;
1184 1187
1185 AT_WRITE_REG(hw, REG_IMR, 0); 1188 AT_WRITE_REG(hw, REG_IMR, 0);
@@ -1198,15 +1201,10 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
1198 AT_WRITE_FLUSH(hw); 1201 AT_WRITE_FLUSH(hw);
1199 msleep(10); 1202 msleep(10);
1200 /* Wait at least 10ms for All module to be Idle */ 1203 /* Wait at least 10ms for All module to be Idle */
1201 for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) { 1204
1202 AT_READ_REG(hw, REG_IDLE_STATUS, &idle_status_data); 1205 if (atl1c_wait_until_idle(hw)) {
1203 if ((idle_status_data & IDLE_STATUS_MASK) == 0)
1204 break;
1205 msleep(1);
1206 }
1207 if (timeout >= AT_HW_MAX_IDLE_DELAY) {
1208 dev_err(&pdev->dev, 1206 dev_err(&pdev->dev,
1209 "MAC state machine cann't be idle since" 1207 "MAC state machine can't be idle since"
1210 " disabled for 10ms second\n"); 1208 " disabled for 10ms second\n");
1211 return -1; 1209 return -1;
1212 } 1210 }
@@ -1242,9 +1240,7 @@ static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
1242 1240
1243 AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data); 1241 AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data);
1244 1242
1245 pm_ctrl_data &= PM_CTRL_SERDES_PD_EX_L1; 1243 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 << 1244 pm_ctrl_data &= ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
1249 PM_CTRL_L1_ENTRY_TIMER_SHIFT); 1245 PM_CTRL_L1_ENTRY_TIMER_SHIFT);
1250 1246
@@ -1254,19 +1250,11 @@ static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
1254 pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN; 1250 pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN;
1255 pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1; 1251 pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1;
1256 1252
1257 if (hw->ctrl_flags & ATL1C_ASPM_L1_SUPPORT) { 1253 pm_ctrl_data |= PM_CTRL_SERDES_BUDS_RX_L1_EN;
1258 pm_ctrl_data |= AT_ASPM_L1_TIMER << 1254 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 { 1255 } else {
1256 pm_ctrl_data &= ~PM_CTRL_SERDES_BUDS_RX_L1_EN;
1257 pm_ctrl_data &= ~PM_CTRL_SERDES_L1_EN;
1270 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN; 1258 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
1271 pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN; 1259 pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN;
1272 1260
@@ -2123,7 +2111,6 @@ static int atl1c_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2123 atl1c_tx_map(adapter, skb, tpd, type); 2111 atl1c_tx_map(adapter, skb, tpd, type);
2124 atl1c_tx_queue(adapter, skb, tpd, type); 2112 atl1c_tx_queue(adapter, skb, tpd, type);
2125 2113
2126 netdev->trans_start = jiffies;
2127 spin_unlock_irqrestore(&adapter->tx_lock, flags); 2114 spin_unlock_irqrestore(&adapter->tx_lock, flags);
2128 return NETDEV_TX_OK; 2115 return NETDEV_TX_OK;
2129} 2116}