00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 FILE_LICENCE ( GPL2_OR_LATER );
00030
00031 #ifndef _E1000E_PHY_H_
00032 #define _E1000E_PHY_H_
00033
00034 void e1000e_init_phy_ops_generic(struct e1000_hw *hw);
00035 s32 e1000e_check_downshift(struct e1000_hw *hw);
00036 s32 e1000e_check_polarity_m88(struct e1000_hw *hw);
00037 s32 e1000e_check_polarity_igp(struct e1000_hw *hw);
00038 s32 e1000e_check_polarity_ife(struct e1000_hw *hw);
00039 s32 e1000e_check_reset_block_generic(struct e1000_hw *hw);
00040 s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw);
00041 s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw);
00042 #if 0
00043 s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw);
00044 s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw);
00045 s32 e1000e_phy_force_speed_duplex_ife(struct e1000_hw *hw);
00046 #endif
00047 #if 0
00048 s32 e1000e_get_cable_length_m88(struct e1000_hw *hw);
00049 s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw);
00050 #endif
00051 s32 e1000e_get_cfg_done(struct e1000_hw *hw);
00052 s32 e1000e_get_phy_id(struct e1000_hw *hw);
00053 s32 e1000e_get_phy_info_igp(struct e1000_hw *hw);
00054 s32 e1000e_get_phy_info_m88(struct e1000_hw *hw);
00055 s32 e1000e_phy_sw_reset(struct e1000_hw *hw);
00056 #if 0
00057 void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
00058 #endif
00059 s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw);
00060 s32 e1000e_phy_reset_dsp(struct e1000_hw *hw);
00061 s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
00062 s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data);
00063 s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
00064 s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data);
00065 s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data);
00066 s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active);
00067 s32 e1000e_setup_copper_link(struct e1000_hw *hw);
00068 s32 e1000e_wait_autoneg(struct e1000_hw *hw);
00069 s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
00070 s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data);
00071 s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data);
00072 s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data);
00073 s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data);
00074 s32 e1000e_phy_reset_dsp(struct e1000_hw *hw);
00075 s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
00076 u32 usec_interval, bool *success);
00077 s32 e1000e_phy_init_script_igp3(struct e1000_hw *hw);
00078 enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id);
00079 s32 e1000e_determine_phy_address(struct e1000_hw *hw);
00080 s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data);
00081 s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data);
00082 s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data);
00083 s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data);
00084 void e1000e_power_up_phy_copper(struct e1000_hw *hw);
00085 void e1000e_power_down_phy_copper(struct e1000_hw *hw);
00086 s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data);
00087 s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data);
00088 s32 e1000e_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data);
00089 s32 e1000e_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data);
00090 s32 e1000e_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data);
00091 s32 e1000e_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data);
00092 s32 e1000e_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow);
00093 s32 e1000e_link_stall_workaround_hv(struct e1000_hw *hw);
00094 s32 e1000e_copper_link_setup_82577(struct e1000_hw *hw);
00095 s32 e1000e_check_polarity_82577(struct e1000_hw *hw);
00096 s32 e1000e_get_phy_info_82577(struct e1000_hw *hw);
00097 #if 0
00098 s32 e1000e_phy_force_speed_duplex_82577(struct e1000_hw *hw);
00099 #endif
00100 #if 0
00101 s32 e1000e_get_cable_length_82577(struct e1000_hw *hw);
00102 #endif
00103
00104 #define E1000_MAX_PHY_ADDR 4
00105
00106
00107 #define IGP01E1000_PHY_PORT_CONFIG 0x10
00108 #define IGP01E1000_PHY_PORT_STATUS 0x11
00109 #define IGP01E1000_PHY_PORT_CTRL 0x12
00110 #define IGP01E1000_PHY_LINK_HEALTH 0x13
00111 #define IGP01E1000_GMII_FIFO 0x14
00112 #define IGP01E1000_PHY_CHANNEL_QUALITY 0x15
00113 #define IGP02E1000_PHY_POWER_MGMT 0x19
00114 #define IGP01E1000_PHY_PAGE_SELECT 0x1F
00115 #define BM_PHY_PAGE_SELECT 22
00116 #define IGP_PAGE_SHIFT 5
00117 #define PHY_REG_MASK 0x1F
00118
00119
00120 #define BM_PORT_CTRL_PAGE 769
00121 #define BM_PCIE_PAGE 770
00122 #define BM_WUC_PAGE 800
00123 #define BM_WUC_ADDRESS_OPCODE 0x11
00124 #define BM_WUC_DATA_OPCODE 0x12
00125 #define BM_WUC_ENABLE_PAGE BM_PORT_CTRL_PAGE
00126 #define BM_WUC_ENABLE_REG 17
00127 #define BM_WUC_ENABLE_BIT (1 << 2)
00128 #define BM_WUC_HOST_WU_BIT (1 << 4)
00129
00130 #define PHY_UPPER_SHIFT 21
00131 #define BM_PHY_REG(page, reg) \
00132 (((reg) & MAX_PHY_REG_ADDRESS) |\
00133 (((page) & 0xFFFF) << PHY_PAGE_SHIFT) |\
00134 (((reg) & ~MAX_PHY_REG_ADDRESS) << (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT)))
00135 #define BM_PHY_REG_PAGE(offset) \
00136 ((u16)(((offset) >> PHY_PAGE_SHIFT) & 0xFFFF))
00137 #define BM_PHY_REG_NUM(offset) \
00138 ((u16)(((offset) & MAX_PHY_REG_ADDRESS) |\
00139 (((offset) >> (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT)) &\
00140 ~MAX_PHY_REG_ADDRESS)))
00141
00142 #define HV_INTC_FC_PAGE_START 768
00143 #define I82578_ADDR_REG 29
00144 #define I82577_ADDR_REG 16
00145 #define I82577_CFG_REG 22
00146 #define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15)
00147 #define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10)
00148 #define I82577_CTRL_REG 23
00149
00150
00151 #define I82577_PHY_CTRL_2 18
00152 #define I82577_PHY_LBK_CTRL 19
00153 #define I82577_PHY_STATUS_2 26
00154 #define I82577_PHY_DIAG_STATUS 31
00155
00156
00157 #define I82577_PHY_STATUS2_REV_POLARITY 0x0400
00158 #define I82577_PHY_STATUS2_MDIX 0x0800
00159 #define I82577_PHY_STATUS2_SPEED_MASK 0x0300
00160 #define I82577_PHY_STATUS2_SPEED_1000MBPS 0x0200
00161 #define I82577_PHY_STATUS2_SPEED_100MBPS 0x0100
00162
00163
00164 #define I82577_PHY_CTRL2_AUTO_MDIX 0x0400
00165 #define I82577_PHY_CTRL2_FORCE_MDI_MDIX 0x0200
00166
00167
00168 #define I82577_DSTATUS_CABLE_LENGTH 0x03FC
00169 #define I82577_DSTATUS_CABLE_LENGTH_SHIFT 2
00170
00171
00172 #define BM_CS_CTRL1 16
00173 #define BM_CS_CTRL1_ENERGY_DETECT 0x0300
00174
00175
00176 #define BM_CS_STATUS 17
00177 #define BM_CS_STATUS_ENERGY_DETECT 0x0010
00178 #define BM_CS_STATUS_LINK_UP 0x0400
00179 #define BM_CS_STATUS_RESOLVED 0x0800
00180 #define BM_CS_STATUS_SPEED_MASK 0xC000
00181 #define BM_CS_STATUS_SPEED_1000 0x8000
00182
00183
00184 #define HV_M_STATUS 26
00185 #define HV_M_STATUS_AUTONEG_COMPLETE 0x1000
00186 #define HV_M_STATUS_SPEED_MASK 0x0300
00187 #define HV_M_STATUS_SPEED_1000 0x0200
00188 #define HV_M_STATUS_LINK_UP 0x0040
00189
00190 #define IGP01E1000_PHY_PCS_INIT_REG 0x00B4
00191 #define IGP01E1000_PHY_POLARITY_MASK 0x0078
00192
00193 #define IGP01E1000_PSCR_AUTO_MDIX 0x1000
00194 #define IGP01E1000_PSCR_FORCE_MDI_MDIX 0x2000
00195
00196 #define IGP01E1000_PSCFR_SMART_SPEED 0x0080
00197
00198
00199 #define IGP01E1000_GMII_FLEX_SPD 0x0010
00200 #define IGP01E1000_GMII_SPD 0x0020
00201
00202 #define IGP02E1000_PM_SPD 0x0001
00203 #define IGP02E1000_PM_D0_LPLU 0x0002
00204 #define IGP02E1000_PM_D3_LPLU 0x0004
00205
00206 #define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000
00207
00208 #define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002
00209 #define IGP01E1000_PSSR_MDIX 0x0800
00210 #define IGP01E1000_PSSR_SPEED_MASK 0xC000
00211 #define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000
00212
00213 #define IGP02E1000_PHY_CHANNEL_NUM 4
00214 #define IGP02E1000_PHY_AGC_A 0x11B1
00215 #define IGP02E1000_PHY_AGC_B 0x12B1
00216 #define IGP02E1000_PHY_AGC_C 0x14B1
00217 #define IGP02E1000_PHY_AGC_D 0x18B1
00218
00219 #define IGP02E1000_AGC_LENGTH_SHIFT 9
00220 #define IGP02E1000_AGC_LENGTH_MASK 0x7F
00221 #define IGP02E1000_AGC_RANGE 15
00222
00223 #define IGP03E1000_PHY_MISC_CTRL 0x1B
00224 #define IGP03E1000_PHY_MISC_DUPLEX_MANUAL_SET 0x1000
00225
00226 #define E1000_CABLE_LENGTH_UNDEFINED 0xFF
00227
00228 #define E1000_KMRNCTRLSTA_OFFSET 0x001F0000
00229 #define E1000_KMRNCTRLSTA_OFFSET_SHIFT 16
00230 #define E1000_KMRNCTRLSTA_REN 0x00200000
00231 #define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3
00232 #define E1000_KMRNCTRLSTA_TIMEOUTS 0x4
00233 #define E1000_KMRNCTRLSTA_INBAND_PARAM 0x9
00234 #define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000
00235 #define E1000_KMRNCTRLSTA_K1_CONFIG 0x7
00236 #define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002
00237
00238 #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10
00239 #define IFE_PHY_SPECIAL_CONTROL 0x11
00240 #define IFE_PHY_SPECIAL_CONTROL_LED 0x1B
00241 #define IFE_PHY_MDIX_CONTROL 0x1C
00242
00243
00244 #define IFE_PESC_POLARITY_REVERSED 0x0100
00245
00246
00247 #define IFE_PSC_AUTO_POLARITY_DISABLE 0x0010
00248 #define IFE_PSC_FORCE_POLARITY 0x0020
00249 #define IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN 0x0100
00250
00251
00252 #define IFE_PSCL_PROBE_MODE 0x0020
00253 #define IFE_PSCL_PROBE_LEDS_OFF 0x0006
00254 #define IFE_PSCL_PROBE_LEDS_ON 0x0007
00255
00256
00257 #define IFE_PMC_MDIX_STATUS 0x0020
00258 #define IFE_PMC_FORCE_MDIX 0x0040
00259 #define IFE_PMC_AUTO_MDIX 0x0080
00260
00261 #endif