aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_phy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_phy.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_phy.c149
1 files changed, 94 insertions, 55 deletions
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c
index 8f7123e8fc0a..f8a60ca87500 100644
--- a/drivers/net/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ixgbe/ixgbe_phy.c
@@ -556,11 +556,10 @@ out:
556} 556}
557 557
558/** 558/**
559 * ixgbe_identify_sfp_module_generic - Identifies SFP module and assigns 559 * ixgbe_identify_sfp_module_generic - Identifies SFP modules
560 * the PHY type.
561 * @hw: pointer to hardware structure 560 * @hw: pointer to hardware structure
562 * 561 *
563 * Searches for and indentifies the SFP module. Assings appropriate PHY type. 562 * Searches for and identifies the SFP module and assigns appropriate PHY type.
564 **/ 563 **/
565s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) 564s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
566{ 565{
@@ -581,41 +580,62 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
581 goto out; 580 goto out;
582 } 581 }
583 582
584 status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_IDENTIFIER, 583 status = hw->phy.ops.read_i2c_eeprom(hw,
584 IXGBE_SFF_IDENTIFIER,
585 &identifier); 585 &identifier);
586 586
587 if (status == IXGBE_ERR_SFP_NOT_PRESENT || status == IXGBE_ERR_I2C) { 587 if (status == IXGBE_ERR_SWFW_SYNC ||
588 status = IXGBE_ERR_SFP_NOT_PRESENT; 588 status == IXGBE_ERR_I2C ||
589 hw->phy.sfp_type = ixgbe_sfp_type_not_present; 589 status == IXGBE_ERR_SFP_NOT_PRESENT)
590 if (hw->phy.type != ixgbe_phy_nl) { 590 goto err_read_i2c_eeprom;
591 hw->phy.id = 0;
592 hw->phy.type = ixgbe_phy_unknown;
593 }
594 goto out;
595 }
596 591
597 if (identifier == IXGBE_SFF_IDENTIFIER_SFP) { 592 /* LAN ID is needed for sfp_type determination */
598 hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_1GBE_COMP_CODES, 593 hw->mac.ops.set_lan_id(hw);
599 &comp_codes_1g); 594
600 hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_10GBE_COMP_CODES, 595 if (identifier != IXGBE_SFF_IDENTIFIER_SFP) {
601 &comp_codes_10g); 596 hw->phy.type = ixgbe_phy_sfp_unsupported;
602 hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_CABLE_TECHNOLOGY, 597 status = IXGBE_ERR_SFP_NOT_SUPPORTED;
603 &cable_tech); 598 } else {
604 599 status = hw->phy.ops.read_i2c_eeprom(hw,
605 /* ID Module 600 IXGBE_SFF_1GBE_COMP_CODES,
606 * ========= 601 &comp_codes_1g);
607 * 0 SFP_DA_CU 602
608 * 1 SFP_SR 603 if (status == IXGBE_ERR_SWFW_SYNC ||
609 * 2 SFP_LR 604 status == IXGBE_ERR_I2C ||
610 * 3 SFP_DA_CORE0 - 82599-specific 605 status == IXGBE_ERR_SFP_NOT_PRESENT)
611 * 4 SFP_DA_CORE1 - 82599-specific 606 goto err_read_i2c_eeprom;
612 * 5 SFP_SR/LR_CORE0 - 82599-specific 607
613 * 6 SFP_SR/LR_CORE1 - 82599-specific 608 status = hw->phy.ops.read_i2c_eeprom(hw,
614 * 7 SFP_act_lmt_DA_CORE0 - 82599-specific 609 IXGBE_SFF_10GBE_COMP_CODES,
615 * 8 SFP_act_lmt_DA_CORE1 - 82599-specific 610 &comp_codes_10g);
616 * 9 SFP_1g_cu_CORE0 - 82599-specific 611
617 * 10 SFP_1g_cu_CORE1 - 82599-specific 612 if (status == IXGBE_ERR_SWFW_SYNC ||
618 */ 613 status == IXGBE_ERR_I2C ||
614 status == IXGBE_ERR_SFP_NOT_PRESENT)
615 goto err_read_i2c_eeprom;
616 status = hw->phy.ops.read_i2c_eeprom(hw,
617 IXGBE_SFF_CABLE_TECHNOLOGY,
618 &cable_tech);
619
620 if (status == IXGBE_ERR_SWFW_SYNC ||
621 status == IXGBE_ERR_I2C ||
622 status == IXGBE_ERR_SFP_NOT_PRESENT)
623 goto err_read_i2c_eeprom;
624
625 /* ID Module
626 * =========
627 * 0 SFP_DA_CU
628 * 1 SFP_SR
629 * 2 SFP_LR
630 * 3 SFP_DA_CORE0 - 82599-specific
631 * 4 SFP_DA_CORE1 - 82599-specific
632 * 5 SFP_SR/LR_CORE0 - 82599-specific
633 * 6 SFP_SR/LR_CORE1 - 82599-specific
634 * 7 SFP_act_lmt_DA_CORE0 - 82599-specific
635 * 8 SFP_act_lmt_DA_CORE1 - 82599-specific
636 * 9 SFP_1g_cu_CORE0 - 82599-specific
637 * 10 SFP_1g_cu_CORE1 - 82599-specific
638 */
619 if (hw->mac.type == ixgbe_mac_82598EB) { 639 if (hw->mac.type == ixgbe_mac_82598EB) {
620 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) 640 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
621 hw->phy.sfp_type = ixgbe_sfp_type_da_cu; 641 hw->phy.sfp_type = ixgbe_sfp_type_da_cu;
@@ -647,31 +667,27 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
647 ixgbe_sfp_type_da_act_lmt_core1; 667 ixgbe_sfp_type_da_act_lmt_core1;
648 } else { 668 } else {
649 hw->phy.sfp_type = 669 hw->phy.sfp_type =
650 ixgbe_sfp_type_unknown; 670 ixgbe_sfp_type_unknown;
651 } 671 }
652 } else if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE) 672 } else if (comp_codes_10g &
653 if (hw->bus.lan_id == 0) 673 (IXGBE_SFF_10GBASESR_CAPABLE |
654 hw->phy.sfp_type = 674 IXGBE_SFF_10GBASELR_CAPABLE)) {
655 ixgbe_sfp_type_srlr_core0;
656 else
657 hw->phy.sfp_type =
658 ixgbe_sfp_type_srlr_core1;
659 else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE)
660 if (hw->bus.lan_id == 0) 675 if (hw->bus.lan_id == 0)
661 hw->phy.sfp_type = 676 hw->phy.sfp_type =
662 ixgbe_sfp_type_srlr_core0; 677 ixgbe_sfp_type_srlr_core0;
663 else 678 else
664 hw->phy.sfp_type = 679 hw->phy.sfp_type =
665 ixgbe_sfp_type_srlr_core1; 680 ixgbe_sfp_type_srlr_core1;
666 else if (comp_codes_1g & IXGBE_SFF_1GBASET_CAPABLE) 681 } else if (comp_codes_1g & IXGBE_SFF_1GBASET_CAPABLE) {
667 if (hw->bus.lan_id == 0) 682 if (hw->bus.lan_id == 0)
668 hw->phy.sfp_type = 683 hw->phy.sfp_type =
669 ixgbe_sfp_type_1g_cu_core0; 684 ixgbe_sfp_type_1g_cu_core0;
670 else 685 else
671 hw->phy.sfp_type = 686 hw->phy.sfp_type =
672 ixgbe_sfp_type_1g_cu_core1; 687 ixgbe_sfp_type_1g_cu_core1;
673 else 688 } else {
674 hw->phy.sfp_type = ixgbe_sfp_type_unknown; 689 hw->phy.sfp_type = ixgbe_sfp_type_unknown;
690 }
675 } 691 }
676 692
677 if (hw->phy.sfp_type != stored_sfp_type) 693 if (hw->phy.sfp_type != stored_sfp_type)
@@ -688,16 +704,33 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
688 /* Determine PHY vendor */ 704 /* Determine PHY vendor */
689 if (hw->phy.type != ixgbe_phy_nl) { 705 if (hw->phy.type != ixgbe_phy_nl) {
690 hw->phy.id = identifier; 706 hw->phy.id = identifier;
691 hw->phy.ops.read_i2c_eeprom(hw, 707 status = hw->phy.ops.read_i2c_eeprom(hw,
692 IXGBE_SFF_VENDOR_OUI_BYTE0, 708 IXGBE_SFF_VENDOR_OUI_BYTE0,
693 &oui_bytes[0]); 709 &oui_bytes[0]);
694 hw->phy.ops.read_i2c_eeprom(hw, 710
711 if (status == IXGBE_ERR_SWFW_SYNC ||
712 status == IXGBE_ERR_I2C ||
713 status == IXGBE_ERR_SFP_NOT_PRESENT)
714 goto err_read_i2c_eeprom;
715
716 status = hw->phy.ops.read_i2c_eeprom(hw,
695 IXGBE_SFF_VENDOR_OUI_BYTE1, 717 IXGBE_SFF_VENDOR_OUI_BYTE1,
696 &oui_bytes[1]); 718 &oui_bytes[1]);
697 hw->phy.ops.read_i2c_eeprom(hw, 719
720 if (status == IXGBE_ERR_SWFW_SYNC ||
721 status == IXGBE_ERR_I2C ||
722 status == IXGBE_ERR_SFP_NOT_PRESENT)
723 goto err_read_i2c_eeprom;
724
725 status = hw->phy.ops.read_i2c_eeprom(hw,
698 IXGBE_SFF_VENDOR_OUI_BYTE2, 726 IXGBE_SFF_VENDOR_OUI_BYTE2,
699 &oui_bytes[2]); 727 &oui_bytes[2]);
700 728
729 if (status == IXGBE_ERR_SWFW_SYNC ||
730 status == IXGBE_ERR_I2C ||
731 status == IXGBE_ERR_SFP_NOT_PRESENT)
732 goto err_read_i2c_eeprom;
733
701 vendor_oui = 734 vendor_oui =
702 ((oui_bytes[0] << IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT) | 735 ((oui_bytes[0] << IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT) |
703 (oui_bytes[1] << IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT) | 736 (oui_bytes[1] << IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT) |
@@ -707,7 +740,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
707 case IXGBE_SFF_VENDOR_OUI_TYCO: 740 case IXGBE_SFF_VENDOR_OUI_TYCO:
708 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) 741 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
709 hw->phy.type = 742 hw->phy.type =
710 ixgbe_phy_sfp_passive_tyco; 743 ixgbe_phy_sfp_passive_tyco;
711 break; 744 break;
712 case IXGBE_SFF_VENDOR_OUI_FTL: 745 case IXGBE_SFF_VENDOR_OUI_FTL:
713 if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE) 746 if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE)
@@ -724,7 +757,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
724 default: 757 default:
725 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) 758 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
726 hw->phy.type = 759 hw->phy.type =
727 ixgbe_phy_sfp_passive_unknown; 760 ixgbe_phy_sfp_passive_unknown;
728 else if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE) 761 else if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE)
729 hw->phy.type = 762 hw->phy.type =
730 ixgbe_phy_sfp_active_unknown; 763 ixgbe_phy_sfp_active_unknown;
@@ -734,7 +767,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
734 } 767 }
735 } 768 }
736 769
737 /* All passive DA cables are supported */ 770 /* Allow any DA cable vendor */
738 if (cable_tech & (IXGBE_SFF_DA_PASSIVE_CABLE | 771 if (cable_tech & (IXGBE_SFF_DA_PASSIVE_CABLE |
739 IXGBE_SFF_DA_ACTIVE_CABLE)) { 772 IXGBE_SFF_DA_ACTIVE_CABLE)) {
740 status = 0; 773 status = 0;
@@ -776,12 +809,18 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
776 809
777out: 810out:
778 return status; 811 return status;
812
813err_read_i2c_eeprom:
814 hw->phy.sfp_type = ixgbe_sfp_type_not_present;
815 if (hw->phy.type != ixgbe_phy_nl) {
816 hw->phy.id = 0;
817 hw->phy.type = ixgbe_phy_unknown;
818 }
819 return IXGBE_ERR_SFP_NOT_PRESENT;
779} 820}
780 821
781/** 822/**
782 * ixgbe_get_sfp_init_sequence_offsets - Checks the MAC's EEPROM to see 823 * ixgbe_get_sfp_init_sequence_offsets - Provides offset of PHY init sequence
783 * if it supports a given SFP+ module type, if so it returns the offsets to the
784 * phy init sequence block.
785 * @hw: pointer to hardware structure 824 * @hw: pointer to hardware structure
786 * @list_offset: offset to the SFP ID list 825 * @list_offset: offset to the SFP ID list
787 * @data_offset: offset to the SFP data block 826 * @data_offset: offset to the SFP data block