diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-02-24 19:39:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-24 19:39:03 -0500 |
commit | dbf64b10fa5b339d8b6e949f97c0d00750b08ca8 (patch) | |
tree | f3fe30e3d5f52d5a600ef10100e2de1670b54f86 /drivers/net/netxen | |
parent | 4da129421f898147235a3e6b40234d789df208b7 (diff) |
netxen: cleanup unused code
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 75 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 13 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.h | 27 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 360 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_niu.c | 219 |
5 files changed, 0 insertions, 694 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 0012b3172f90..87803f1b2fa8 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -473,78 +473,6 @@ netxen_nic_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
473 | return 0; | 473 | return 0; |
474 | } | 474 | } |
475 | 475 | ||
476 | #if 0 | ||
477 | static int | ||
478 | netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | ||
479 | u8 * bytes) | ||
480 | { | ||
481 | struct netxen_adapter *adapter = netdev_priv(dev); | ||
482 | int offset = eeprom->offset; | ||
483 | static int flash_start; | ||
484 | static int ready_to_flash; | ||
485 | int ret; | ||
486 | |||
487 | if (flash_start == 0) { | ||
488 | netxen_halt_pegs(adapter); | ||
489 | ret = netxen_flash_unlock(adapter); | ||
490 | if (ret < 0) { | ||
491 | printk(KERN_ERR "%s: Flash unlock failed.\n", | ||
492 | netxen_nic_driver_name); | ||
493 | return ret; | ||
494 | } | ||
495 | printk(KERN_INFO "%s: flash unlocked. \n", | ||
496 | netxen_nic_driver_name); | ||
497 | ret = netxen_flash_erase_secondary(adapter); | ||
498 | if (ret != FLASH_SUCCESS) { | ||
499 | printk(KERN_ERR "%s: Flash erase failed.\n", | ||
500 | netxen_nic_driver_name); | ||
501 | return ret; | ||
502 | } | ||
503 | printk(KERN_INFO "%s: secondary flash erased successfully.\n", | ||
504 | netxen_nic_driver_name); | ||
505 | flash_start = 1; | ||
506 | return 0; | ||
507 | } | ||
508 | |||
509 | if (offset == NETXEN_BOOTLD_START) { | ||
510 | ret = netxen_flash_erase_primary(adapter); | ||
511 | if (ret != FLASH_SUCCESS) { | ||
512 | printk(KERN_ERR "%s: Flash erase failed.\n", | ||
513 | netxen_nic_driver_name); | ||
514 | return ret; | ||
515 | } | ||
516 | |||
517 | ret = netxen_rom_se(adapter, NETXEN_USER_START); | ||
518 | if (ret != FLASH_SUCCESS) | ||
519 | return ret; | ||
520 | ret = netxen_rom_se(adapter, NETXEN_FIXED_START); | ||
521 | if (ret != FLASH_SUCCESS) | ||
522 | return ret; | ||
523 | |||
524 | printk(KERN_INFO "%s: primary flash erased successfully\n", | ||
525 | netxen_nic_driver_name); | ||
526 | |||
527 | ret = netxen_backup_crbinit(adapter); | ||
528 | if (ret != FLASH_SUCCESS) { | ||
529 | printk(KERN_ERR "%s: CRBinit backup failed.\n", | ||
530 | netxen_nic_driver_name); | ||
531 | return ret; | ||
532 | } | ||
533 | printk(KERN_INFO "%s: CRBinit backup done.\n", | ||
534 | netxen_nic_driver_name); | ||
535 | ready_to_flash = 1; | ||
536 | } | ||
537 | |||
538 | if (!ready_to_flash) { | ||
539 | printk(KERN_ERR "%s: Invalid write sequence, returning...\n", | ||
540 | netxen_nic_driver_name); | ||
541 | return -EINVAL; | ||
542 | } | ||
543 | |||
544 | return netxen_rom_fast_write_words(adapter, offset, bytes, eeprom->len); | ||
545 | } | ||
546 | #endif /* 0 */ | ||
547 | |||
548 | static void | 476 | static void |
549 | netxen_nic_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring) | 477 | netxen_nic_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring) |
550 | { | 478 | { |
@@ -953,9 +881,6 @@ struct ethtool_ops netxen_nic_ethtool_ops = { | |||
953 | .get_link = ethtool_op_get_link, | 881 | .get_link = ethtool_op_get_link, |
954 | .get_eeprom_len = netxen_nic_get_eeprom_len, | 882 | .get_eeprom_len = netxen_nic_get_eeprom_len, |
955 | .get_eeprom = netxen_nic_get_eeprom, | 883 | .get_eeprom = netxen_nic_get_eeprom, |
956 | #if 0 | ||
957 | .set_eeprom = netxen_nic_set_eeprom, | ||
958 | #endif | ||
959 | .get_ringparam = netxen_nic_get_ringparam, | 884 | .get_ringparam = netxen_nic_get_ringparam, |
960 | .get_pauseparam = netxen_nic_get_pauseparam, | 885 | .get_pauseparam = netxen_nic_get_pauseparam, |
961 | .set_pauseparam = netxen_nic_set_pauseparam, | 886 | .set_pauseparam = netxen_nic_set_pauseparam, |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index aef39e7a5e29..b6b777e62e77 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -2077,19 +2077,6 @@ u32 netxen_nic_pci_read_normalize_2M(struct netxen_adapter *adapter, u64 off) | |||
2077 | return temp; | 2077 | return temp; |
2078 | } | 2078 | } |
2079 | 2079 | ||
2080 | #if 0 | ||
2081 | int | ||
2082 | netxen_nic_erase_pxe(struct netxen_adapter *adapter) | ||
2083 | { | ||
2084 | if (netxen_rom_fast_write(adapter, NETXEN_PXE_START, 0) == -1) { | ||
2085 | printk(KERN_ERR "%s: erase pxe failed\n", | ||
2086 | netxen_nic_driver_name); | ||
2087 | return -1; | ||
2088 | } | ||
2089 | return 0; | ||
2090 | } | ||
2091 | #endif /* 0 */ | ||
2092 | |||
2093 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) | 2080 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) |
2094 | { | 2081 | { |
2095 | int rv = 0; | 2082 | int rv = 0; |
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h index 70238bf7e11a..9dcfb3223d84 100644 --- a/drivers/net/netxen/netxen_nic_hw.h +++ b/drivers/net/netxen/netxen_nic_hw.h | |||
@@ -124,33 +124,6 @@ typedef enum { | |||
124 | #define netxen_gb_get_soft_reset(config_word) \ | 124 | #define netxen_gb_get_soft_reset(config_word) \ |
125 | _netxen_crb_get_bit((config_word), 31) | 125 | _netxen_crb_get_bit((config_word), 31) |
126 | 126 | ||
127 | /* | ||
128 | * NIU GB MAC Config Register 1 (applies to GB0, GB1, GB2, GB3) | ||
129 | * | ||
130 | * Bit 0 : duplex => 1:full duplex mode, 0:half duplex | ||
131 | * Bit 1 : crc_enable => 1:append CRC to xmit frames, 0:dont append | ||
132 | * Bit 2 : padshort => 1:pad short frames and add CRC, 0:dont pad | ||
133 | * Bit 4 : checklength => 1:check framelen with actual,0:dont check | ||
134 | * Bit 5 : hugeframes => 1:allow oversize xmit frames, 0:dont allow | ||
135 | * Bits 8-9 : intfmode => 01:nibble (10/100), 10:byte (1000) | ||
136 | * Bits 12-15 : preamblelen => preamble field length in bytes, default 7 | ||
137 | */ | ||
138 | |||
139 | #define netxen_gb_set_duplex(config_word) \ | ||
140 | ((config_word) |= 1 << 0) | ||
141 | #define netxen_gb_set_crc_enable(config_word) \ | ||
142 | ((config_word) |= 1 << 1) | ||
143 | #define netxen_gb_set_padshort(config_word) \ | ||
144 | ((config_word) |= 1 << 2) | ||
145 | #define netxen_gb_set_checklength(config_word) \ | ||
146 | ((config_word) |= 1 << 4) | ||
147 | #define netxen_gb_set_hugeframes(config_word) \ | ||
148 | ((config_word) |= 1 << 5) | ||
149 | #define netxen_gb_set_preamblelen(config_word, val) \ | ||
150 | ((config_word) |= ((val) << 12) & 0xF000) | ||
151 | #define netxen_gb_set_intfmode(config_word, val) \ | ||
152 | ((config_word) |= ((val) << 8) & 0x300) | ||
153 | |||
154 | #define netxen_gb_get_stationaddress_low(config_word) ((config_word) >> 16) | 127 | #define netxen_gb_get_stationaddress_low(config_word) ((config_word) >> 16) |
155 | 128 | ||
156 | #define netxen_gb_set_mii_mgmt_clockselect(config_word, val) \ | 129 | #define netxen_gb_set_mii_mgmt_clockselect(config_word, val) \ |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index ffd37bea1628..688f8807843f 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -55,15 +55,6 @@ static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM]; | |||
55 | static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, | 55 | static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, |
56 | uint32_t ctx, uint32_t ringid); | 56 | uint32_t ctx, uint32_t ringid); |
57 | 57 | ||
58 | #if 0 | ||
59 | static void netxen_nic_locked_write_reg(struct netxen_adapter *adapter, | ||
60 | unsigned long off, int *data) | ||
61 | { | ||
62 | void __iomem *addr = pci_base_offset(adapter, off); | ||
63 | writel(*data, addr); | ||
64 | } | ||
65 | #endif /* 0 */ | ||
66 | |||
67 | static void crb_addr_transform_setup(void) | 58 | static void crb_addr_transform_setup(void) |
68 | { | 59 | { |
69 | crb_addr_transform(XDMA); | 60 | crb_addr_transform(XDMA); |
@@ -399,9 +390,6 @@ static u32 netxen_decode_crb_addr(u32 addr) | |||
399 | 390 | ||
400 | static long rom_max_timeout = 100; | 391 | static long rom_max_timeout = 100; |
401 | static long rom_lock_timeout = 10000; | 392 | static long rom_lock_timeout = 10000; |
402 | #if 0 | ||
403 | static long rom_write_timeout = 700; | ||
404 | #endif | ||
405 | 393 | ||
406 | static int rom_lock(struct netxen_adapter *adapter) | 394 | static int rom_lock(struct netxen_adapter *adapter) |
407 | { | 395 | { |
@@ -452,38 +440,6 @@ static int netxen_wait_rom_done(struct netxen_adapter *adapter) | |||
452 | return 0; | 440 | return 0; |
453 | } | 441 | } |
454 | 442 | ||
455 | #if 0 | ||
456 | static int netxen_rom_wren(struct netxen_adapter *adapter) | ||
457 | { | ||
458 | /* Set write enable latch in ROM status register */ | ||
459 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); | ||
460 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, | ||
461 | M25P_INSTR_WREN); | ||
462 | if (netxen_wait_rom_done(adapter)) { | ||
463 | return -1; | ||
464 | } | ||
465 | return 0; | ||
466 | } | ||
467 | |||
468 | static unsigned int netxen_rdcrbreg(struct netxen_adapter *adapter, | ||
469 | unsigned int addr) | ||
470 | { | ||
471 | unsigned int data = 0xdeaddead; | ||
472 | data = netxen_nic_reg_read(adapter, addr); | ||
473 | return data; | ||
474 | } | ||
475 | |||
476 | static int netxen_do_rom_rdsr(struct netxen_adapter *adapter) | ||
477 | { | ||
478 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, | ||
479 | M25P_INSTR_RDSR); | ||
480 | if (netxen_wait_rom_done(adapter)) { | ||
481 | return -1; | ||
482 | } | ||
483 | return netxen_rdcrbreg(adapter, NETXEN_ROMUSB_ROM_RDATA); | ||
484 | } | ||
485 | #endif | ||
486 | |||
487 | static void netxen_rom_unlock(struct netxen_adapter *adapter) | 443 | static void netxen_rom_unlock(struct netxen_adapter *adapter) |
488 | { | 444 | { |
489 | u32 val; | 445 | u32 val; |
@@ -493,44 +449,6 @@ static void netxen_rom_unlock(struct netxen_adapter *adapter) | |||
493 | 449 | ||
494 | } | 450 | } |
495 | 451 | ||
496 | #if 0 | ||
497 | static int netxen_rom_wip_poll(struct netxen_adapter *adapter) | ||
498 | { | ||
499 | long timeout = 0; | ||
500 | long wip = 1; | ||
501 | int val; | ||
502 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); | ||
503 | while (wip != 0) { | ||
504 | val = netxen_do_rom_rdsr(adapter); | ||
505 | wip = val & 1; | ||
506 | timeout++; | ||
507 | if (timeout > rom_max_timeout) { | ||
508 | return -1; | ||
509 | } | ||
510 | } | ||
511 | return 0; | ||
512 | } | ||
513 | |||
514 | static int do_rom_fast_write(struct netxen_adapter *adapter, int addr, | ||
515 | int data) | ||
516 | { | ||
517 | if (netxen_rom_wren(adapter)) { | ||
518 | return -1; | ||
519 | } | ||
520 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_WDATA, data); | ||
521 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); | ||
522 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
523 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, | ||
524 | M25P_INSTR_PP); | ||
525 | if (netxen_wait_rom_done(adapter)) { | ||
526 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); | ||
527 | return -1; | ||
528 | } | ||
529 | |||
530 | return netxen_rom_wip_poll(adapter); | ||
531 | } | ||
532 | #endif | ||
533 | |||
534 | static int do_rom_fast_read(struct netxen_adapter *adapter, | 452 | static int do_rom_fast_read(struct netxen_adapter *adapter, |
535 | int addr, int *valp) | 453 | int addr, int *valp) |
536 | { | 454 | { |
@@ -597,284 +515,6 @@ int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp) | |||
597 | return ret; | 515 | return ret; |
598 | } | 516 | } |
599 | 517 | ||
600 | #if 0 | ||
601 | int netxen_rom_fast_write(struct netxen_adapter *adapter, int addr, int data) | ||
602 | { | ||
603 | int ret = 0; | ||
604 | |||
605 | if (rom_lock(adapter) != 0) { | ||
606 | return -1; | ||
607 | } | ||
608 | ret = do_rom_fast_write(adapter, addr, data); | ||
609 | netxen_rom_unlock(adapter); | ||
610 | return ret; | ||
611 | } | ||
612 | |||
613 | static int do_rom_fast_write_words(struct netxen_adapter *adapter, | ||
614 | int addr, u8 *bytes, size_t size) | ||
615 | { | ||
616 | int addridx = addr; | ||
617 | int ret = 0; | ||
618 | |||
619 | while (addridx < (addr + size)) { | ||
620 | int last_attempt = 0; | ||
621 | int timeout = 0; | ||
622 | int data; | ||
623 | |||
624 | data = le32_to_cpu((*(__le32*)bytes)); | ||
625 | ret = do_rom_fast_write(adapter, addridx, data); | ||
626 | if (ret < 0) | ||
627 | return ret; | ||
628 | |||
629 | while(1) { | ||
630 | int data1; | ||
631 | |||
632 | ret = do_rom_fast_read(adapter, addridx, &data1); | ||
633 | if (ret < 0) | ||
634 | return ret; | ||
635 | |||
636 | if (data1 == data) | ||
637 | break; | ||
638 | |||
639 | if (timeout++ >= rom_write_timeout) { | ||
640 | if (last_attempt++ < 4) { | ||
641 | ret = do_rom_fast_write(adapter, | ||
642 | addridx, data); | ||
643 | if (ret < 0) | ||
644 | return ret; | ||
645 | } | ||
646 | else { | ||
647 | printk(KERN_INFO "Data write did not " | ||
648 | "succeed at address 0x%x\n", addridx); | ||
649 | break; | ||
650 | } | ||
651 | } | ||
652 | } | ||
653 | |||
654 | bytes += 4; | ||
655 | addridx += 4; | ||
656 | } | ||
657 | |||
658 | return ret; | ||
659 | } | ||
660 | |||
661 | int netxen_rom_fast_write_words(struct netxen_adapter *adapter, int addr, | ||
662 | u8 *bytes, size_t size) | ||
663 | { | ||
664 | int ret = 0; | ||
665 | |||
666 | ret = rom_lock(adapter); | ||
667 | if (ret < 0) | ||
668 | return ret; | ||
669 | |||
670 | ret = do_rom_fast_write_words(adapter, addr, bytes, size); | ||
671 | netxen_rom_unlock(adapter); | ||
672 | |||
673 | return ret; | ||
674 | } | ||
675 | |||
676 | static int netxen_rom_wrsr(struct netxen_adapter *adapter, int data) | ||
677 | { | ||
678 | int ret; | ||
679 | |||
680 | ret = netxen_rom_wren(adapter); | ||
681 | if (ret < 0) | ||
682 | return ret; | ||
683 | |||
684 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_ROM_WDATA, data); | ||
685 | netxen_crb_writelit_adapter(adapter, | ||
686 | NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0x1); | ||
687 | |||
688 | ret = netxen_wait_rom_done(adapter); | ||
689 | if (ret < 0) | ||
690 | return ret; | ||
691 | |||
692 | return netxen_rom_wip_poll(adapter); | ||
693 | } | ||
694 | |||
695 | static int netxen_rom_rdsr(struct netxen_adapter *adapter) | ||
696 | { | ||
697 | int ret; | ||
698 | |||
699 | ret = rom_lock(adapter); | ||
700 | if (ret < 0) | ||
701 | return ret; | ||
702 | |||
703 | ret = netxen_do_rom_rdsr(adapter); | ||
704 | netxen_rom_unlock(adapter); | ||
705 | return ret; | ||
706 | } | ||
707 | |||
708 | int netxen_backup_crbinit(struct netxen_adapter *adapter) | ||
709 | { | ||
710 | int ret = FLASH_SUCCESS; | ||
711 | int val; | ||
712 | char *buffer = kmalloc(NETXEN_FLASH_SECTOR_SIZE, GFP_KERNEL); | ||
713 | |||
714 | if (!buffer) | ||
715 | return -ENOMEM; | ||
716 | /* unlock sector 63 */ | ||
717 | val = netxen_rom_rdsr(adapter); | ||
718 | val = val & 0xe3; | ||
719 | ret = netxen_rom_wrsr(adapter, val); | ||
720 | if (ret != FLASH_SUCCESS) | ||
721 | goto out_kfree; | ||
722 | |||
723 | ret = netxen_rom_wip_poll(adapter); | ||
724 | if (ret != FLASH_SUCCESS) | ||
725 | goto out_kfree; | ||
726 | |||
727 | /* copy sector 0 to sector 63 */ | ||
728 | ret = netxen_rom_fast_read_words(adapter, NETXEN_CRBINIT_START, | ||
729 | buffer, NETXEN_FLASH_SECTOR_SIZE); | ||
730 | if (ret != FLASH_SUCCESS) | ||
731 | goto out_kfree; | ||
732 | |||
733 | ret = netxen_rom_fast_write_words(adapter, NETXEN_FIXED_START, | ||
734 | buffer, NETXEN_FLASH_SECTOR_SIZE); | ||
735 | if (ret != FLASH_SUCCESS) | ||
736 | goto out_kfree; | ||
737 | |||
738 | /* lock sector 63 */ | ||
739 | val = netxen_rom_rdsr(adapter); | ||
740 | if (!(val & 0x8)) { | ||
741 | val |= (0x1 << 2); | ||
742 | /* lock sector 63 */ | ||
743 | if (netxen_rom_wrsr(adapter, val) == 0) { | ||
744 | ret = netxen_rom_wip_poll(adapter); | ||
745 | if (ret != FLASH_SUCCESS) | ||
746 | goto out_kfree; | ||
747 | |||
748 | /* lock SR writes */ | ||
749 | ret = netxen_rom_wip_poll(adapter); | ||
750 | if (ret != FLASH_SUCCESS) | ||
751 | goto out_kfree; | ||
752 | } | ||
753 | } | ||
754 | |||
755 | out_kfree: | ||
756 | kfree(buffer); | ||
757 | return ret; | ||
758 | } | ||
759 | |||
760 | static int netxen_do_rom_se(struct netxen_adapter *adapter, int addr) | ||
761 | { | ||
762 | netxen_rom_wren(adapter); | ||
763 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); | ||
764 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
765 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, | ||
766 | M25P_INSTR_SE); | ||
767 | if (netxen_wait_rom_done(adapter)) { | ||
768 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); | ||
769 | return -1; | ||
770 | } | ||
771 | return netxen_rom_wip_poll(adapter); | ||
772 | } | ||
773 | |||
774 | static void check_erased_flash(struct netxen_adapter *adapter, int addr) | ||
775 | { | ||
776 | int i; | ||
777 | int val; | ||
778 | int count = 0, erased_errors = 0; | ||
779 | int range; | ||
780 | |||
781 | range = (addr == NETXEN_USER_START) ? | ||
782 | NETXEN_FIXED_START : addr + NETXEN_FLASH_SECTOR_SIZE; | ||
783 | |||
784 | for (i = addr; i < range; i += 4) { | ||
785 | netxen_rom_fast_read(adapter, i, &val); | ||
786 | if (val != 0xffffffff) | ||
787 | erased_errors++; | ||
788 | count++; | ||
789 | } | ||
790 | |||
791 | if (erased_errors) | ||
792 | printk(KERN_INFO "0x%x out of 0x%x words fail to be erased " | ||
793 | "for sector address: %x\n", erased_errors, count, addr); | ||
794 | } | ||
795 | |||
796 | int netxen_rom_se(struct netxen_adapter *adapter, int addr) | ||
797 | { | ||
798 | int ret = 0; | ||
799 | if (rom_lock(adapter) != 0) { | ||
800 | return -1; | ||
801 | } | ||
802 | ret = netxen_do_rom_se(adapter, addr); | ||
803 | netxen_rom_unlock(adapter); | ||
804 | msleep(30); | ||
805 | check_erased_flash(adapter, addr); | ||
806 | |||
807 | return ret; | ||
808 | } | ||
809 | |||
810 | static int netxen_flash_erase_sections(struct netxen_adapter *adapter, | ||
811 | int start, int end) | ||
812 | { | ||
813 | int ret = FLASH_SUCCESS; | ||
814 | int i; | ||
815 | |||
816 | for (i = start; i < end; i++) { | ||
817 | ret = netxen_rom_se(adapter, i * NETXEN_FLASH_SECTOR_SIZE); | ||
818 | if (ret) | ||
819 | break; | ||
820 | ret = netxen_rom_wip_poll(adapter); | ||
821 | if (ret < 0) | ||
822 | return ret; | ||
823 | } | ||
824 | |||
825 | return ret; | ||
826 | } | ||
827 | |||
828 | int | ||
829 | netxen_flash_erase_secondary(struct netxen_adapter *adapter) | ||
830 | { | ||
831 | int ret = FLASH_SUCCESS; | ||
832 | int start, end; | ||
833 | |||
834 | start = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE; | ||
835 | end = NETXEN_USER_START / NETXEN_FLASH_SECTOR_SIZE; | ||
836 | ret = netxen_flash_erase_sections(adapter, start, end); | ||
837 | |||
838 | return ret; | ||
839 | } | ||
840 | |||
841 | int | ||
842 | netxen_flash_erase_primary(struct netxen_adapter *adapter) | ||
843 | { | ||
844 | int ret = FLASH_SUCCESS; | ||
845 | int start, end; | ||
846 | |||
847 | start = NETXEN_PRIMARY_START / NETXEN_FLASH_SECTOR_SIZE; | ||
848 | end = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE; | ||
849 | ret = netxen_flash_erase_sections(adapter, start, end); | ||
850 | |||
851 | return ret; | ||
852 | } | ||
853 | |||
854 | void netxen_halt_pegs(struct netxen_adapter *adapter) | ||
855 | { | ||
856 | netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_0 + 0x3c, 1); | ||
857 | netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_1 + 0x3c, 1); | ||
858 | netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_2 + 0x3c, 1); | ||
859 | netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_3 + 0x3c, 1); | ||
860 | } | ||
861 | |||
862 | int netxen_flash_unlock(struct netxen_adapter *adapter) | ||
863 | { | ||
864 | int ret = 0; | ||
865 | |||
866 | ret = netxen_rom_wrsr(adapter, 0); | ||
867 | if (ret < 0) | ||
868 | return ret; | ||
869 | |||
870 | ret = netxen_rom_wren(adapter); | ||
871 | if (ret < 0) | ||
872 | return ret; | ||
873 | |||
874 | return ret; | ||
875 | } | ||
876 | #endif /* 0 */ | ||
877 | |||
878 | #define NETXEN_BOARDTYPE 0x4008 | 518 | #define NETXEN_BOARDTYPE 0x4008 |
879 | #define NETXEN_BOARDNUM 0x400c | 519 | #define NETXEN_BOARDNUM 0x400c |
880 | #define NETXEN_CHIPNUM 0x4010 | 520 | #define NETXEN_CHIPNUM 0x4010 |
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index c3b9c83b32fe..3851a677fd55 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -299,14 +299,6 @@ int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter) | |||
299 | return result; | 299 | return result; |
300 | } | 300 | } |
301 | 301 | ||
302 | #if 0 | ||
303 | int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter) | ||
304 | { | ||
305 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_ACTIVE_INT, -1); | ||
306 | return 0; | ||
307 | } | ||
308 | #endif /* 0 */ | ||
309 | |||
310 | static int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter) | 302 | static int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter) |
311 | { | 303 | { |
312 | int result = 0; | 304 | int result = 0; |
@@ -467,104 +459,6 @@ int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | |||
467 | return 0; | 459 | return 0; |
468 | } | 460 | } |
469 | 461 | ||
470 | #if 0 | ||
471 | /* | ||
472 | * netxen_niu_gbe_handle_phy_interrupt - Handles GbE PHY interrupts | ||
473 | * @param enable 0 means don't enable the port | ||
474 | * 1 means enable (or re-enable) the port | ||
475 | */ | ||
476 | int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | ||
477 | int port, long enable) | ||
478 | { | ||
479 | int result = 0; | ||
480 | __u32 int_src; | ||
481 | |||
482 | printk(KERN_INFO PFX "NETXEN: Handling PHY interrupt on port %d" | ||
483 | " (device enable = %d)\n", (int)port, (int)enable); | ||
484 | |||
485 | /* | ||
486 | * The read of the PHY INT status will clear the pending | ||
487 | * interrupt status | ||
488 | */ | ||
489 | if (netxen_niu_gbe_phy_read(adapter, | ||
490 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | ||
491 | &int_src) != 0) | ||
492 | result = -EINVAL; | ||
493 | else { | ||
494 | printk(KERN_INFO PFX "PHY Interrupt source = 0x%x \n", int_src); | ||
495 | if (netxen_get_phy_int_jabber(int_src)) | ||
496 | printk(KERN_INFO PFX "jabber Interrupt "); | ||
497 | if (netxen_get_phy_int_polarity_changed(int_src)) | ||
498 | printk(KERN_INFO PFX "polarity changed "); | ||
499 | if (netxen_get_phy_int_energy_detect(int_src)) | ||
500 | printk(KERN_INFO PFX "energy detect \n"); | ||
501 | if (netxen_get_phy_int_downshift(int_src)) | ||
502 | printk(KERN_INFO PFX "downshift \n"); | ||
503 | if (netxen_get_phy_int_mdi_xover_changed(int_src)) | ||
504 | printk(KERN_INFO PFX "mdi_xover_changed "); | ||
505 | if (netxen_get_phy_int_fifo_over_underflow(int_src)) | ||
506 | printk(KERN_INFO PFX "fifo_over_underflow "); | ||
507 | if (netxen_get_phy_int_false_carrier(int_src)) | ||
508 | printk(KERN_INFO PFX "false_carrier "); | ||
509 | if (netxen_get_phy_int_symbol_error(int_src)) | ||
510 | printk(KERN_INFO PFX "symbol_error "); | ||
511 | if (netxen_get_phy_int_autoneg_completed(int_src)) | ||
512 | printk(KERN_INFO PFX "autoneg_completed "); | ||
513 | if (netxen_get_phy_int_page_received(int_src)) | ||
514 | printk(KERN_INFO PFX "page_received "); | ||
515 | if (netxen_get_phy_int_duplex_changed(int_src)) | ||
516 | printk(KERN_INFO PFX "duplex_changed "); | ||
517 | if (netxen_get_phy_int_autoneg_error(int_src)) | ||
518 | printk(KERN_INFO PFX "autoneg_error "); | ||
519 | if ((netxen_get_phy_int_speed_changed(int_src)) | ||
520 | || (netxen_get_phy_int_link_status_changed(int_src))) { | ||
521 | __u32 status; | ||
522 | |||
523 | printk(KERN_INFO PFX | ||
524 | "speed_changed or link status changed"); | ||
525 | if (netxen_niu_gbe_phy_read | ||
526 | (adapter, | ||
527 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | ||
528 | &status) == 0) { | ||
529 | if (netxen_get_phy_speed(status) == 2) { | ||
530 | printk | ||
531 | (KERN_INFO PFX "Link speed changed" | ||
532 | " to 1000 Mbps\n"); | ||
533 | netxen_niu_gbe_set_gmii_mode(adapter, | ||
534 | port, | ||
535 | enable); | ||
536 | } else if (netxen_get_phy_speed(status) == 1) { | ||
537 | printk | ||
538 | (KERN_INFO PFX "Link speed changed" | ||
539 | " to 100 Mbps\n"); | ||
540 | netxen_niu_gbe_set_mii_mode(adapter, | ||
541 | port, | ||
542 | enable); | ||
543 | } else if (netxen_get_phy_speed(status) == 0) { | ||
544 | printk | ||
545 | (KERN_INFO PFX "Link speed changed" | ||
546 | " to 10 Mbps\n"); | ||
547 | netxen_niu_gbe_set_mii_mode(adapter, | ||
548 | port, | ||
549 | enable); | ||
550 | } else { | ||
551 | printk(KERN_ERR PFX "ERROR reading " | ||
552 | "PHY status. Invalid speed.\n"); | ||
553 | result = -1; | ||
554 | } | ||
555 | } else { | ||
556 | printk(KERN_ERR PFX | ||
557 | "ERROR reading PHY status.\n"); | ||
558 | result = -1; | ||
559 | } | ||
560 | |||
561 | } | ||
562 | printk(KERN_INFO "\n"); | ||
563 | } | ||
564 | return result; | ||
565 | } | ||
566 | #endif /* 0 */ | ||
567 | |||
568 | /* | 462 | /* |
569 | * Return the current station MAC address. | 463 | * Return the current station MAC address. |
570 | * Note that the passed-in value must already be in network byte order. | 464 | * Note that the passed-in value must already be in network byte order. |
@@ -641,86 +535,6 @@ int netxen_niu_macaddr_set(struct netxen_adapter *adapter, | |||
641 | return 0; | 535 | return 0; |
642 | } | 536 | } |
643 | 537 | ||
644 | #if 0 | ||
645 | /* Enable a GbE interface */ | ||
646 | int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter, | ||
647 | int port, netxen_niu_gbe_ifmode_t mode) | ||
648 | { | ||
649 | __u32 mac_cfg0; | ||
650 | __u32 mac_cfg1; | ||
651 | __u32 mii_cfg; | ||
652 | |||
653 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | ||
654 | return -EINVAL; | ||
655 | |||
656 | mac_cfg0 = 0; | ||
657 | netxen_gb_soft_reset(mac_cfg0); | ||
658 | if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), | ||
659 | &mac_cfg0, 4)) | ||
660 | return -EIO; | ||
661 | mac_cfg0 = 0; | ||
662 | netxen_gb_enable_tx(mac_cfg0); | ||
663 | netxen_gb_enable_rx(mac_cfg0); | ||
664 | netxen_gb_unset_rx_flowctl(mac_cfg0); | ||
665 | netxen_gb_tx_reset_pb(mac_cfg0); | ||
666 | netxen_gb_rx_reset_pb(mac_cfg0); | ||
667 | netxen_gb_tx_reset_mac(mac_cfg0); | ||
668 | netxen_gb_rx_reset_mac(mac_cfg0); | ||
669 | |||
670 | if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), | ||
671 | &mac_cfg0, 4)) | ||
672 | return -EIO; | ||
673 | mac_cfg1 = 0; | ||
674 | netxen_gb_set_preamblelen(mac_cfg1, 0xf); | ||
675 | netxen_gb_set_duplex(mac_cfg1); | ||
676 | netxen_gb_set_crc_enable(mac_cfg1); | ||
677 | netxen_gb_set_padshort(mac_cfg1); | ||
678 | netxen_gb_set_checklength(mac_cfg1); | ||
679 | netxen_gb_set_hugeframes(mac_cfg1); | ||
680 | |||
681 | if (mode == NETXEN_NIU_10_100_MB) { | ||
682 | netxen_gb_set_intfmode(mac_cfg1, 1); | ||
683 | if (adapter->hw_write_wx(adapter, | ||
684 | NETXEN_NIU_GB_MAC_CONFIG_1(port), | ||
685 | &mac_cfg1, 4)) | ||
686 | return -EIO; | ||
687 | |||
688 | /* set mii mode */ | ||
689 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_GB0_GMII_MODE + | ||
690 | (port << 3), 0); | ||
691 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_GB0_MII_MODE + | ||
692 | (port << 3), 1); | ||
693 | |||
694 | } else if (mode == NETXEN_NIU_1000_MB) { | ||
695 | netxen_gb_set_intfmode(mac_cfg1, 2); | ||
696 | if (adapter->hw_write_wx(adapter, | ||
697 | NETXEN_NIU_GB_MAC_CONFIG_1(port), | ||
698 | &mac_cfg1, 4)) | ||
699 | return -EIO; | ||
700 | /* set gmii mode */ | ||
701 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_GB0_MII_MODE + | ||
702 | (port << 3), 0); | ||
703 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_GB0_GMII_MODE + | ||
704 | (port << 3), 1); | ||
705 | } | ||
706 | mii_cfg = 0; | ||
707 | netxen_gb_set_mii_mgmt_clockselect(mii_cfg, 7); | ||
708 | if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_CONFIG(port), | ||
709 | &mii_cfg, 4)) | ||
710 | return -EIO; | ||
711 | mac_cfg0 = 0; | ||
712 | netxen_gb_enable_tx(mac_cfg0); | ||
713 | netxen_gb_enable_rx(mac_cfg0); | ||
714 | netxen_gb_unset_rx_flowctl(mac_cfg0); | ||
715 | netxen_gb_unset_tx_flowctl(mac_cfg0); | ||
716 | |||
717 | if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), | ||
718 | &mac_cfg0, 4)) | ||
719 | return -EIO; | ||
720 | return 0; | ||
721 | } | ||
722 | #endif /* 0 */ | ||
723 | |||
724 | /* Disable a GbE interface */ | 538 | /* Disable a GbE interface */ |
725 | int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter) | 539 | int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter) |
726 | { | 540 | { |
@@ -869,39 +683,6 @@ int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, | |||
869 | return 0; | 683 | return 0; |
870 | } | 684 | } |
871 | 685 | ||
872 | #if 0 | ||
873 | /* | ||
874 | * Return the current station MAC address. | ||
875 | * Note that the passed-in value must already be in network byte order. | ||
876 | */ | ||
877 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, | ||
878 | netxen_ethernet_macaddr_t * addr) | ||
879 | { | ||
880 | int phy = adapter->physical_port; | ||
881 | u32 stationhigh; | ||
882 | u32 stationlow; | ||
883 | u8 val[8]; | ||
884 | |||
885 | if (addr == NULL) | ||
886 | return -EINVAL; | ||
887 | if (phy != 0) | ||
888 | return -EINVAL; | ||
889 | |||
890 | if (adapter->hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_HI, | ||
891 | &stationhigh, 4)) | ||
892 | return -EIO; | ||
893 | if (adapter->hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1, | ||
894 | &stationlow, 4)) | ||
895 | return -EIO; | ||
896 | ((__le32 *)val)[1] = cpu_to_le32(stationhigh); | ||
897 | ((__le32 *)val)[0] = cpu_to_le32(stationlow); | ||
898 | |||
899 | memcpy(addr, val + 2, 6); | ||
900 | |||
901 | return 0; | ||
902 | } | ||
903 | #endif /* 0 */ | ||
904 | |||
905 | int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, | 686 | int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, |
906 | u32 mode) | 687 | u32 mode) |
907 | { | 688 | { |