aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_init.c
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-04-07 18:50:45 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-08 18:58:29 -0400
commitf98a9f693b5f4919d9c4085a2fd8d67c7e152f3e (patch)
treeef0acb778f9bdb7fed66de7f099f772ef7af1175 /drivers/net/netxen/netxen_nic_init.c
parent1fbe63235893e5dce28fe91d8465dd231b0cb3d9 (diff)
netxen: sanitize function names
Replace superfluous wrapper functions with two macros: NXWR32 replaces netxen_nic_reg_write, netxen_nic_write_w0, netxen_nic_read_w1, netxen_crb_writelit_adapter. NXRD32 replaces netxen_nic_reg_read, netxen_nic_read_w0, netxen_nic_read_w1. 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_init.c')
-rw-r--r--drivers/net/netxen/netxen_nic_init.c93
1 files changed, 40 insertions, 53 deletions
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 83116c2817b0..0c91238133f0 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -368,8 +368,7 @@ static int rom_lock(struct netxen_adapter *adapter)
368 368
369 while (!done) { 369 while (!done) {
370 /* acquire semaphore2 from PCI HW block */ 370 /* acquire semaphore2 from PCI HW block */
371 done = netxen_nic_read_w0(adapter, 371 done = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM2_LOCK));
372 NETXEN_PCIE_REG(PCIE_SEM2_LOCK));
373 if (done == 1) 372 if (done == 1)
374 break; 373 break;
375 if (timeout >= rom_lock_timeout) 374 if (timeout >= rom_lock_timeout)
@@ -386,7 +385,7 @@ static int rom_lock(struct netxen_adapter *adapter)
386 cpu_relax(); /*This a nop instr on i386 */ 385 cpu_relax(); /*This a nop instr on i386 */
387 } 386 }
388 } 387 }
389 netxen_nic_reg_write(adapter, NETXEN_ROM_LOCK_ID, ROM_LOCK_DRIVER); 388 NXWR32(adapter, NETXEN_ROM_LOCK_ID, ROM_LOCK_DRIVER);
390 return 0; 389 return 0;
391} 390}
392 391
@@ -398,7 +397,7 @@ static int netxen_wait_rom_done(struct netxen_adapter *adapter)
398 cond_resched(); 397 cond_resched();
399 398
400 while (done == 0) { 399 while (done == 0) {
401 done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); 400 done = NXRD32(adapter, NETXEN_ROMUSB_GLB_STATUS);
402 done &= 2; 401 done &= 2;
403 timeout++; 402 timeout++;
404 if (timeout >= rom_max_timeout) { 403 if (timeout >= rom_max_timeout) {
@@ -412,27 +411,27 @@ static int netxen_wait_rom_done(struct netxen_adapter *adapter)
412static void netxen_rom_unlock(struct netxen_adapter *adapter) 411static void netxen_rom_unlock(struct netxen_adapter *adapter)
413{ 412{
414 /* release semaphore2 */ 413 /* release semaphore2 */
415 netxen_nic_read_w0(adapter, NETXEN_PCIE_REG(PCIE_SEM2_UNLOCK)); 414 NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM2_UNLOCK));
416 415
417} 416}
418 417
419static int do_rom_fast_read(struct netxen_adapter *adapter, 418static int do_rom_fast_read(struct netxen_adapter *adapter,
420 int addr, int *valp) 419 int addr, int *valp)
421{ 420{
422 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); 421 NXWR32(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr);
423 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); 422 NXWR32(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
424 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); 423 NXWR32(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
425 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); 424 NXWR32(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb);
426 if (netxen_wait_rom_done(adapter)) { 425 if (netxen_wait_rom_done(adapter)) {
427 printk("Error waiting for rom done\n"); 426 printk("Error waiting for rom done\n");
428 return -EIO; 427 return -EIO;
429 } 428 }
430 /* reset abyte_cnt and dummy_byte_cnt */ 429 /* reset abyte_cnt and dummy_byte_cnt */
431 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); 430 NXWR32(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0);
432 udelay(10); 431 udelay(10);
433 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); 432 NXWR32(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
434 433
435 *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); 434 *valp = NXRD32(adapter, NETXEN_ROMUSB_ROM_RDATA);
436 return 0; 435 return 0;
437} 436}
438 437
@@ -496,8 +495,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
496 495
497 /* resetall */ 496 /* resetall */
498 rom_lock(adapter); 497 rom_lock(adapter);
499 netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 498 NXWR32(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 0xffffffff);
500 0xffffffff);
501 netxen_rom_unlock(adapter); 499 netxen_rom_unlock(adapter);
502 500
503 if (verbose) { 501 if (verbose) {
@@ -621,7 +619,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
621 } 619 }
622 } 620 }
623 621
624 adapter->hw_write_wx(adapter, off, buf[i].data); 622 NXWR32(adapter, off, buf[i].data);
625 623
626 msleep(init_delay); 624 msleep(init_delay);
627 } 625 }
@@ -631,33 +629,31 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
631 629
632 /* unreset_net_cache */ 630 /* unreset_net_cache */
633 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { 631 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
634 val = adapter->hw_read_wx(adapter, 632 val = NXRD32(adapter, NETXEN_ROMUSB_GLB_SW_RESET);
635 NETXEN_ROMUSB_GLB_SW_RESET); 633 NXWR32(adapter, NETXEN_ROMUSB_GLB_SW_RESET, (val & 0xffffff0f));
636 netxen_crb_writelit_adapter(adapter,
637 NETXEN_ROMUSB_GLB_SW_RESET, (val & 0xffffff0f));
638 } 634 }
639 635
640 /* p2dn replyCount */ 636 /* p2dn replyCount */
641 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_D + 0xec, 0x1e); 637 NXWR32(adapter, NETXEN_CRB_PEG_NET_D + 0xec, 0x1e);
642 /* disable_peg_cache 0 */ 638 /* disable_peg_cache 0 */
643 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_D + 0x4c, 8); 639 NXWR32(adapter, NETXEN_CRB_PEG_NET_D + 0x4c, 8);
644 /* disable_peg_cache 1 */ 640 /* disable_peg_cache 1 */
645 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_I + 0x4c, 8); 641 NXWR32(adapter, NETXEN_CRB_PEG_NET_I + 0x4c, 8);
646 642
647 /* peg_clr_all */ 643 /* peg_clr_all */
648 644
649 /* peg_clr 0 */ 645 /* peg_clr 0 */
650 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_0 + 0x8, 0); 646 NXWR32(adapter, NETXEN_CRB_PEG_NET_0 + 0x8, 0);
651 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_0 + 0xc, 0); 647 NXWR32(adapter, NETXEN_CRB_PEG_NET_0 + 0xc, 0);
652 /* peg_clr 1 */ 648 /* peg_clr 1 */
653 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_1 + 0x8, 0); 649 NXWR32(adapter, NETXEN_CRB_PEG_NET_1 + 0x8, 0);
654 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_1 + 0xc, 0); 650 NXWR32(adapter, NETXEN_CRB_PEG_NET_1 + 0xc, 0);
655 /* peg_clr 2 */ 651 /* peg_clr 2 */
656 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_2 + 0x8, 0); 652 NXWR32(adapter, NETXEN_CRB_PEG_NET_2 + 0x8, 0);
657 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_2 + 0xc, 0); 653 NXWR32(adapter, NETXEN_CRB_PEG_NET_2 + 0xc, 0);
658 /* peg_clr 3 */ 654 /* peg_clr 3 */
659 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_3 + 0x8, 0); 655 NXWR32(adapter, NETXEN_CRB_PEG_NET_3 + 0x8, 0);
660 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_3 + 0xc, 0); 656 NXWR32(adapter, NETXEN_CRB_PEG_NET_3 + 0xc, 0);
661 return 0; 657 return 0;
662} 658}
663 659
@@ -681,12 +677,12 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
681 hi = (addr >> 32) & 0xffffffff; 677 hi = (addr >> 32) & 0xffffffff;
682 lo = addr & 0xffffffff; 678 lo = addr & 0xffffffff;
683 679
684 adapter->hw_write_wx(adapter, CRB_HOST_DUMMY_BUF_ADDR_HI, hi); 680 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_HI, hi);
685 adapter->hw_write_wx(adapter, CRB_HOST_DUMMY_BUF_ADDR_LO, lo); 681 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_LO, lo);
686 682
687 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { 683 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
688 uint32_t temp = 0; 684 uint32_t temp = 0;
689 adapter->hw_write_wx(adapter, CRB_HOST_DUMMY_BUF, temp); 685 NXWR32(adapter, CRB_HOST_DUMMY_BUF, temp);
690 } 686 }
691 687
692 return 0; 688 return 0;
@@ -728,8 +724,7 @@ int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val)
728 724
729 if (!pegtune_val) { 725 if (!pegtune_val) {
730 do { 726 do {
731 val = adapter->hw_read_wx(adapter, 727 val = NXRD32(adapter, CRB_CMDPEG_STATE);
732 CRB_CMDPEG_STATE);
733 728
734 if (val == PHAN_INITIALIZE_COMPLETE || 729 if (val == PHAN_INITIALIZE_COMPLETE ||
735 val == PHAN_INITIALIZE_ACK) 730 val == PHAN_INITIALIZE_ACK)
@@ -740,7 +735,7 @@ int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val)
740 } while (--retries); 735 } while (--retries);
741 736
742 if (!retries) { 737 if (!retries) {
743 pegtune_val = adapter->hw_read_wx(adapter, 738 pegtune_val = NXRD32(adapter,
744 NETXEN_ROMUSB_GLB_PEGTUNE_DONE); 739 NETXEN_ROMUSB_GLB_PEGTUNE_DONE);
745 printk(KERN_WARNING "netxen_phantom_init: init failed, " 740 printk(KERN_WARNING "netxen_phantom_init: init failed, "
746 "pegtune_val=%x\n", pegtune_val); 741 "pegtune_val=%x\n", pegtune_val);
@@ -758,7 +753,7 @@ netxen_receive_peg_ready(struct netxen_adapter *adapter)
758 int retries = 2000; 753 int retries = 2000;
759 754
760 do { 755 do {
761 val = adapter->hw_read_wx(adapter, CRB_RCVPEG_STATE); 756 val = NXRD32(adapter, CRB_RCVPEG_STATE);
762 757
763 if (val == PHAN_PEG_RCV_INITIALIZED) 758 if (val == PHAN_PEG_RCV_INITIALIZED)
764 return 0; 759 return 0;
@@ -784,18 +779,13 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
784 if (err) 779 if (err)
785 return err; 780 return err;
786 781
787 adapter->hw_write_wx(adapter, 782 NXWR32(adapter, CRB_NIC_CAPABILITIES_HOST, INTR_SCHEME_PERPORT);
788 CRB_NIC_CAPABILITIES_HOST, INTR_SCHEME_PERPORT); 783 NXWR32(adapter, CRB_NIC_MSI_MODE_HOST, MSI_MODE_MULTIFUNC);
789 adapter->hw_write_wx(adapter, 784 NXWR32(adapter, CRB_MPORT_MODE, MPORT_MULTI_FUNCTION_MODE);
790 CRB_NIC_MSI_MODE_HOST, MSI_MODE_MULTIFUNC); 785 NXWR32(adapter, CRB_CMDPEG_STATE, PHAN_INITIALIZE_ACK);
791 adapter->hw_write_wx(adapter,
792 CRB_MPORT_MODE, MPORT_MULTI_FUNCTION_MODE);
793 adapter->hw_write_wx(adapter,
794 CRB_CMDPEG_STATE, PHAN_INITIALIZE_ACK);
795 786
796 if (adapter->fw_version >= NETXEN_VERSION_CODE(4, 0, 222)) { 787 if (adapter->fw_version >= NETXEN_VERSION_CODE(4, 0, 222)) {
797 adapter->capabilities = netxen_nic_reg_read(adapter, 788 adapter->capabilities = NXRD32(adapter, CRB_FW_CAPABILITIES_1);
798 CRB_FW_CAPABILITIES_1);
799 } 789 }
800 790
801 return err; 791 return err;
@@ -1057,8 +1047,7 @@ skip:
1057 1047
1058 if (count) { 1048 if (count) {
1059 sds_ring->consumer = consumer; 1049 sds_ring->consumer = consumer;
1060 adapter->hw_write_wx(adapter, 1050 NXWR32(adapter, sds_ring->crb_sts_consumer, consumer);
1061 sds_ring->crb_sts_consumer, consumer);
1062 } 1051 }
1063 1052
1064 return count; 1053 return count;
@@ -1176,8 +1165,7 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
1176 1165
1177 if (count) { 1166 if (count) {
1178 rds_ring->producer = producer; 1167 rds_ring->producer = producer;
1179 adapter->hw_write_wx(adapter, 1168 NXWR32(adapter, rds_ring->crb_rcv_producer,
1180 rds_ring->crb_rcv_producer,
1181 (producer-1) & (rds_ring->num_desc-1)); 1169 (producer-1) & (rds_ring->num_desc-1));
1182 1170
1183 if (adapter->fw_major < 4) { 1171 if (adapter->fw_major < 4) {
@@ -1237,8 +1225,7 @@ netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter,
1237 1225
1238 if (count) { 1226 if (count) {
1239 rds_ring->producer = producer; 1227 rds_ring->producer = producer;
1240 adapter->hw_write_wx(adapter, 1228 NXWR32(adapter, rds_ring->crb_rcv_producer,
1241 rds_ring->crb_rcv_producer,
1242 (producer - 1) & (rds_ring->num_desc - 1)); 1229 (producer - 1) & (rds_ring->num_desc - 1));
1243 wmb(); 1230 wmb();
1244 } 1231 }