diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-08-24 15:23:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-26 18:29:19 -0400 |
commit | 3ad4467ca43e7a2556e26e4e304faf3385048834 (patch) | |
tree | 5b3e263674604ec0f15211f3de10d3cc65e93f63 /drivers/net/netxen/netxen_nic_hw.c | |
parent | c9517e5893db03ca8bd32b8783b39af58176947c (diff) |
netxen: remove netxen_nic_niu.c
Consolidate all MAC/PHY access functions into netxen_nic_hw.c
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index cbfe44c8a7fd..1a8ad62e12ee 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -348,6 +348,35 @@ netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem) | |||
348 | val = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem))); | 348 | val = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem))); |
349 | } | 349 | } |
350 | 350 | ||
351 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | ||
352 | { | ||
353 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | ||
354 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1+(0x10000*port), 0x1447); | ||
355 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0+(0x10000*port), 0x5); | ||
356 | } | ||
357 | |||
358 | return 0; | ||
359 | } | ||
360 | |||
361 | /* Disable an XG interface */ | ||
362 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | ||
363 | { | ||
364 | __u32 mac_cfg; | ||
365 | u32 port = adapter->physical_port; | ||
366 | |||
367 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
368 | return 0; | ||
369 | |||
370 | if (port > NETXEN_NIU_MAX_XG_PORTS) | ||
371 | return -EINVAL; | ||
372 | |||
373 | mac_cfg = 0; | ||
374 | if (NXWR32(adapter, | ||
375 | NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg)) | ||
376 | return -EIO; | ||
377 | return 0; | ||
378 | } | ||
379 | |||
351 | #define NETXEN_UNICAST_ADDR(port, index) \ | 380 | #define NETXEN_UNICAST_ADDR(port, index) \ |
352 | (NETXEN_UNICAST_ADDR_BASE+(port*32)+(index*8)) | 381 | (NETXEN_UNICAST_ADDR_BASE+(port*32)+(index*8)) |
353 | #define NETXEN_MCAST_ADDR(port, index) \ | 382 | #define NETXEN_MCAST_ADDR(port, index) \ |
@@ -357,6 +386,56 @@ netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem) | |||
357 | #define MAC_LO(addr) \ | 386 | #define MAC_LO(addr) \ |
358 | ((addr[5] << 16) | (addr[4] << 8) | (addr[3])) | 387 | ((addr[5] << 16) | (addr[4] << 8) | (addr[3])) |
359 | 388 | ||
389 | int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | ||
390 | { | ||
391 | __u32 reg; | ||
392 | u32 port = adapter->physical_port; | ||
393 | |||
394 | if (port > NETXEN_NIU_MAX_XG_PORTS) | ||
395 | return -EINVAL; | ||
396 | |||
397 | reg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port)); | ||
398 | if (mode == NETXEN_NIU_PROMISC_MODE) | ||
399 | reg = (reg | 0x2000UL); | ||
400 | else | ||
401 | reg = (reg & ~0x2000UL); | ||
402 | |||
403 | if (mode == NETXEN_NIU_ALLMULTI_MODE) | ||
404 | reg = (reg | 0x1000UL); | ||
405 | else | ||
406 | reg = (reg & ~0x1000UL); | ||
407 | |||
408 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg); | ||
409 | |||
410 | return 0; | ||
411 | } | ||
412 | |||
413 | int netxen_p2_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr) | ||
414 | { | ||
415 | u32 mac_hi, mac_lo; | ||
416 | u32 reg_hi, reg_lo; | ||
417 | |||
418 | u8 phy = adapter->physical_port; | ||
419 | |||
420 | if (phy >= NETXEN_NIU_MAX_XG_PORTS) | ||
421 | return -EINVAL; | ||
422 | |||
423 | mac_lo = ((u32)addr[0] << 16) | ((u32)addr[1] << 24); | ||
424 | mac_hi = addr[2] | ((u32)addr[3] << 8) | | ||
425 | ((u32)addr[4] << 16) | ((u32)addr[5] << 24); | ||
426 | |||
427 | reg_lo = NETXEN_NIU_XGE_STATION_ADDR_0_1 + (0x10000 * phy); | ||
428 | reg_hi = NETXEN_NIU_XGE_STATION_ADDR_0_HI + (0x10000 * phy); | ||
429 | |||
430 | /* write twice to flush */ | ||
431 | if (NXWR32(adapter, reg_lo, mac_lo) || NXWR32(adapter, reg_hi, mac_hi)) | ||
432 | return -EIO; | ||
433 | if (NXWR32(adapter, reg_lo, mac_lo) || NXWR32(adapter, reg_hi, mac_hi)) | ||
434 | return -EIO; | ||
435 | |||
436 | return 0; | ||
437 | } | ||
438 | |||
360 | static int | 439 | static int |
361 | netxen_nic_enable_mcast_filter(struct netxen_adapter *adapter) | 440 | netxen_nic_enable_mcast_filter(struct netxen_adapter *adapter) |
362 | { | 441 | { |