diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-08-24 15:23:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-26 18:29:15 -0400 |
commit | cb7e4b6e37144f5d131ee09296be3c21c41f28d8 (patch) | |
tree | 2344575b03a3ea33d086bef52eb8b09daa6c9d2c | |
parent | 940917226260d6e029f55742a34a7d7810983c75 (diff) |
netxen: remove unused code
Remove code for phy access on unreleased NX2031 based quad-gig board.
NX3031 based production quad-gig boards do not require direct phy
access by driver.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 13 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.h | 107 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 41 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_niu.c | 240 |
4 files changed, 11 insertions, 390 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 7a93f8275c9d..74ccef5a5c97 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1148,8 +1148,6 @@ struct netxen_adapter { | |||
1148 | struct netxen_recv_context recv_ctx; | 1148 | struct netxen_recv_context recv_ctx; |
1149 | struct nx_host_tx_ring *tx_ring; | 1149 | struct nx_host_tx_ring *tx_ring; |
1150 | 1150 | ||
1151 | int (*enable_phy_interrupts) (struct netxen_adapter *); | ||
1152 | int (*disable_phy_interrupts) (struct netxen_adapter *); | ||
1153 | int (*macaddr_set) (struct netxen_adapter *, u8 *); | 1151 | int (*macaddr_set) (struct netxen_adapter *, u8 *); |
1154 | int (*set_mtu) (struct netxen_adapter *, int); | 1152 | int (*set_mtu) (struct netxen_adapter *, int); |
1155 | int (*set_promisc) (struct netxen_adapter *, u32); | 1153 | int (*set_promisc) (struct netxen_adapter *, u32); |
@@ -1187,22 +1185,11 @@ struct netxen_adapter { | |||
1187 | const struct firmware *fw; | 1185 | const struct firmware *fw; |
1188 | }; | 1186 | }; |
1189 | 1187 | ||
1190 | /* Set promiscuous mode for a GbE interface */ | ||
1191 | int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, u32 mode); | ||
1192 | int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, | 1188 | int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, |
1193 | u32 mode); | 1189 | u32 mode); |
1194 | /* Generic enable for GbE ports. Will detect the speed of the link. */ | ||
1195 | int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port); | ||
1196 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port); | 1190 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port); |
1197 | |||
1198 | /* Disable a GbE interface */ | ||
1199 | int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter); | ||
1200 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter); | 1191 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter); |
1201 | 1192 | ||
1202 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter); | ||
1203 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter); | ||
1204 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter); | ||
1205 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter); | ||
1206 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, | 1193 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, |
1207 | __u32 * readval); | 1194 | __u32 * readval); |
1208 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, | 1195 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, |
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h index fc0638f2d6d0..98e4b95788b7 100644 --- a/drivers/net/netxen/netxen_nic_hw.h +++ b/drivers/net/netxen/netxen_nic_hw.h | |||
@@ -61,10 +61,6 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter); | |||
61 | * Bit 31: soft_reset => 1:reset the MAC and the SERDES, 0:no-op | 61 | * Bit 31: soft_reset => 1:reset the MAC and the SERDES, 0:no-op |
62 | */ | 62 | */ |
63 | 63 | ||
64 | #define netxen_gb_enable_tx(config_word) \ | ||
65 | ((config_word) |= 1 << 0) | ||
66 | #define netxen_gb_enable_rx(config_word) \ | ||
67 | ((config_word) |= 1 << 2) | ||
68 | #define netxen_gb_tx_flowctl(config_word) \ | 64 | #define netxen_gb_tx_flowctl(config_word) \ |
69 | ((config_word) |= 1 << 4) | 65 | ((config_word) |= 1 << 4) |
70 | #define netxen_gb_rx_flowctl(config_word) \ | 66 | #define netxen_gb_rx_flowctl(config_word) \ |
@@ -77,8 +73,6 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter); | |||
77 | ((config_word) |= 1 << 18) | 73 | ((config_word) |= 1 << 18) |
78 | #define netxen_gb_rx_reset_mac(config_word) \ | 74 | #define netxen_gb_rx_reset_mac(config_word) \ |
79 | ((config_word) |= 1 << 19) | 75 | ((config_word) |= 1 << 19) |
80 | #define netxen_gb_soft_reset(config_word) \ | ||
81 | ((config_word) |= 1 << 31) | ||
82 | 76 | ||
83 | #define netxen_gb_unset_tx_flowctl(config_word) \ | 77 | #define netxen_gb_unset_tx_flowctl(config_word) \ |
84 | ((config_word) &= ~(1 << 4)) | 78 | ((config_word) &= ~(1 << 4)) |
@@ -240,7 +234,6 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter); | |||
240 | * Bits 14-15 : speed => 0:10Mb/s, 1:100Mb/s, 2:1000Mb/s, 3:rsvd | 234 | * Bits 14-15 : speed => 0:10Mb/s, 1:100Mb/s, 2:1000Mb/s, 3:rsvd |
241 | */ | 235 | */ |
242 | 236 | ||
243 | #define netxen_get_phy_cablelen(config_word) (((config_word) >> 7) & 0x07) | ||
244 | #define netxen_get_phy_speed(config_word) (((config_word) >> 14) & 0x03) | 237 | #define netxen_get_phy_speed(config_word) (((config_word) >> 14) & 0x03) |
245 | 238 | ||
246 | #define netxen_set_phy_speed(config_word, val) \ | 239 | #define netxen_set_phy_speed(config_word, val) \ |
@@ -250,85 +243,12 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter); | |||
250 | #define netxen_clear_phy_duplex(config_word) \ | 243 | #define netxen_clear_phy_duplex(config_word) \ |
251 | ((config_word) &= ~(1 << 13)) | 244 | ((config_word) &= ~(1 << 13)) |
252 | 245 | ||
253 | #define netxen_get_phy_jabber(config_word) \ | ||
254 | _netxen_crb_get_bit(config_word, 0) | ||
255 | #define netxen_get_phy_polarity(config_word) \ | ||
256 | _netxen_crb_get_bit(config_word, 1) | ||
257 | #define netxen_get_phy_recvpause(config_word) \ | ||
258 | _netxen_crb_get_bit(config_word, 2) | ||
259 | #define netxen_get_phy_xmitpause(config_word) \ | ||
260 | _netxen_crb_get_bit(config_word, 3) | ||
261 | #define netxen_get_phy_energydetect(config_word) \ | ||
262 | _netxen_crb_get_bit(config_word, 4) | ||
263 | #define netxen_get_phy_downshift(config_word) \ | ||
264 | _netxen_crb_get_bit(config_word, 5) | ||
265 | #define netxen_get_phy_crossover(config_word) \ | ||
266 | _netxen_crb_get_bit(config_word, 6) | ||
267 | #define netxen_get_phy_link(config_word) \ | 246 | #define netxen_get_phy_link(config_word) \ |
268 | _netxen_crb_get_bit(config_word, 10) | 247 | _netxen_crb_get_bit(config_word, 10) |
269 | #define netxen_get_phy_resolved(config_word) \ | ||
270 | _netxen_crb_get_bit(config_word, 11) | ||
271 | #define netxen_get_phy_pagercvd(config_word) \ | ||
272 | _netxen_crb_get_bit(config_word, 12) | ||
273 | #define netxen_get_phy_duplex(config_word) \ | 248 | #define netxen_get_phy_duplex(config_word) \ |
274 | _netxen_crb_get_bit(config_word, 13) | 249 | _netxen_crb_get_bit(config_word, 13) |
275 | 250 | ||
276 | /* | 251 | /* |
277 | * Interrupt Register definition | ||
278 | * This definition applies to registers 18 and 19 (int enable and int status). | ||
279 | * Bit 0 : jabber | ||
280 | * Bit 1 : polarity_changed | ||
281 | * Bit 4 : energy_detect | ||
282 | * Bit 5 : downshift | ||
283 | * Bit 6 : mdi_xover_changed | ||
284 | * Bit 7 : fifo_over_underflow | ||
285 | * Bit 8 : false_carrier | ||
286 | * Bit 9 : symbol_error | ||
287 | * Bit 10: link_status_changed | ||
288 | * Bit 11: autoneg_completed | ||
289 | * Bit 12: page_received | ||
290 | * Bit 13: duplex_changed | ||
291 | * Bit 14: speed_changed | ||
292 | * Bit 15: autoneg_error | ||
293 | */ | ||
294 | |||
295 | #define netxen_get_phy_int_jabber(config_word) \ | ||
296 | _netxen_crb_get_bit(config_word, 0) | ||
297 | #define netxen_get_phy_int_polarity_changed(config_word) \ | ||
298 | _netxen_crb_get_bit(config_word, 1) | ||
299 | #define netxen_get_phy_int_energy_detect(config_word) \ | ||
300 | _netxen_crb_get_bit(config_word, 4) | ||
301 | #define netxen_get_phy_int_downshift(config_word) \ | ||
302 | _netxen_crb_get_bit(config_word, 5) | ||
303 | #define netxen_get_phy_int_mdi_xover_changed(config_word) \ | ||
304 | _netxen_crb_get_bit(config_word, 6) | ||
305 | #define netxen_get_phy_int_fifo_over_underflow(config_word) \ | ||
306 | _netxen_crb_get_bit(config_word, 7) | ||
307 | #define netxen_get_phy_int_false_carrier(config_word) \ | ||
308 | _netxen_crb_get_bit(config_word, 8) | ||
309 | #define netxen_get_phy_int_symbol_error(config_word) \ | ||
310 | _netxen_crb_get_bit(config_word, 9) | ||
311 | #define netxen_get_phy_int_link_status_changed(config_word) \ | ||
312 | _netxen_crb_get_bit(config_word, 10) | ||
313 | #define netxen_get_phy_int_autoneg_completed(config_word) \ | ||
314 | _netxen_crb_get_bit(config_word, 11) | ||
315 | #define netxen_get_phy_int_page_received(config_word) \ | ||
316 | _netxen_crb_get_bit(config_word, 12) | ||
317 | #define netxen_get_phy_int_duplex_changed(config_word) \ | ||
318 | _netxen_crb_get_bit(config_word, 13) | ||
319 | #define netxen_get_phy_int_speed_changed(config_word) \ | ||
320 | _netxen_crb_get_bit(config_word, 14) | ||
321 | #define netxen_get_phy_int_autoneg_error(config_word) \ | ||
322 | _netxen_crb_get_bit(config_word, 15) | ||
323 | |||
324 | #define netxen_set_phy_int_link_status_changed(config_word) \ | ||
325 | ((config_word) |= 1 << 10) | ||
326 | #define netxen_set_phy_int_autoneg_completed(config_word) \ | ||
327 | ((config_word) |= 1 << 11) | ||
328 | #define netxen_set_phy_int_speed_changed(config_word) \ | ||
329 | ((config_word) |= 1 << 14) | ||
330 | |||
331 | /* | ||
332 | * NIU Mode Register. | 252 | * NIU Mode Register. |
333 | * Bit 0 : enable FibreChannel | 253 | * Bit 0 : enable FibreChannel |
334 | * Bit 1 : enable 10/100/1000 Ethernet | 254 | * Bit 1 : enable 10/100/1000 Ethernet |
@@ -343,33 +263,6 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter); | |||
343 | #define NETXEN_NIU_ALLMULTI_MODE 2 | 263 | #define NETXEN_NIU_ALLMULTI_MODE 2 |
344 | 264 | ||
345 | /* | 265 | /* |
346 | * NIU GB Drop CRC Register | ||
347 | * | ||
348 | * Bit 0 : drop_gb0 => 1:drop pkts with bad CRCs, 0:pass them on | ||
349 | * Bit 1 : drop_gb1 => 1:drop pkts with bad CRCs, 0:pass them on | ||
350 | * Bit 2 : drop_gb2 => 1:drop pkts with bad CRCs, 0:pass them on | ||
351 | * Bit 3 : drop_gb3 => 1:drop pkts with bad CRCs, 0:pass them on | ||
352 | */ | ||
353 | |||
354 | #define netxen_set_gb_drop_gb0(config_word) \ | ||
355 | ((config_word) |= 1 << 0) | ||
356 | #define netxen_set_gb_drop_gb1(config_word) \ | ||
357 | ((config_word) |= 1 << 1) | ||
358 | #define netxen_set_gb_drop_gb2(config_word) \ | ||
359 | ((config_word) |= 1 << 2) | ||
360 | #define netxen_set_gb_drop_gb3(config_word) \ | ||
361 | ((config_word) |= 1 << 3) | ||
362 | |||
363 | #define netxen_clear_gb_drop_gb0(config_word) \ | ||
364 | ((config_word) &= ~(1 << 0)) | ||
365 | #define netxen_clear_gb_drop_gb1(config_word) \ | ||
366 | ((config_word) &= ~(1 << 1)) | ||
367 | #define netxen_clear_gb_drop_gb2(config_word) \ | ||
368 | ((config_word) &= ~(1 << 2)) | ||
369 | #define netxen_clear_gb_drop_gb3(config_word) \ | ||
370 | ((config_word) &= ~(1 << 3)) | ||
371 | |||
372 | /* | ||
373 | * NIU XG MAC Config Register | 266 | * NIU XG MAC Config Register |
374 | * | 267 | * |
375 | * Bit 0 : tx_enable => 1:enable frame xmit, 0:disable | 268 | * Bit 0 : tx_enable => 1:enable frame xmit, 0:disable |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 474c568adccf..f5807dae09e9 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -321,44 +321,25 @@ err_out: | |||
321 | 321 | ||
322 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) | 322 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) |
323 | { | 323 | { |
324 | adapter->macaddr_set = netxen_p2_nic_set_mac_addr; | 324 | adapter->init_port = netxen_niu_xg_init_port; |
325 | adapter->set_multi = netxen_p2_nic_set_multi; | 325 | adapter->stop_port = netxen_niu_disable_xg_port; |
326 | |||
327 | switch (adapter->ahw.port_type) { | ||
328 | case NETXEN_NIC_GBE: | ||
329 | adapter->enable_phy_interrupts = | ||
330 | netxen_niu_gbe_enable_phy_interrupts; | ||
331 | adapter->disable_phy_interrupts = | ||
332 | netxen_niu_gbe_disable_phy_interrupts; | ||
333 | adapter->set_mtu = netxen_nic_set_mtu_gb; | ||
334 | adapter->set_promisc = netxen_niu_set_promiscuous_mode; | ||
335 | adapter->phy_read = netxen_niu_gbe_phy_read; | ||
336 | adapter->phy_write = netxen_niu_gbe_phy_write; | ||
337 | adapter->init_port = netxen_niu_gbe_init_port; | ||
338 | adapter->stop_port = netxen_niu_disable_gbe_port; | ||
339 | break; | ||
340 | 326 | ||
341 | case NETXEN_NIC_XGBE: | 327 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
342 | adapter->enable_phy_interrupts = | 328 | adapter->macaddr_set = netxen_p2_nic_set_mac_addr; |
343 | netxen_niu_xgbe_enable_phy_interrupts; | 329 | adapter->set_multi = netxen_p2_nic_set_multi; |
344 | adapter->disable_phy_interrupts = | ||
345 | netxen_niu_xgbe_disable_phy_interrupts; | ||
346 | adapter->set_mtu = netxen_nic_set_mtu_xgb; | 330 | adapter->set_mtu = netxen_nic_set_mtu_xgb; |
347 | adapter->init_port = netxen_niu_xg_init_port; | ||
348 | adapter->set_promisc = netxen_niu_xg_set_promiscuous_mode; | 331 | adapter->set_promisc = netxen_niu_xg_set_promiscuous_mode; |
349 | adapter->stop_port = netxen_niu_disable_xg_port; | 332 | } else { |
350 | break; | ||
351 | |||
352 | default: | ||
353 | break; | ||
354 | } | ||
355 | |||
356 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | ||
357 | adapter->set_mtu = nx_fw_cmd_set_mtu; | 333 | adapter->set_mtu = nx_fw_cmd_set_mtu; |
358 | adapter->set_promisc = netxen_p3_nic_set_promisc; | 334 | adapter->set_promisc = netxen_p3_nic_set_promisc; |
359 | adapter->macaddr_set = netxen_p3_nic_set_mac_addr; | 335 | adapter->macaddr_set = netxen_p3_nic_set_mac_addr; |
360 | adapter->set_multi = netxen_p3_nic_set_multi; | 336 | adapter->set_multi = netxen_p3_nic_set_multi; |
361 | } | 337 | } |
338 | |||
339 | if (adapter->ahw.port_type == NETXEN_NIC_GBE) { | ||
340 | adapter->phy_read = netxen_niu_gbe_phy_read; | ||
341 | adapter->phy_write = netxen_niu_gbe_phy_write; | ||
342 | } | ||
362 | } | 343 | } |
363 | 344 | ||
364 | /* | 345 | /* |
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index 5941c79be723..8b7cd9e1851a 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -30,11 +30,6 @@ | |||
30 | 30 | ||
31 | #include "netxen_nic.h" | 31 | #include "netxen_nic.h" |
32 | 32 | ||
33 | #define NETXEN_GB_MAC_SOFT_RESET 0x80000000 | ||
34 | #define NETXEN_GB_MAC_RESET_PROT_BLK 0x000F0000 | ||
35 | #define NETXEN_GB_MAC_ENABLE_TX_RX 0x00000005 | ||
36 | #define NETXEN_GB_MAC_PAUSED_FRMS 0x00000020 | ||
37 | |||
38 | static long phy_lock_timeout = 100000000; | 33 | static long phy_lock_timeout = 100000000; |
39 | 34 | ||
40 | static int phy_lock(struct netxen_adapter *adapter) | 35 | static int phy_lock(struct netxen_adapter *adapter) |
@@ -227,171 +222,6 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg, | |||
227 | return result; | 222 | return result; |
228 | } | 223 | } |
229 | 224 | ||
230 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter) | ||
231 | { | ||
232 | NXWR32(adapter, NETXEN_NIU_INT_MASK, 0x3f); | ||
233 | return 0; | ||
234 | } | ||
235 | |||
236 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter) | ||
237 | { | ||
238 | int result = 0; | ||
239 | __u32 enable = 0; | ||
240 | netxen_set_phy_int_link_status_changed(enable); | ||
241 | netxen_set_phy_int_autoneg_completed(enable); | ||
242 | netxen_set_phy_int_speed_changed(enable); | ||
243 | |||
244 | if (0 != | ||
245 | netxen_niu_gbe_phy_write(adapter, | ||
246 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, | ||
247 | enable)) | ||
248 | result = -EIO; | ||
249 | |||
250 | return result; | ||
251 | } | ||
252 | |||
253 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter) | ||
254 | { | ||
255 | NXWR32(adapter, NETXEN_NIU_INT_MASK, 0x7f); | ||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter) | ||
260 | { | ||
261 | int result = 0; | ||
262 | if (0 != | ||
263 | netxen_niu_gbe_phy_write(adapter, | ||
264 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, 0)) | ||
265 | result = -EIO; | ||
266 | |||
267 | return result; | ||
268 | } | ||
269 | |||
270 | static int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter) | ||
271 | { | ||
272 | int result = 0; | ||
273 | if (0 != | ||
274 | netxen_niu_gbe_phy_write(adapter, | ||
275 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | ||
276 | -EIO)) | ||
277 | result = -EIO; | ||
278 | |||
279 | return result; | ||
280 | } | ||
281 | |||
282 | /* | ||
283 | * netxen_niu_gbe_set_mii_mode- Set 10/100 Mbit Mode for GbE MAC | ||
284 | * | ||
285 | */ | ||
286 | static void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, | ||
287 | int port, long enable) | ||
288 | { | ||
289 | NXWR32(adapter, NETXEN_NIU_MODE, 0x2); | ||
290 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), 0x80000000); | ||
291 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), 0x0000f0025); | ||
292 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_1(port), 0xf1ff); | ||
293 | NXWR32(adapter, NETXEN_NIU_GB0_GMII_MODE + (port << 3), 0); | ||
294 | NXWR32(adapter, NETXEN_NIU_GB0_MII_MODE + (port << 3), 1); | ||
295 | NXWR32(adapter, (NETXEN_NIU_GB0_HALF_DUPLEX + port * 4), 0); | ||
296 | NXWR32(adapter, NETXEN_NIU_GB_MII_MGMT_CONFIG(port), 0x7); | ||
297 | |||
298 | if (enable) { | ||
299 | /* | ||
300 | * Do NOT enable flow control until a suitable solution for | ||
301 | * shutting down pause frames is found. | ||
302 | */ | ||
303 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), 0x5); | ||
304 | } | ||
305 | |||
306 | if (netxen_niu_gbe_enable_phy_interrupts(adapter)) | ||
307 | printk(KERN_ERR "ERROR enabling PHY interrupts\n"); | ||
308 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) | ||
309 | printk(KERN_ERR "ERROR clearing PHY interrupts\n"); | ||
310 | } | ||
311 | |||
312 | /* | ||
313 | * netxen_niu_gbe_set_gmii_mode- Set GbE Mode for GbE MAC | ||
314 | */ | ||
315 | static void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, | ||
316 | int port, long enable) | ||
317 | { | ||
318 | NXWR32(adapter, NETXEN_NIU_MODE, 0x2); | ||
319 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), 0x80000000); | ||
320 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), 0x0000f0025); | ||
321 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_1(port), 0xf2ff); | ||
322 | NXWR32(adapter, NETXEN_NIU_GB0_MII_MODE + (port << 3), 0); | ||
323 | NXWR32(adapter, NETXEN_NIU_GB0_GMII_MODE + (port << 3), 1); | ||
324 | NXWR32(adapter, (NETXEN_NIU_GB0_HALF_DUPLEX + port * 4), 0); | ||
325 | NXWR32(adapter, NETXEN_NIU_GB_MII_MGMT_CONFIG(port), 0x7); | ||
326 | |||
327 | if (enable) { | ||
328 | /* | ||
329 | * Do NOT enable flow control until a suitable solution for | ||
330 | * shutting down pause frames is found. | ||
331 | */ | ||
332 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), 0x5); | ||
333 | } | ||
334 | |||
335 | if (netxen_niu_gbe_enable_phy_interrupts(adapter)) | ||
336 | printk(KERN_ERR "ERROR enabling PHY interrupts\n"); | ||
337 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) | ||
338 | printk(KERN_ERR "ERROR clearing PHY interrupts\n"); | ||
339 | } | ||
340 | |||
341 | int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | ||
342 | { | ||
343 | int result = 0; | ||
344 | __u32 status; | ||
345 | |||
346 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
347 | return 0; | ||
348 | |||
349 | if (adapter->disable_phy_interrupts) | ||
350 | adapter->disable_phy_interrupts(adapter); | ||
351 | mdelay(2); | ||
352 | |||
353 | if (0 == netxen_niu_gbe_phy_read(adapter, | ||
354 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, &status)) { | ||
355 | if (netxen_get_phy_link(status)) { | ||
356 | if (netxen_get_phy_speed(status) == 2) { | ||
357 | netxen_niu_gbe_set_gmii_mode(adapter, port, 1); | ||
358 | } else if ((netxen_get_phy_speed(status) == 1) | ||
359 | || (netxen_get_phy_speed(status) == 0)) { | ||
360 | netxen_niu_gbe_set_mii_mode(adapter, port, 1); | ||
361 | } else { | ||
362 | result = -1; | ||
363 | } | ||
364 | |||
365 | } else { | ||
366 | /* | ||
367 | * We don't have link. Cable must be unconnected. | ||
368 | * Enable phy interrupts so we take action when | ||
369 | * plugged in. | ||
370 | */ | ||
371 | |||
372 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), | ||
373 | NETXEN_GB_MAC_SOFT_RESET); | ||
374 | NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), | ||
375 | NETXEN_GB_MAC_RESET_PROT_BLK | | ||
376 | NETXEN_GB_MAC_ENABLE_TX_RX | | ||
377 | NETXEN_GB_MAC_PAUSED_FRMS); | ||
378 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) | ||
379 | printk(KERN_ERR | ||
380 | "ERROR clearing PHY interrupts\n"); | ||
381 | if (netxen_niu_gbe_enable_phy_interrupts(adapter)) | ||
382 | printk(KERN_ERR | ||
383 | "ERROR enabling PHY interrupts\n"); | ||
384 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) | ||
385 | printk(KERN_ERR | ||
386 | "ERROR clearing PHY interrupts\n"); | ||
387 | result = -1; | ||
388 | } | ||
389 | } else { | ||
390 | result = -EIO; | ||
391 | } | ||
392 | return result; | ||
393 | } | ||
394 | |||
395 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | 225 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) |
396 | { | 226 | { |
397 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 227 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
@@ -402,24 +232,6 @@ int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | |||
402 | return 0; | 232 | return 0; |
403 | } | 233 | } |
404 | 234 | ||
405 | /* Disable a GbE interface */ | ||
406 | int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter) | ||
407 | { | ||
408 | __u32 mac_cfg0; | ||
409 | u32 port = adapter->physical_port; | ||
410 | |||
411 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
412 | return 0; | ||
413 | |||
414 | if (port > NETXEN_NIU_MAX_GBE_PORTS) | ||
415 | return -EINVAL; | ||
416 | mac_cfg0 = 0; | ||
417 | netxen_gb_soft_reset(mac_cfg0); | ||
418 | if (NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), mac_cfg0)) | ||
419 | return -EIO; | ||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | /* Disable an XG interface */ | 235 | /* Disable an XG interface */ |
424 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | 236 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) |
425 | { | 237 | { |
@@ -439,58 +251,6 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | |||
439 | return 0; | 251 | return 0; |
440 | } | 252 | } |
441 | 253 | ||
442 | /* Set promiscuous mode for a GbE interface */ | ||
443 | int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, | ||
444 | u32 mode) | ||
445 | { | ||
446 | __u32 reg; | ||
447 | u32 port = adapter->physical_port; | ||
448 | |||
449 | if (port > NETXEN_NIU_MAX_GBE_PORTS) | ||
450 | return -EINVAL; | ||
451 | |||
452 | /* save previous contents */ | ||
453 | reg = NXRD32(adapter, NETXEN_NIU_GB_DROP_WRONGADDR); | ||
454 | if (mode == NETXEN_NIU_PROMISC_MODE) { | ||
455 | switch (port) { | ||
456 | case 0: | ||
457 | netxen_clear_gb_drop_gb0(reg); | ||
458 | break; | ||
459 | case 1: | ||
460 | netxen_clear_gb_drop_gb1(reg); | ||
461 | break; | ||
462 | case 2: | ||
463 | netxen_clear_gb_drop_gb2(reg); | ||
464 | break; | ||
465 | case 3: | ||
466 | netxen_clear_gb_drop_gb3(reg); | ||
467 | break; | ||
468 | default: | ||
469 | return -EIO; | ||
470 | } | ||
471 | } else { | ||
472 | switch (port) { | ||
473 | case 0: | ||
474 | netxen_set_gb_drop_gb0(reg); | ||
475 | break; | ||
476 | case 1: | ||
477 | netxen_set_gb_drop_gb1(reg); | ||
478 | break; | ||
479 | case 2: | ||
480 | netxen_set_gb_drop_gb2(reg); | ||
481 | break; | ||
482 | case 3: | ||
483 | netxen_set_gb_drop_gb3(reg); | ||
484 | break; | ||
485 | default: | ||
486 | return -EIO; | ||
487 | } | ||
488 | } | ||
489 | if (NXWR32(adapter, NETXEN_NIU_GB_DROP_WRONGADDR, reg)) | ||
490 | return -EIO; | ||
491 | return 0; | ||
492 | } | ||
493 | |||
494 | int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, | 254 | int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, |
495 | u32 mode) | 255 | u32 mode) |
496 | { | 256 | { |