162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright(c) 2007 - 2018 Intel Corporation. */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef _E1000_I210_H_
562306a36Sopenharmony_ci#define _E1000_I210_H_
662306a36Sopenharmony_ci
762306a36Sopenharmony_cis32 igb_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask);
862306a36Sopenharmony_civoid igb_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask);
962306a36Sopenharmony_cis32 igb_valid_led_default_i210(struct e1000_hw *hw, u16 *data);
1062306a36Sopenharmony_cis32 igb_read_invm_version(struct e1000_hw *hw,
1162306a36Sopenharmony_ci			  struct e1000_fw_version *invm_ver);
1262306a36Sopenharmony_cis32 igb_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data);
1362306a36Sopenharmony_cis32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data);
1462306a36Sopenharmony_cis32 igb_init_nvm_params_i210(struct e1000_hw *hw);
1562306a36Sopenharmony_cibool igb_get_flash_presence_i210(struct e1000_hw *hw);
1662306a36Sopenharmony_cis32 igb_pll_workaround_i210(struct e1000_hw *hw);
1762306a36Sopenharmony_cis32 igb_get_cfg_done_i210(struct e1000_hw *hw);
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define E1000_STM_OPCODE		0xDB00
2062306a36Sopenharmony_ci#define E1000_EEPROM_FLASH_SIZE_WORD	0x11
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define INVM_DWORD_TO_RECORD_TYPE(invm_dword) \
2362306a36Sopenharmony_ci	(u8)((invm_dword) & 0x7)
2462306a36Sopenharmony_ci#define INVM_DWORD_TO_WORD_ADDRESS(invm_dword) \
2562306a36Sopenharmony_ci	(u8)(((invm_dword) & 0x0000FE00) >> 9)
2662306a36Sopenharmony_ci#define INVM_DWORD_TO_WORD_DATA(invm_dword) \
2762306a36Sopenharmony_ci	(u16)(((invm_dword) & 0xFFFF0000) >> 16)
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_cienum E1000_INVM_STRUCTURE_TYPE {
3062306a36Sopenharmony_ci	E1000_INVM_UNINITIALIZED_STRUCTURE		= 0x00,
3162306a36Sopenharmony_ci	E1000_INVM_WORD_AUTOLOAD_STRUCTURE		= 0x01,
3262306a36Sopenharmony_ci	E1000_INVM_CSR_AUTOLOAD_STRUCTURE		= 0x02,
3362306a36Sopenharmony_ci	E1000_INVM_PHY_REGISTER_AUTOLOAD_STRUCTURE	= 0x03,
3462306a36Sopenharmony_ci	E1000_INVM_RSA_KEY_SHA256_STRUCTURE		= 0x04,
3562306a36Sopenharmony_ci	E1000_INVM_INVALIDATED_STRUCTURE		= 0x0F,
3662306a36Sopenharmony_ci};
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define E1000_INVM_RSA_KEY_SHA256_DATA_SIZE_IN_DWORDS	8
3962306a36Sopenharmony_ci#define E1000_INVM_CSR_AUTOLOAD_DATA_SIZE_IN_DWORDS	1
4062306a36Sopenharmony_ci#define E1000_INVM_ULT_BYTES_SIZE			8
4162306a36Sopenharmony_ci#define E1000_INVM_RECORD_SIZE_IN_BYTES			4
4262306a36Sopenharmony_ci#define E1000_INVM_VER_FIELD_ONE			0x1FF8
4362306a36Sopenharmony_ci#define E1000_INVM_VER_FIELD_TWO			0x7FE000
4462306a36Sopenharmony_ci#define E1000_INVM_IMGTYPE_FIELD			0x1F800000
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#define E1000_INVM_MAJOR_MASK		0x3F0
4762306a36Sopenharmony_ci#define E1000_INVM_MINOR_MASK		0xF
4862306a36Sopenharmony_ci#define E1000_INVM_MAJOR_SHIFT		4
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#define ID_LED_DEFAULT_I210		((ID_LED_OFF1_ON2  << 8) | \
5162306a36Sopenharmony_ci					 (ID_LED_DEF1_DEF2 <<  4) | \
5262306a36Sopenharmony_ci					 (ID_LED_OFF1_OFF2))
5362306a36Sopenharmony_ci#define ID_LED_DEFAULT_I210_SERDES	((ID_LED_DEF1_DEF2 << 8) | \
5462306a36Sopenharmony_ci					 (ID_LED_DEF1_DEF2 <<  4) | \
5562306a36Sopenharmony_ci					 (ID_LED_OFF1_ON2))
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/* NVM offset defaults for i211 device */
5862306a36Sopenharmony_ci#define NVM_INIT_CTRL_2_DEFAULT_I211	0X7243
5962306a36Sopenharmony_ci#define NVM_INIT_CTRL_4_DEFAULT_I211	0x00C1
6062306a36Sopenharmony_ci#define NVM_LED_1_CFG_DEFAULT_I211	0x0184
6162306a36Sopenharmony_ci#define NVM_LED_0_2_CFG_DEFAULT_I211	0x200C
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/* PLL Defines */
6462306a36Sopenharmony_ci#define E1000_PCI_PMCSR			0x44
6562306a36Sopenharmony_ci#define E1000_PCI_PMCSR_D3		0x03
6662306a36Sopenharmony_ci#define E1000_MAX_PLL_TRIES		5
6762306a36Sopenharmony_ci#define E1000_PHY_PLL_UNCONF		0xFF
6862306a36Sopenharmony_ci#define E1000_PHY_PLL_FREQ_PAGE		0xFC
6962306a36Sopenharmony_ci#define E1000_PHY_PLL_FREQ_REG		0x000E
7062306a36Sopenharmony_ci#define E1000_INVM_DEFAULT_AL		0x202F
7162306a36Sopenharmony_ci#define E1000_INVM_AUTOLOAD		0x0A
7262306a36Sopenharmony_ci#define E1000_INVM_PLL_WO_VAL		0x0010
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#endif
75