Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

e1000e: enable forced master/slave on 82577

Like other supported (igp) PHYs, the driver needs to be able to force the
master/slave mode on 82577. Since the code is the same as what already
exists in the code flow for igp PHYs, move it to a new function to be
called for both flows.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

authored by

Bruce Allan and committed by
Jeff Kirsher
7b9f7e35 bd14b1b2

+45 -26
+45 -26
drivers/net/ethernet/intel/e1000e/phy.c
··· 639 639 } 640 640 641 641 /** 642 + * e1000_set_master_slave_mode - Setup PHY for Master/slave mode 643 + * @hw: pointer to the HW structure 644 + * 645 + * Sets up Master/slave mode 646 + **/ 647 + static s32 e1000_set_master_slave_mode(struct e1000_hw *hw) 648 + { 649 + s32 ret_val; 650 + u16 phy_data; 651 + 652 + /* Resolve Master/Slave mode */ 653 + ret_val = e1e_rphy(hw, PHY_1000T_CTRL, &phy_data); 654 + if (ret_val) 655 + return ret_val; 656 + 657 + /* load defaults for future use */ 658 + hw->phy.original_ms_type = (phy_data & CR_1000T_MS_ENABLE) ? 659 + ((phy_data & CR_1000T_MS_VALUE) ? 660 + e1000_ms_force_master : e1000_ms_force_slave) : e1000_ms_auto; 661 + 662 + switch (hw->phy.ms_type) { 663 + case e1000_ms_force_master: 664 + phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); 665 + break; 666 + case e1000_ms_force_slave: 667 + phy_data |= CR_1000T_MS_ENABLE; 668 + phy_data &= ~(CR_1000T_MS_VALUE); 669 + break; 670 + case e1000_ms_auto: 671 + phy_data &= ~CR_1000T_MS_ENABLE; 672 + /* fall-through */ 673 + default: 674 + break; 675 + } 676 + 677 + return e1e_wphy(hw, PHY_1000T_CTRL, phy_data); 678 + } 679 + 680 + /** 642 681 * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link 643 682 * @hw: pointer to the HW structure 644 683 * ··· 698 659 /* Enable downshift */ 699 660 phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; 700 661 701 - return e1e_wphy(hw, I82577_CFG_REG, phy_data); 662 + ret_val = e1e_wphy(hw, I82577_CFG_REG, phy_data); 663 + if (ret_val) 664 + return ret_val; 665 + 666 + return e1000_set_master_slave_mode(hw); 702 667 } 703 668 704 669 /** ··· 938 895 return ret_val; 939 896 } 940 897 941 - ret_val = e1e_rphy(hw, PHY_1000T_CTRL, &data); 942 - if (ret_val) 943 - return ret_val; 944 - 945 - /* load defaults for future use */ 946 - phy->original_ms_type = (data & CR_1000T_MS_ENABLE) ? 947 - ((data & CR_1000T_MS_VALUE) ? 948 - e1000_ms_force_master : 949 - e1000_ms_force_slave) : 950 - e1000_ms_auto; 951 - 952 - switch (phy->ms_type) { 953 - case e1000_ms_force_master: 954 - data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); 955 - break; 956 - case e1000_ms_force_slave: 957 - data |= CR_1000T_MS_ENABLE; 958 - data &= ~(CR_1000T_MS_VALUE); 959 - break; 960 - case e1000_ms_auto: 961 - data &= ~CR_1000T_MS_ENABLE; 962 - default: 963 - break; 964 - } 965 - ret_val = e1e_wphy(hw, PHY_1000T_CTRL, data); 898 + ret_val = e1000_set_master_slave_mode(hw); 966 899 } 967 900 968 901 return ret_val;