diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2008-07-21 22:44:04 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-22 17:51:53 -0400 |
commit | 2956640d4aaaecd42bd8ba800cc8c33bfe206b7e (patch) | |
tree | 78c0442fd1a382f5f01489d4f268c5876d243b95 /drivers/net/netxen/netxen_nic_hw.c | |
parent | 3ce06a320f8d5a3f16960e63021cc372283efffb (diff) |
netxen: pci probe and firmware init changes
Add initialization code in pci probe for new chip and retain
compatibility with old revisions.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 71 |
1 files changed, 23 insertions, 48 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index defbeeac5dbe..fde8c6f1c9f5 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -359,8 +359,6 @@ static u64 ctx_addr_sig_regs[][3] = { | |||
359 | #define ADDR_IN_RANGE(addr, low, high) \ | 359 | #define ADDR_IN_RANGE(addr, low, high) \ |
360 | (((addr) <= (high)) && ((addr) >= (low))) | 360 | (((addr) <= (high)) && ((addr) >= (low))) |
361 | 361 | ||
362 | #define NETXEN_FLASH_BASE (NETXEN_BOOTLD_START) | ||
363 | #define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE) | ||
364 | #define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE | 362 | #define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE |
365 | #define NETXEN_MIN_MTU 64 | 363 | #define NETXEN_MIN_MTU 64 |
366 | #define NETXEN_ETH_FCS_SIZE 4 | 364 | #define NETXEN_ETH_FCS_SIZE 4 |
@@ -381,8 +379,6 @@ static u64 ctx_addr_sig_regs[][3] = { | |||
381 | 379 | ||
382 | #define NETXEN_NIC_WINDOW_MARGIN 0x100000 | 380 | #define NETXEN_NIC_WINDOW_MARGIN 0x100000 |
383 | 381 | ||
384 | void netxen_free_hw_resources(struct netxen_adapter *adapter); | ||
385 | |||
386 | int netxen_nic_set_mac(struct net_device *netdev, void *p) | 382 | int netxen_nic_set_mac(struct net_device *netdev, void *p) |
387 | { | 383 | { |
388 | struct netxen_adapter *adapter = netdev_priv(netdev); | 384 | struct netxen_adapter *adapter = netdev_priv(netdev); |
@@ -564,41 +560,22 @@ int netxen_nic_change_mtu(struct net_device *netdev, int mtu) | |||
564 | * check if the firmware has been downloaded and ready to run and | 560 | * check if the firmware has been downloaded and ready to run and |
565 | * setup the address for the descriptors in the adapter | 561 | * setup the address for the descriptors in the adapter |
566 | */ | 562 | */ |
567 | int netxen_nic_hw_resources(struct netxen_adapter *adapter) | 563 | int netxen_alloc_hw_resources(struct netxen_adapter *adapter) |
568 | { | 564 | { |
569 | struct netxen_hardware_context *hw = &adapter->ahw; | 565 | struct netxen_hardware_context *hw = &adapter->ahw; |
570 | u32 state = 0; | 566 | u32 state = 0; |
571 | void *addr; | 567 | void *addr; |
572 | int loops = 0, err = 0; | 568 | int err = 0; |
573 | int ctx, ring; | 569 | int ctx, ring; |
574 | struct netxen_recv_context *recv_ctx; | 570 | struct netxen_recv_context *recv_ctx; |
575 | struct netxen_rcv_desc_ctx *rcv_desc; | 571 | struct netxen_rcv_desc_ctx *rcv_desc; |
576 | int func_id = adapter->portnum; | 572 | int func_id = adapter->portnum; |
577 | 573 | ||
578 | DPRINTK(INFO, "crb_base: %lx %x", NETXEN_PCI_CRBSPACE, | 574 | err = netxen_receive_peg_ready(adapter); |
579 | PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE)); | 575 | if (err) { |
580 | DPRINTK(INFO, "cam base: %lx %x", NETXEN_CRB_CAM, | 576 | printk(KERN_ERR "Rcv Peg initialization not complete:%x.\n", |
581 | pci_base_offset(adapter, NETXEN_CRB_CAM)); | 577 | state); |
582 | DPRINTK(INFO, "cam RAM: %lx %x", NETXEN_CAM_RAM_BASE, | 578 | return err; |
583 | pci_base_offset(adapter, NETXEN_CAM_RAM_BASE)); | ||
584 | |||
585 | |||
586 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | ||
587 | loops = 0; | ||
588 | state = 0; | ||
589 | do { | ||
590 | /* Window 1 call */ | ||
591 | state = adapter->pci_read_normalize(adapter, | ||
592 | CRB_RCVPEG_STATE); | ||
593 | msleep(1); | ||
594 | loops++; | ||
595 | } while (state != PHAN_PEG_RCV_INITIALIZED && loops < 20); | ||
596 | if (loops >= 20) { | ||
597 | printk(KERN_ERR "Rcv Peg initialization not complete:" | ||
598 | "%x.\n", state); | ||
599 | err = -EIO; | ||
600 | return err; | ||
601 | } | ||
602 | } | 579 | } |
603 | adapter->intr_scheme = adapter->pci_read_normalize(adapter, | 580 | adapter->intr_scheme = adapter->pci_read_normalize(adapter, |
604 | CRB_NIC_CAPABILITIES_FW); | 581 | CRB_NIC_CAPABILITIES_FW); |
@@ -992,10 +969,12 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
992 | { | 969 | { |
993 | int i; | 970 | int i; |
994 | u32 data, size = 0; | 971 | u32 data, size = 0; |
995 | u32 flashaddr = NETXEN_FLASH_BASE, memaddr = NETXEN_PHANTOM_MEM_BASE; | 972 | u32 flashaddr = NETXEN_BOOTLD_START, memaddr = NETXEN_BOOTLD_START; |
973 | |||
974 | size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; | ||
996 | 975 | ||
997 | size = NETXEN_FIRMWARE_LEN; | 976 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) |
998 | adapter->pci_write_normalize(adapter, | 977 | adapter->pci_write_normalize(adapter, |
999 | NETXEN_ROMUSB_GLB_CAS_RST, 1); | 978 | NETXEN_ROMUSB_GLB_CAS_RST, 1); |
1000 | 979 | ||
1001 | for (i = 0; i < size; i++) { | 980 | for (i = 0; i < size; i++) { |
@@ -1007,12 +986,17 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
1007 | memaddr += 4; | 986 | memaddr += 4; |
1008 | cond_resched(); | 987 | cond_resched(); |
1009 | } | 988 | } |
1010 | udelay(100); | 989 | msleep(1); |
1011 | /* make sure Casper is powered on */ | 990 | |
1012 | adapter->pci_write_normalize(adapter, | 991 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) |
992 | adapter->pci_write_normalize(adapter, | ||
993 | NETXEN_ROMUSB_GLB_SW_RESET, 0x80001d); | ||
994 | else { | ||
995 | adapter->pci_write_normalize(adapter, | ||
1013 | NETXEN_ROMUSB_GLB_CHIP_CLK_CTRL, 0x3fff); | 996 | NETXEN_ROMUSB_GLB_CHIP_CLK_CTRL, 0x3fff); |
1014 | adapter->pci_write_normalize(adapter, | 997 | adapter->pci_write_normalize(adapter, |
1015 | NETXEN_ROMUSB_GLB_CAS_RST, 0); | 998 | NETXEN_ROMUSB_GLB_CAS_RST, 0); |
999 | } | ||
1016 | 1000 | ||
1017 | return 0; | 1001 | return 0; |
1018 | } | 1002 | } |
@@ -2241,6 +2225,8 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) | |||
2241 | adapter->hw_read_wx(adapter, NETXEN_FW_VERSION_MINOR, &fw_minor, 4); | 2225 | adapter->hw_read_wx(adapter, NETXEN_FW_VERSION_MINOR, &fw_minor, 4); |
2242 | adapter->hw_read_wx(adapter, NETXEN_FW_VERSION_SUB, &fw_build, 4); | 2226 | adapter->hw_read_wx(adapter, NETXEN_FW_VERSION_SUB, &fw_build, 4); |
2243 | 2227 | ||
2228 | adapter->fw_major = fw_major; | ||
2229 | |||
2244 | if (adapter->portnum == 0) { | 2230 | if (adapter->portnum == 0) { |
2245 | get_brd_name_by_type(board_info->board_type, brd_name); | 2231 | get_brd_name_by_type(board_info->board_type, brd_name); |
2246 | 2232 | ||
@@ -2262,16 +2248,5 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) | |||
2262 | adapter->netdev->name); | 2248 | adapter->netdev->name); |
2263 | return; | 2249 | return; |
2264 | } | 2250 | } |
2265 | |||
2266 | switch (adapter->ahw.board_type) { | ||
2267 | case NETXEN_NIC_GBE: | ||
2268 | dev_info(&adapter->pdev->dev, "%s: GbE port initialized\n", | ||
2269 | adapter->netdev->name); | ||
2270 | break; | ||
2271 | case NETXEN_NIC_XGBE: | ||
2272 | dev_info(&adapter->pdev->dev, "%s: XGbE port initialized\n", | ||
2273 | adapter->netdev->name); | ||
2274 | break; | ||
2275 | } | ||
2276 | } | 2251 | } |
2277 | 2252 | ||