1*8467fefbSmsaitoh /* $NetBSD: ixgbe_phy.h,v 1.13 2021/12/24 05:02:11 msaitoh Exp $ */ 2dc7f84c8Smsaitoh 397579f7aSdyoung /****************************************************************************** 433b57eccSmsaitoh SPDX-License-Identifier: BSD-3-Clause 597579f7aSdyoung 6*8467fefbSmsaitoh Copyright (c) 2001-2020, Intel Corporation 797579f7aSdyoung All rights reserved. 897579f7aSdyoung 997579f7aSdyoung Redistribution and use in source and binary forms, with or without 1097579f7aSdyoung modification, are permitted provided that the following conditions are met: 1197579f7aSdyoung 1297579f7aSdyoung 1. Redistributions of source code must retain the above copyright notice, 1397579f7aSdyoung this list of conditions and the following disclaimer. 1497579f7aSdyoung 1597579f7aSdyoung 2. Redistributions in binary form must reproduce the above copyright 1697579f7aSdyoung notice, this list of conditions and the following disclaimer in the 1797579f7aSdyoung documentation and/or other materials provided with the distribution. 1897579f7aSdyoung 1997579f7aSdyoung 3. Neither the name of the Intel Corporation nor the names of its 2097579f7aSdyoung contributors may be used to endorse or promote products derived from 2197579f7aSdyoung this software without specific prior written permission. 2297579f7aSdyoung 2397579f7aSdyoung THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2497579f7aSdyoung AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2597579f7aSdyoung IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2697579f7aSdyoung ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2797579f7aSdyoung LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2897579f7aSdyoung CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2997579f7aSdyoung SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3097579f7aSdyoung INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3197579f7aSdyoung CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3297579f7aSdyoung ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3397579f7aSdyoung POSSIBILITY OF SUCH DAMAGE. 3497579f7aSdyoung 3597579f7aSdyoung ******************************************************************************/ 36a06ca633Smsaitoh /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_phy.h 326022 2017-11-20 19:36:21Z pfg $*/ 3797579f7aSdyoung 3897579f7aSdyoung #ifndef _IXGBE_PHY_H_ 3997579f7aSdyoung #define _IXGBE_PHY_H_ 4097579f7aSdyoung 4197579f7aSdyoung #include "ixgbe_type.h" 4297579f7aSdyoung #define IXGBE_I2C_EEPROM_DEV_ADDR 0xA0 43da07f8e1Smsaitoh #define IXGBE_I2C_EEPROM_DEV_ADDR2 0xA2 44da07f8e1Smsaitoh #define IXGBE_I2C_EEPROM_BANK_LEN 0xFF 4597579f7aSdyoung 4697579f7aSdyoung /* EEPROM byte offsets */ 4797579f7aSdyoung #define IXGBE_SFF_IDENTIFIER 0x0 4897579f7aSdyoung #define IXGBE_SFF_IDENTIFIER_SFP 0x3 4997579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_BYTE0 0x25 5097579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_BYTE1 0x26 5197579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_BYTE2 0x27 5297579f7aSdyoung #define IXGBE_SFF_1GBE_COMP_CODES 0x6 5397579f7aSdyoung #define IXGBE_SFF_10GBE_COMP_CODES 0x3 5497579f7aSdyoung #define IXGBE_SFF_CABLE_TECHNOLOGY 0x8 5597579f7aSdyoung #define IXGBE_SFF_CABLE_SPEC_COMP 0x3C 56da07f8e1Smsaitoh #define IXGBE_SFF_SFF_8472_SWAP 0x5C 57da07f8e1Smsaitoh #define IXGBE_SFF_SFF_8472_COMP 0x5E 58da07f8e1Smsaitoh #define IXGBE_SFF_SFF_8472_OSCB 0x6E 59da07f8e1Smsaitoh #define IXGBE_SFF_SFF_8472_ESCB 0x76 60d241219aSmsaitoh #define IXGBE_SFF_IDENTIFIER_QSFP_PLUS 0xD 61d241219aSmsaitoh #define IXGBE_SFF_QSFP_VENDOR_OUI_BYTE0 0xA5 62d241219aSmsaitoh #define IXGBE_SFF_QSFP_VENDOR_OUI_BYTE1 0xA6 63d241219aSmsaitoh #define IXGBE_SFF_QSFP_VENDOR_OUI_BYTE2 0xA7 64d241219aSmsaitoh #define IXGBE_SFF_QSFP_CONNECTOR 0x82 65d241219aSmsaitoh #define IXGBE_SFF_QSFP_10GBE_COMP 0x83 66d241219aSmsaitoh #define IXGBE_SFF_QSFP_1GBE_COMP 0x86 67d241219aSmsaitoh #define IXGBE_SFF_QSFP_CABLE_LENGTH 0x92 68d241219aSmsaitoh #define IXGBE_SFF_QSFP_DEVICE_TECH 0x93 6997579f7aSdyoung 7097579f7aSdyoung /* Bitmasks */ 7197579f7aSdyoung #define IXGBE_SFF_DA_PASSIVE_CABLE 0x4 7297579f7aSdyoung #define IXGBE_SFF_DA_ACTIVE_CABLE 0x8 7397579f7aSdyoung #define IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4 7497579f7aSdyoung #define IXGBE_SFF_1GBASESX_CAPABLE 0x1 7597579f7aSdyoung #define IXGBE_SFF_1GBASELX_CAPABLE 0x2 7697579f7aSdyoung #define IXGBE_SFF_1GBASET_CAPABLE 0x8 7797579f7aSdyoung #define IXGBE_SFF_10GBASESR_CAPABLE 0x10 7897579f7aSdyoung #define IXGBE_SFF_10GBASELR_CAPABLE 0x20 79da07f8e1Smsaitoh #define IXGBE_SFF_SOFT_RS_SELECT_MASK 0x8 80da07f8e1Smsaitoh #define IXGBE_SFF_SOFT_RS_SELECT_10G 0x8 81da07f8e1Smsaitoh #define IXGBE_SFF_SOFT_RS_SELECT_1G 0x0 82d241219aSmsaitoh #define IXGBE_SFF_ADDRESSING_MODE 0x4 83d241219aSmsaitoh #define IXGBE_SFF_QSFP_DA_ACTIVE_CABLE 0x1 84d241219aSmsaitoh #define IXGBE_SFF_QSFP_DA_PASSIVE_CABLE 0x8 85d241219aSmsaitoh #define IXGBE_SFF_QSFP_CONNECTOR_NOT_SEPARABLE 0x23 86d241219aSmsaitoh #define IXGBE_SFF_QSFP_TRANSMITER_850NM_VCSEL 0x0 8797579f7aSdyoung #define IXGBE_I2C_EEPROM_READ_MASK 0x100 8897579f7aSdyoung #define IXGBE_I2C_EEPROM_STATUS_MASK 0x3 8997579f7aSdyoung #define IXGBE_I2C_EEPROM_STATUS_NO_OPERATION 0x0 9097579f7aSdyoung #define IXGBE_I2C_EEPROM_STATUS_PASS 0x1 9197579f7aSdyoung #define IXGBE_I2C_EEPROM_STATUS_FAIL 0x2 9297579f7aSdyoung #define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 9397579f7aSdyoung 94d241219aSmsaitoh #define IXGBE_CS4227 0xBE /* CS4227 address */ 951f093dd9Smsaitoh #define IXGBE_CS4227_GLOBAL_ID_LSB 0 96dc7f84c8Smsaitoh #define IXGBE_CS4227_GLOBAL_ID_MSB 1 971f093dd9Smsaitoh #define IXGBE_CS4227_SCRATCH 2 981f093dd9Smsaitoh #define IXGBE_CS4227_GLOBAL_ID_VALUE 0x03E5 99dc7f84c8Smsaitoh #define IXGBE_CS4227_EFUSE_PDF_SKU 0x19F 100dc7f84c8Smsaitoh #define IXGBE_CS4223_SKU_ID 0x0010 /* Quad port */ 101dc7f84c8Smsaitoh #define IXGBE_CS4227_SKU_ID 0x0014 /* Dual port */ 1021160ab79Smsaitoh #define IXGBE_CS4227_RESET_PENDING 0x1357 1031160ab79Smsaitoh #define IXGBE_CS4227_RESET_COMPLETE 0x5AA5 1041160ab79Smsaitoh #define IXGBE_CS4227_RETRIES 15 1051160ab79Smsaitoh #define IXGBE_CS4227_EFUSE_STATUS 0x0181 1061f093dd9Smsaitoh #define IXGBE_CS4227_LINE_SPARE22_MSB 0x12AD /* Reg to program speed */ 1071f093dd9Smsaitoh #define IXGBE_CS4227_LINE_SPARE24_LSB 0x12B0 /* Reg to program EDC */ 1081f093dd9Smsaitoh #define IXGBE_CS4227_HOST_SPARE22_MSB 0x1AAD /* Reg to program speed */ 1091f093dd9Smsaitoh #define IXGBE_CS4227_HOST_SPARE24_LSB 0x1AB0 /* Reg to program EDC */ 1101160ab79Smsaitoh #define IXGBE_CS4227_EEPROM_STATUS 0x5001 1111160ab79Smsaitoh #define IXGBE_CS4227_EEPROM_LOAD_OK 0x0001 1121160ab79Smsaitoh #define IXGBE_CS4227_SPEED_1G 0x8000 1131160ab79Smsaitoh #define IXGBE_CS4227_SPEED_10G 0 114d241219aSmsaitoh #define IXGBE_CS4227_EDC_MODE_CX1 0x0002 115d241219aSmsaitoh #define IXGBE_CS4227_EDC_MODE_SR 0x0004 1161160ab79Smsaitoh #define IXGBE_CS4227_EDC_MODE_DIAG 0x0008 1171f093dd9Smsaitoh #define IXGBE_CS4227_RESET_HOLD 500 /* microseconds */ 1181160ab79Smsaitoh #define IXGBE_CS4227_RESET_DELAY 450 /* milliseconds */ 1191f093dd9Smsaitoh #define IXGBE_CS4227_CHECK_DELAY 30 /* milliseconds */ 1201f093dd9Smsaitoh #define IXGBE_PE 0xE0 /* Port expander address */ 1211f093dd9Smsaitoh #define IXGBE_PE_OUTPUT 1 /* Output register offset */ 1221f093dd9Smsaitoh #define IXGBE_PE_CONFIG 3 /* Config register offset */ 1231f093dd9Smsaitoh #define IXGBE_PE_BIT1 (1 << 1) 124d241219aSmsaitoh 12597579f7aSdyoung /* Flow control defines */ 12697579f7aSdyoung #define IXGBE_TAF_SYM_PAUSE 0x400 12797579f7aSdyoung #define IXGBE_TAF_ASM_PAUSE 0x800 12897579f7aSdyoung 12997579f7aSdyoung /* Bit-shift macros */ 13097579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT 24 13197579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT 16 13297579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_BYTE2_SHIFT 8 13397579f7aSdyoung 13497579f7aSdyoung /* Vendor OUIs: format of OUI is 0x[byte0][byte1][byte2][00] */ 13597579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_TYCO 0x00407600 13697579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_FTL 0x00906500 13797579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_AVAGO 0x00176A00 13897579f7aSdyoung #define IXGBE_SFF_VENDOR_OUI_INTEL 0x001B2100 13997579f7aSdyoung 14097579f7aSdyoung /* I2C SDA and SCL timing parameters for standard mode */ 14197579f7aSdyoung #define IXGBE_I2C_T_HD_STA 4 14297579f7aSdyoung #define IXGBE_I2C_T_LOW 5 14397579f7aSdyoung #define IXGBE_I2C_T_HIGH 4 14497579f7aSdyoung #define IXGBE_I2C_T_SU_STA 5 14597579f7aSdyoung #define IXGBE_I2C_T_HD_DATA 5 14697579f7aSdyoung #define IXGBE_I2C_T_SU_DATA 1 14797579f7aSdyoung #define IXGBE_I2C_T_RISE 1 14897579f7aSdyoung #define IXGBE_I2C_T_FALL 1 14997579f7aSdyoung #define IXGBE_I2C_T_SU_STO 4 15097579f7aSdyoung #define IXGBE_I2C_T_BUF 5 15197579f7aSdyoung 152d241219aSmsaitoh #ifndef IXGBE_SFP_DETECT_RETRIES 153d241219aSmsaitoh #define IXGBE_SFP_DETECT_RETRIES 10 154d241219aSmsaitoh 155d241219aSmsaitoh #endif /* IXGBE_SFP_DETECT_RETRIES */ 15697579f7aSdyoung #define IXGBE_TN_LASI_STATUS_REG 0x9005 15797579f7aSdyoung #define IXGBE_TN_LASI_STATUS_TEMP_ALARM 0x0008 15897579f7aSdyoung 159da07f8e1Smsaitoh /* SFP+ SFF-8472 Compliance */ 160da07f8e1Smsaitoh #define IXGBE_SFF_SFF_8472_UNSUP 0x00 161da07f8e1Smsaitoh 16297579f7aSdyoung s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw); 16397579f7aSdyoung bool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, u32 phy_addr); 16497579f7aSdyoung enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id); 16597579f7aSdyoung s32 ixgbe_get_phy_id(struct ixgbe_hw *hw); 16697579f7aSdyoung s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw); 16797579f7aSdyoung s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw); 168619731adSmsaitoh s32 ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, 169619731adSmsaitoh u16 *phy_data); 170619731adSmsaitoh s32 ixgbe_write_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, 171619731adSmsaitoh u16 phy_data); 17297579f7aSdyoung s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, 17397579f7aSdyoung u32 device_type, u16 *phy_data); 17497579f7aSdyoung s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, 17597579f7aSdyoung u32 device_type, u16 phy_data); 17697579f7aSdyoung s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw); 17797579f7aSdyoung s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw, 17897579f7aSdyoung ixgbe_link_speed speed, 17997579f7aSdyoung bool autoneg_wait_to_complete); 18097579f7aSdyoung s32 ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw, 18197579f7aSdyoung ixgbe_link_speed *speed, 18297579f7aSdyoung bool *autoneg); 183d241219aSmsaitoh s32 ixgbe_check_reset_blocked(struct ixgbe_hw *hw); 18497579f7aSdyoung 18597579f7aSdyoung /* PHY specific */ 18697579f7aSdyoung s32 ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw, 18797579f7aSdyoung ixgbe_link_speed *speed, 18897579f7aSdyoung bool *link_up); 18997579f7aSdyoung s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw); 19097579f7aSdyoung s32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw, 19197579f7aSdyoung u16 *firmware_version); 19297579f7aSdyoung s32 ixgbe_get_phy_firmware_version_generic(struct ixgbe_hw *hw, 19397579f7aSdyoung u16 *firmware_version); 19497579f7aSdyoung 19597579f7aSdyoung s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw); 196d241219aSmsaitoh s32 ixgbe_set_copper_phy_power(struct ixgbe_hw *hw, bool on); 197167aba13Smsaitoh bool ixgbe_sfp_cage_full(struct ixgbe_hw *hw); 19882022b9dSmsaitoh s32 ixgbe_identify_module_generic(struct ixgbe_hw *hw); 19997579f7aSdyoung s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw); 200dc7f84c8Smsaitoh u64 ixgbe_get_supported_phy_sfp_layer_generic(struct ixgbe_hw *hw); 201d241219aSmsaitoh s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw); 20297579f7aSdyoung s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, 20397579f7aSdyoung u16 *list_offset, 20497579f7aSdyoung u16 *data_offset); 20597579f7aSdyoung s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw); 20697579f7aSdyoung s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, 20797579f7aSdyoung u8 dev_addr, u8 *data); 2081f093dd9Smsaitoh s32 ixgbe_read_i2c_byte_generic_unlocked(struct ixgbe_hw *hw, u8 byte_offset, 2091f093dd9Smsaitoh u8 dev_addr, u8 *data); 21097579f7aSdyoung s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, 21197579f7aSdyoung u8 dev_addr, u8 data); 2121f093dd9Smsaitoh s32 ixgbe_write_i2c_byte_generic_unlocked(struct ixgbe_hw *hw, u8 byte_offset, 2131f093dd9Smsaitoh u8 dev_addr, u8 data); 21497579f7aSdyoung s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, 21597579f7aSdyoung u8 *eeprom_data); 21697579f7aSdyoung s32 ixgbe_write_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, 21797579f7aSdyoung u8 eeprom_data); 21882022b9dSmsaitoh void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw); 219dc7f84c8Smsaitoh s32 ixgbe_read_i2c_combined_generic_int(struct ixgbe_hw *, u8 addr, u16 reg, 220dc7f84c8Smsaitoh u16 *val, bool lock); 221dc7f84c8Smsaitoh s32 ixgbe_write_i2c_combined_generic_int(struct ixgbe_hw *, u8 addr, u16 reg, 222dc7f84c8Smsaitoh u16 val, bool lock); 22397579f7aSdyoung #endif /* _IXGBE_PHY_H_ */ 224