xref: /titanic_41/usr/src/uts/common/io/e1000api/e1000_phy.h (revision c6a664189ff58eecb65704097a089f0bb4d35523)
175eba5b6SRobert Mustacchi /******************************************************************************
275eba5b6SRobert Mustacchi 
3*c6a66418SRobert Mustacchi   Copyright (c) 2001-2014, Intel Corporation
475eba5b6SRobert Mustacchi   All rights reserved.
575eba5b6SRobert Mustacchi 
675eba5b6SRobert Mustacchi   Redistribution and use in source and binary forms, with or without
775eba5b6SRobert Mustacchi   modification, are permitted provided that the following conditions are met:
875eba5b6SRobert Mustacchi 
975eba5b6SRobert Mustacchi    1. Redistributions of source code must retain the above copyright notice,
1075eba5b6SRobert Mustacchi       this list of conditions and the following disclaimer.
1175eba5b6SRobert Mustacchi 
1275eba5b6SRobert Mustacchi    2. Redistributions in binary form must reproduce the above copyright
1375eba5b6SRobert Mustacchi       notice, this list of conditions and the following disclaimer in the
1475eba5b6SRobert Mustacchi       documentation and/or other materials provided with the distribution.
1575eba5b6SRobert Mustacchi 
1675eba5b6SRobert Mustacchi    3. Neither the name of the Intel Corporation nor the names of its
1775eba5b6SRobert Mustacchi       contributors may be used to endorse or promote products derived from
1875eba5b6SRobert Mustacchi       this software without specific prior written permission.
1975eba5b6SRobert Mustacchi 
2075eba5b6SRobert Mustacchi   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2175eba5b6SRobert Mustacchi   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2275eba5b6SRobert Mustacchi   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2375eba5b6SRobert Mustacchi   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2475eba5b6SRobert Mustacchi   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2575eba5b6SRobert Mustacchi   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2675eba5b6SRobert Mustacchi   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2775eba5b6SRobert Mustacchi   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2875eba5b6SRobert Mustacchi   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2975eba5b6SRobert Mustacchi   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3075eba5b6SRobert Mustacchi   POSSIBILITY OF SUCH DAMAGE.
3175eba5b6SRobert Mustacchi 
3275eba5b6SRobert Mustacchi ******************************************************************************/
3375eba5b6SRobert Mustacchi /*$FreeBSD$*/
3475eba5b6SRobert Mustacchi 
3575eba5b6SRobert Mustacchi #ifndef _E1000_PHY_H_
3675eba5b6SRobert Mustacchi #define _E1000_PHY_H_
3775eba5b6SRobert Mustacchi 
3875eba5b6SRobert Mustacchi void e1000_init_phy_ops_generic(struct e1000_hw *hw);
3975eba5b6SRobert Mustacchi s32  e1000_null_read_reg(struct e1000_hw *hw, u32 offset, u16 *data);
4075eba5b6SRobert Mustacchi void e1000_null_phy_generic(struct e1000_hw *hw);
4175eba5b6SRobert Mustacchi s32  e1000_null_lplu_state(struct e1000_hw *hw, bool active);
4275eba5b6SRobert Mustacchi s32  e1000_null_write_reg(struct e1000_hw *hw, u32 offset, u16 data);
4375eba5b6SRobert Mustacchi s32  e1000_null_set_page(struct e1000_hw *hw, u16 data);
4475eba5b6SRobert Mustacchi s32 e1000_read_i2c_byte_null(struct e1000_hw *hw, u8 byte_offset,
4575eba5b6SRobert Mustacchi 			     u8 dev_addr, u8 *data);
4675eba5b6SRobert Mustacchi s32 e1000_write_i2c_byte_null(struct e1000_hw *hw, u8 byte_offset,
4775eba5b6SRobert Mustacchi 			      u8 dev_addr, u8 data);
4875eba5b6SRobert Mustacchi s32  e1000_check_downshift_generic(struct e1000_hw *hw);
4975eba5b6SRobert Mustacchi s32  e1000_check_polarity_m88(struct e1000_hw *hw);
5075eba5b6SRobert Mustacchi s32  e1000_check_polarity_igp(struct e1000_hw *hw);
5175eba5b6SRobert Mustacchi s32  e1000_check_polarity_ife(struct e1000_hw *hw);
5275eba5b6SRobert Mustacchi s32  e1000_check_reset_block_generic(struct e1000_hw *hw);
5375eba5b6SRobert Mustacchi s32  e1000_phy_setup_autoneg(struct e1000_hw *hw);
5475eba5b6SRobert Mustacchi s32  e1000_copper_link_autoneg(struct e1000_hw *hw);
5575eba5b6SRobert Mustacchi s32  e1000_copper_link_setup_igp(struct e1000_hw *hw);
5675eba5b6SRobert Mustacchi s32  e1000_copper_link_setup_m88(struct e1000_hw *hw);
5775eba5b6SRobert Mustacchi s32  e1000_copper_link_setup_m88_gen2(struct e1000_hw *hw);
5875eba5b6SRobert Mustacchi s32  e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw);
5975eba5b6SRobert Mustacchi s32  e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw);
6075eba5b6SRobert Mustacchi s32  e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw);
6175eba5b6SRobert Mustacchi s32  e1000_get_cable_length_m88(struct e1000_hw *hw);
6275eba5b6SRobert Mustacchi s32  e1000_get_cable_length_m88_gen2(struct e1000_hw *hw);
6375eba5b6SRobert Mustacchi s32  e1000_get_cable_length_igp_2(struct e1000_hw *hw);
6475eba5b6SRobert Mustacchi s32  e1000_get_cfg_done_generic(struct e1000_hw *hw);
6575eba5b6SRobert Mustacchi s32  e1000_get_phy_id(struct e1000_hw *hw);
6675eba5b6SRobert Mustacchi s32  e1000_get_phy_info_igp(struct e1000_hw *hw);
6775eba5b6SRobert Mustacchi s32  e1000_get_phy_info_m88(struct e1000_hw *hw);
6875eba5b6SRobert Mustacchi s32  e1000_get_phy_info_ife(struct e1000_hw *hw);
6975eba5b6SRobert Mustacchi s32  e1000_phy_sw_reset_generic(struct e1000_hw *hw);
7075eba5b6SRobert Mustacchi void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
7175eba5b6SRobert Mustacchi s32  e1000_phy_hw_reset_generic(struct e1000_hw *hw);
7275eba5b6SRobert Mustacchi s32  e1000_phy_reset_dsp_generic(struct e1000_hw *hw);
7375eba5b6SRobert Mustacchi s32  e1000_read_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 *data);
7475eba5b6SRobert Mustacchi s32  e1000_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data);
7575eba5b6SRobert Mustacchi s32  e1000_set_page_igp(struct e1000_hw *hw, u16 page);
7675eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
7775eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data);
7875eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data);
7975eba5b6SRobert Mustacchi s32  e1000_set_d3_lplu_state_generic(struct e1000_hw *hw, bool active);
8075eba5b6SRobert Mustacchi s32  e1000_setup_copper_link_generic(struct e1000_hw *hw);
8175eba5b6SRobert Mustacchi s32  e1000_write_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 data);
8275eba5b6SRobert Mustacchi s32  e1000_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data);
8375eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data);
8475eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data);
8575eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data);
8675eba5b6SRobert Mustacchi s32  e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
8775eba5b6SRobert Mustacchi 				u32 usec_interval, bool *success);
8875eba5b6SRobert Mustacchi s32  e1000_phy_init_script_igp3(struct e1000_hw *hw);
8975eba5b6SRobert Mustacchi enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id);
9075eba5b6SRobert Mustacchi s32  e1000_determine_phy_address(struct e1000_hw *hw);
9175eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data);
9275eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data);
9375eba5b6SRobert Mustacchi s32  e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg);
9475eba5b6SRobert Mustacchi s32  e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg);
9575eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data);
9675eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data);
9775eba5b6SRobert Mustacchi void e1000_power_up_phy_copper(struct e1000_hw *hw);
9875eba5b6SRobert Mustacchi void e1000_power_down_phy_copper(struct e1000_hw *hw);
9975eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data);
10075eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data);
10175eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data);
10275eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data);
10375eba5b6SRobert Mustacchi s32  e1000_read_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 *data);
10475eba5b6SRobert Mustacchi s32  e1000_write_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 data);
10575eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data);
10675eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data);
10775eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data);
10875eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data);
10975eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data);
11075eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 data);
11175eba5b6SRobert Mustacchi s32  e1000_link_stall_workaround_hv(struct e1000_hw *hw);
11275eba5b6SRobert Mustacchi s32  e1000_copper_link_setup_82577(struct e1000_hw *hw);
11375eba5b6SRobert Mustacchi s32  e1000_check_polarity_82577(struct e1000_hw *hw);
11475eba5b6SRobert Mustacchi s32  e1000_get_phy_info_82577(struct e1000_hw *hw);
11575eba5b6SRobert Mustacchi s32  e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw);
11675eba5b6SRobert Mustacchi s32  e1000_get_cable_length_82577(struct e1000_hw *hw);
11775eba5b6SRobert Mustacchi s32  e1000_write_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 data);
11875eba5b6SRobert Mustacchi s32  e1000_read_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 *data);
119*c6a66418SRobert Mustacchi s32 e1000_read_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 *data);
120*c6a66418SRobert Mustacchi s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data,
121*c6a66418SRobert Mustacchi 			     bool line_override);
122*c6a66418SRobert Mustacchi bool e1000_is_mphy_ready(struct e1000_hw *hw);
12375eba5b6SRobert Mustacchi 
12475eba5b6SRobert Mustacchi #define E1000_MAX_PHY_ADDR		8
12575eba5b6SRobert Mustacchi 
12675eba5b6SRobert Mustacchi /* IGP01E1000 Specific Registers */
12775eba5b6SRobert Mustacchi #define IGP01E1000_PHY_PORT_CONFIG	0x10 /* Port Config */
12875eba5b6SRobert Mustacchi #define IGP01E1000_PHY_PORT_STATUS	0x11 /* Status */
12975eba5b6SRobert Mustacchi #define IGP01E1000_PHY_PORT_CTRL	0x12 /* Control */
13075eba5b6SRobert Mustacchi #define IGP01E1000_PHY_LINK_HEALTH	0x13 /* PHY Link Health */
13175eba5b6SRobert Mustacchi #define IGP01E1000_GMII_FIFO		0x14 /* GMII FIFO */
13275eba5b6SRobert Mustacchi #define IGP02E1000_PHY_POWER_MGMT	0x19 /* Power Management */
13375eba5b6SRobert Mustacchi #define IGP01E1000_PHY_PAGE_SELECT	0x1F /* Page Select */
13475eba5b6SRobert Mustacchi #define BM_PHY_PAGE_SELECT		22   /* Page Select for BM */
13575eba5b6SRobert Mustacchi #define IGP_PAGE_SHIFT			5
13675eba5b6SRobert Mustacchi #define PHY_REG_MASK			0x1F
13775eba5b6SRobert Mustacchi 
13875eba5b6SRobert Mustacchi /* GS40G - I210 PHY defines */
13975eba5b6SRobert Mustacchi #define GS40G_PAGE_SELECT		0x16
14075eba5b6SRobert Mustacchi #define GS40G_PAGE_SHIFT		16
14175eba5b6SRobert Mustacchi #define GS40G_OFFSET_MASK		0xFFFF
14275eba5b6SRobert Mustacchi #define GS40G_PAGE_2			0x20000
14375eba5b6SRobert Mustacchi #define GS40G_MAC_REG2			0x15
14475eba5b6SRobert Mustacchi #define GS40G_MAC_LB			0x4140
14575eba5b6SRobert Mustacchi #define GS40G_MAC_SPEED_1G		0X0006
14675eba5b6SRobert Mustacchi #define GS40G_COPPER_SPEC		0x0010
14775eba5b6SRobert Mustacchi 
14875eba5b6SRobert Mustacchi /* BM/HV Specific Registers */
14975eba5b6SRobert Mustacchi #define BM_PORT_CTRL_PAGE		769
15075eba5b6SRobert Mustacchi #define BM_WUC_PAGE			800
15175eba5b6SRobert Mustacchi #define BM_WUC_ADDRESS_OPCODE		0x11
15275eba5b6SRobert Mustacchi #define BM_WUC_DATA_OPCODE		0x12
15375eba5b6SRobert Mustacchi #define BM_WUC_ENABLE_PAGE		BM_PORT_CTRL_PAGE
15475eba5b6SRobert Mustacchi #define BM_WUC_ENABLE_REG		17
15575eba5b6SRobert Mustacchi #define BM_WUC_ENABLE_BIT		(1 << 2)
15675eba5b6SRobert Mustacchi #define BM_WUC_HOST_WU_BIT		(1 << 4)
15775eba5b6SRobert Mustacchi #define BM_WUC_ME_WU_BIT		(1 << 5)
15875eba5b6SRobert Mustacchi 
15975eba5b6SRobert Mustacchi #define PHY_UPPER_SHIFT			21
16075eba5b6SRobert Mustacchi #define BM_PHY_REG(page, reg) \
16175eba5b6SRobert Mustacchi 	(((reg) & MAX_PHY_REG_ADDRESS) |\
16275eba5b6SRobert Mustacchi 	 (((page) & 0xFFFF) << PHY_PAGE_SHIFT) |\
16375eba5b6SRobert Mustacchi 	 (((reg) & ~MAX_PHY_REG_ADDRESS) << (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT)))
16475eba5b6SRobert Mustacchi #define BM_PHY_REG_PAGE(offset) \
16575eba5b6SRobert Mustacchi 	((u16)(((offset) >> PHY_PAGE_SHIFT) & 0xFFFF))
16675eba5b6SRobert Mustacchi #define BM_PHY_REG_NUM(offset) \
16775eba5b6SRobert Mustacchi 	((u16)(((offset) & MAX_PHY_REG_ADDRESS) |\
16875eba5b6SRobert Mustacchi 	 (((offset) >> (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT)) &\
16975eba5b6SRobert Mustacchi 		~MAX_PHY_REG_ADDRESS)))
17075eba5b6SRobert Mustacchi 
17175eba5b6SRobert Mustacchi #define HV_INTC_FC_PAGE_START		768
17275eba5b6SRobert Mustacchi #define I82578_ADDR_REG			29
17375eba5b6SRobert Mustacchi #define I82577_ADDR_REG			16
17475eba5b6SRobert Mustacchi #define I82577_CFG_REG			22
17575eba5b6SRobert Mustacchi #define I82577_CFG_ASSERT_CRS_ON_TX	(1 << 15)
176*c6a66418SRobert Mustacchi #define I82577_CFG_ENABLE_DOWNSHIFT	(3 << 10) /* auto downshift */
17775eba5b6SRobert Mustacchi #define I82577_CTRL_REG			23
17875eba5b6SRobert Mustacchi 
17975eba5b6SRobert Mustacchi /* 82577 specific PHY registers */
18075eba5b6SRobert Mustacchi #define I82577_PHY_CTRL_2		18
18175eba5b6SRobert Mustacchi #define I82577_PHY_LBK_CTRL		19
18275eba5b6SRobert Mustacchi #define I82577_PHY_STATUS_2		26
18375eba5b6SRobert Mustacchi #define I82577_PHY_DIAG_STATUS		31
18475eba5b6SRobert Mustacchi 
18575eba5b6SRobert Mustacchi /* I82577 PHY Status 2 */
18675eba5b6SRobert Mustacchi #define I82577_PHY_STATUS2_REV_POLARITY		0x0400
18775eba5b6SRobert Mustacchi #define I82577_PHY_STATUS2_MDIX			0x0800
18875eba5b6SRobert Mustacchi #define I82577_PHY_STATUS2_SPEED_MASK		0x0300
18975eba5b6SRobert Mustacchi #define I82577_PHY_STATUS2_SPEED_1000MBPS	0x0200
19075eba5b6SRobert Mustacchi 
19175eba5b6SRobert Mustacchi /* I82577 PHY Control 2 */
19275eba5b6SRobert Mustacchi #define I82577_PHY_CTRL2_MANUAL_MDIX		0x0200
19375eba5b6SRobert Mustacchi #define I82577_PHY_CTRL2_AUTO_MDI_MDIX		0x0400
19475eba5b6SRobert Mustacchi #define I82577_PHY_CTRL2_MDIX_CFG_MASK		0x0600
19575eba5b6SRobert Mustacchi 
19675eba5b6SRobert Mustacchi /* I82577 PHY Diagnostics Status */
19775eba5b6SRobert Mustacchi #define I82577_DSTATUS_CABLE_LENGTH		0x03FC
19875eba5b6SRobert Mustacchi #define I82577_DSTATUS_CABLE_LENGTH_SHIFT	2
19975eba5b6SRobert Mustacchi 
20075eba5b6SRobert Mustacchi /* 82580 PHY Power Management */
20175eba5b6SRobert Mustacchi #define E1000_82580_PHY_POWER_MGMT	0xE14
20275eba5b6SRobert Mustacchi #define E1000_82580_PM_SPD		0x0001 /* Smart Power Down */
20375eba5b6SRobert Mustacchi #define E1000_82580_PM_D0_LPLU		0x0002 /* For D0a states */
20475eba5b6SRobert Mustacchi #define E1000_82580_PM_D3_LPLU		0x0004 /* For all other states */
20575eba5b6SRobert Mustacchi #define E1000_82580_PM_GO_LINKD		0x0020 /* Go Link Disconnect */
20675eba5b6SRobert Mustacchi 
207*c6a66418SRobert Mustacchi #define E1000_MPHY_DIS_ACCESS		0x80000000 /* disable_access bit */
208*c6a66418SRobert Mustacchi #define E1000_MPHY_ENA_ACCESS		0x40000000 /* enable_access bit */
209*c6a66418SRobert Mustacchi #define E1000_MPHY_BUSY			0x00010000 /* busy bit */
210*c6a66418SRobert Mustacchi #define E1000_MPHY_ADDRESS_FNC_OVERRIDE	0x20000000 /* fnc_override bit */
211*c6a66418SRobert Mustacchi #define E1000_MPHY_ADDRESS_MASK		0x0000FFFF /* address mask */
212*c6a66418SRobert Mustacchi 
21375eba5b6SRobert Mustacchi /* BM PHY Copper Specific Control 1 */
21475eba5b6SRobert Mustacchi #define BM_CS_CTRL1			16
21575eba5b6SRobert Mustacchi 
21675eba5b6SRobert Mustacchi /* BM PHY Copper Specific Status */
21775eba5b6SRobert Mustacchi #define BM_CS_STATUS			17
21875eba5b6SRobert Mustacchi #define BM_CS_STATUS_LINK_UP		0x0400
21975eba5b6SRobert Mustacchi #define BM_CS_STATUS_RESOLVED		0x0800
22075eba5b6SRobert Mustacchi #define BM_CS_STATUS_SPEED_MASK		0xC000
22175eba5b6SRobert Mustacchi #define BM_CS_STATUS_SPEED_1000		0x8000
22275eba5b6SRobert Mustacchi 
22375eba5b6SRobert Mustacchi /* 82577 Mobile Phy Status Register */
22475eba5b6SRobert Mustacchi #define HV_M_STATUS			26
22575eba5b6SRobert Mustacchi #define HV_M_STATUS_AUTONEG_COMPLETE	0x1000
22675eba5b6SRobert Mustacchi #define HV_M_STATUS_SPEED_MASK		0x0300
22775eba5b6SRobert Mustacchi #define HV_M_STATUS_SPEED_1000		0x0200
228*c6a66418SRobert Mustacchi #define HV_M_STATUS_SPEED_100		0x0100
22975eba5b6SRobert Mustacchi #define HV_M_STATUS_LINK_UP		0x0040
23075eba5b6SRobert Mustacchi 
23175eba5b6SRobert Mustacchi #define IGP01E1000_PHY_PCS_INIT_REG	0x00B4
23275eba5b6SRobert Mustacchi #define IGP01E1000_PHY_POLARITY_MASK	0x0078
23375eba5b6SRobert Mustacchi 
23475eba5b6SRobert Mustacchi #define IGP01E1000_PSCR_AUTO_MDIX	0x1000
23575eba5b6SRobert Mustacchi #define IGP01E1000_PSCR_FORCE_MDI_MDIX	0x2000 /* 0=MDI, 1=MDIX */
23675eba5b6SRobert Mustacchi 
23775eba5b6SRobert Mustacchi #define IGP01E1000_PSCFR_SMART_SPEED	0x0080
23875eba5b6SRobert Mustacchi 
23975eba5b6SRobert Mustacchi /* Enable flexible speed on link-up */
24075eba5b6SRobert Mustacchi #define IGP01E1000_GMII_FLEX_SPD	0x0010
24175eba5b6SRobert Mustacchi #define IGP01E1000_GMII_SPD		0x0020 /* Enable SPD */
24275eba5b6SRobert Mustacchi 
24375eba5b6SRobert Mustacchi #define IGP02E1000_PM_SPD		0x0001 /* Smart Power Down */
24475eba5b6SRobert Mustacchi #define IGP02E1000_PM_D0_LPLU		0x0002 /* For D0a states */
24575eba5b6SRobert Mustacchi #define IGP02E1000_PM_D3_LPLU		0x0004 /* For all other states */
24675eba5b6SRobert Mustacchi 
24775eba5b6SRobert Mustacchi #define IGP01E1000_PLHR_SS_DOWNGRADE	0x8000
24875eba5b6SRobert Mustacchi 
24975eba5b6SRobert Mustacchi #define IGP01E1000_PSSR_POLARITY_REVERSED	0x0002
25075eba5b6SRobert Mustacchi #define IGP01E1000_PSSR_MDIX		0x0800
25175eba5b6SRobert Mustacchi #define IGP01E1000_PSSR_SPEED_MASK	0xC000
25275eba5b6SRobert Mustacchi #define IGP01E1000_PSSR_SPEED_1000MBPS	0xC000
25375eba5b6SRobert Mustacchi 
25475eba5b6SRobert Mustacchi #define IGP02E1000_PHY_CHANNEL_NUM	4
25575eba5b6SRobert Mustacchi #define IGP02E1000_PHY_AGC_A		0x11B1
25675eba5b6SRobert Mustacchi #define IGP02E1000_PHY_AGC_B		0x12B1
25775eba5b6SRobert Mustacchi #define IGP02E1000_PHY_AGC_C		0x14B1
25875eba5b6SRobert Mustacchi #define IGP02E1000_PHY_AGC_D		0x18B1
25975eba5b6SRobert Mustacchi 
260*c6a66418SRobert Mustacchi #define IGP02E1000_AGC_LENGTH_SHIFT	9   /* Course=15:13, Fine=12:9 */
26175eba5b6SRobert Mustacchi #define IGP02E1000_AGC_LENGTH_MASK	0x7F
26275eba5b6SRobert Mustacchi #define IGP02E1000_AGC_RANGE		15
26375eba5b6SRobert Mustacchi 
26475eba5b6SRobert Mustacchi #define E1000_CABLE_LENGTH_UNDEFINED	0xFF
26575eba5b6SRobert Mustacchi 
26675eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_OFFSET	0x001F0000
26775eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_OFFSET_SHIFT	16
26875eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_REN		0x00200000
26975eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_CTRL_OFFSET	0x1    /* Kumeran Control */
27075eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_DIAG_OFFSET	0x3    /* Kumeran Diagnostic */
27175eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_TIMEOUTS	0x4    /* Kumeran Timeouts */
27275eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_INBAND_PARAM	0x9    /* Kumeran InBand Parameters */
27375eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_IBIST_DISABLE	0x0200 /* Kumeran IBIST Disable */
27475eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_DIAG_NELPBK	0x1000 /* Nearend Loopback mode */
27575eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_K1_CONFIG	0x7
27675eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_K1_ENABLE	0x0002 /* enable K1 */
27775eba5b6SRobert Mustacchi #define E1000_KMRNCTRLSTA_HD_CTRL	0x10   /* Kumeran HD Control */
27875eba5b6SRobert Mustacchi 
27975eba5b6SRobert Mustacchi #define IFE_PHY_EXTENDED_STATUS_CONTROL	0x10
280*c6a66418SRobert Mustacchi #define IFE_PHY_SPECIAL_CONTROL		0x11 /* 100BaseTx PHY Special Ctrl */
281*c6a66418SRobert Mustacchi #define IFE_PHY_SPECIAL_CONTROL_LED	0x1B /* PHY Special and LED Ctrl */
28275eba5b6SRobert Mustacchi #define IFE_PHY_MDIX_CONTROL		0x1C /* MDI/MDI-X Control */
28375eba5b6SRobert Mustacchi 
28475eba5b6SRobert Mustacchi /* IFE PHY Extended Status Control */
28575eba5b6SRobert Mustacchi #define IFE_PESC_POLARITY_REVERSED	0x0100
28675eba5b6SRobert Mustacchi 
28775eba5b6SRobert Mustacchi /* IFE PHY Special Control */
28875eba5b6SRobert Mustacchi #define IFE_PSC_AUTO_POLARITY_DISABLE	0x0010
28975eba5b6SRobert Mustacchi #define IFE_PSC_FORCE_POLARITY		0x0020
29075eba5b6SRobert Mustacchi 
29175eba5b6SRobert Mustacchi /* IFE PHY Special Control and LED Control */
29275eba5b6SRobert Mustacchi #define IFE_PSCL_PROBE_MODE		0x0020
29375eba5b6SRobert Mustacchi #define IFE_PSCL_PROBE_LEDS_OFF		0x0006 /* Force LEDs 0 and 2 off */
29475eba5b6SRobert Mustacchi #define IFE_PSCL_PROBE_LEDS_ON		0x0007 /* Force LEDs 0 and 2 on */
29575eba5b6SRobert Mustacchi 
29675eba5b6SRobert Mustacchi /* IFE PHY MDIX Control */
29775eba5b6SRobert Mustacchi #define IFE_PMC_MDIX_STATUS		0x0020 /* 1=MDI-X, 0=MDI */
29875eba5b6SRobert Mustacchi #define IFE_PMC_FORCE_MDIX		0x0040 /* 1=force MDI-X, 0=force MDI */
29975eba5b6SRobert Mustacchi #define IFE_PMC_AUTO_MDIX		0x0080 /* 1=enable auto, 0=disable */
30075eba5b6SRobert Mustacchi 
30175eba5b6SRobert Mustacchi /* SFP modules ID memory locations */
30275eba5b6SRobert Mustacchi #define E1000_SFF_IDENTIFIER_OFFSET	0x00
30375eba5b6SRobert Mustacchi #define E1000_SFF_IDENTIFIER_SFF	0x02
30475eba5b6SRobert Mustacchi #define E1000_SFF_IDENTIFIER_SFP	0x03
30575eba5b6SRobert Mustacchi 
30675eba5b6SRobert Mustacchi #define E1000_SFF_ETH_FLAGS_OFFSET	0x06
30775eba5b6SRobert Mustacchi /* Flags for SFP modules compatible with ETH up to 1Gb */
30875eba5b6SRobert Mustacchi struct sfp_e1000_flags {
30975eba5b6SRobert Mustacchi 	u8 e1000_base_sx:1;
31075eba5b6SRobert Mustacchi 	u8 e1000_base_lx:1;
31175eba5b6SRobert Mustacchi 	u8 e1000_base_cx:1;
31275eba5b6SRobert Mustacchi 	u8 e1000_base_t:1;
31375eba5b6SRobert Mustacchi 	u8 e100_base_lx:1;
31475eba5b6SRobert Mustacchi 	u8 e100_base_fx:1;
31575eba5b6SRobert Mustacchi 	u8 e10_base_bx10:1;
31675eba5b6SRobert Mustacchi 	u8 e10_base_px:1;
31775eba5b6SRobert Mustacchi };
31875eba5b6SRobert Mustacchi 
31975eba5b6SRobert Mustacchi /* Vendor OUIs: format of OUI is 0x[byte0][byte1][byte2][00] */
32075eba5b6SRobert Mustacchi #define E1000_SFF_VENDOR_OUI_TYCO	0x00407600
32175eba5b6SRobert Mustacchi #define E1000_SFF_VENDOR_OUI_FTL	0x00906500
32275eba5b6SRobert Mustacchi #define E1000_SFF_VENDOR_OUI_AVAGO	0x00176A00
32375eba5b6SRobert Mustacchi #define E1000_SFF_VENDOR_OUI_INTEL	0x001B2100
32475eba5b6SRobert Mustacchi 
32575eba5b6SRobert Mustacchi #endif
326