xref: /freebsd/sys/dev/e1000/e1000_i210.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1ab5d0362SJack F Vogel /******************************************************************************
27282444bSPedro F. Giffuni   SPDX-License-Identifier: BSD-3-Clause
3ab5d0362SJack F Vogel 
4702cac6cSKevin Bowling   Copyright (c) 2001-2020, Intel Corporation
5ab5d0362SJack F Vogel   All rights reserved.
6ab5d0362SJack F Vogel 
7ab5d0362SJack F Vogel   Redistribution and use in source and binary forms, with or without
8ab5d0362SJack F Vogel   modification, are permitted provided that the following conditions are met:
9ab5d0362SJack F Vogel 
10ab5d0362SJack F Vogel    1. Redistributions of source code must retain the above copyright notice,
11ab5d0362SJack F Vogel       this list of conditions and the following disclaimer.
12ab5d0362SJack F Vogel 
13ab5d0362SJack F Vogel    2. Redistributions in binary form must reproduce the above copyright
14ab5d0362SJack F Vogel       notice, this list of conditions and the following disclaimer in the
15ab5d0362SJack F Vogel       documentation and/or other materials provided with the distribution.
16ab5d0362SJack F Vogel 
17ab5d0362SJack F Vogel    3. Neither the name of the Intel Corporation nor the names of its
18ab5d0362SJack F Vogel       contributors may be used to endorse or promote products derived from
19ab5d0362SJack F Vogel       this software without specific prior written permission.
20ab5d0362SJack F Vogel 
21ab5d0362SJack F Vogel   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22ab5d0362SJack F Vogel   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23ab5d0362SJack F Vogel   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24ab5d0362SJack F Vogel   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25ab5d0362SJack F Vogel   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26ab5d0362SJack F Vogel   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27ab5d0362SJack F Vogel   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28ab5d0362SJack F Vogel   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29ab5d0362SJack F Vogel   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30ab5d0362SJack F Vogel   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31ab5d0362SJack F Vogel   POSSIBILITY OF SUCH DAMAGE.
32ab5d0362SJack F Vogel 
33ab5d0362SJack F Vogel ******************************************************************************/
34ab5d0362SJack F Vogel 
35ab5d0362SJack F Vogel #ifndef _E1000_I210_H_
36ab5d0362SJack F Vogel #define _E1000_I210_H_
37ab5d0362SJack F Vogel 
387609433eSJack F Vogel bool e1000_get_flash_presence_i210(struct e1000_hw *hw);
39ab5d0362SJack F Vogel s32 e1000_update_flash_i210(struct e1000_hw *hw);
40ab5d0362SJack F Vogel s32 e1000_update_nvm_checksum_i210(struct e1000_hw *hw);
41ab5d0362SJack F Vogel s32 e1000_validate_nvm_checksum_i210(struct e1000_hw *hw);
42ab5d0362SJack F Vogel s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset,
43ab5d0362SJack F Vogel 			      u16 words, u16 *data);
44ab5d0362SJack F Vogel s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset,
45ab5d0362SJack F Vogel 			     u16 words, u16 *data);
46*984d1616SKevin Bowling s32 e1000_read_invm_version(struct e1000_hw *hw,
47*984d1616SKevin Bowling 			    struct e1000_fw_version *invm_ver);
488cc64f1eSJack F Vogel s32 e1000_init_hw_i210(struct e1000_hw *hw);
49ab5d0362SJack F Vogel 
50ab5d0362SJack F Vogel #define E1000_STM_OPCODE		0xDB00
51ab5d0362SJack F Vogel #define E1000_EEPROM_FLASH_SIZE_WORD	0x11
52ab5d0362SJack F Vogel 
53ab5d0362SJack F Vogel #define INVM_DWORD_TO_RECORD_TYPE(invm_dword) \
54ab5d0362SJack F Vogel 	(u8)((invm_dword) & 0x7)
55ab5d0362SJack F Vogel #define INVM_DWORD_TO_WORD_ADDRESS(invm_dword) \
56ab5d0362SJack F Vogel 	(u8)(((invm_dword) & 0x0000FE00) >> 9)
57ab5d0362SJack F Vogel #define INVM_DWORD_TO_WORD_DATA(invm_dword) \
58ab5d0362SJack F Vogel 	(u16)(((invm_dword) & 0xFFFF0000) >> 16)
59ab5d0362SJack F Vogel 
60ab5d0362SJack F Vogel enum E1000_INVM_STRUCTURE_TYPE {
61ab5d0362SJack F Vogel 	E1000_INVM_UNINITIALIZED_STRUCTURE		= 0x00,
62ab5d0362SJack F Vogel 	E1000_INVM_WORD_AUTOLOAD_STRUCTURE		= 0x01,
63ab5d0362SJack F Vogel 	E1000_INVM_CSR_AUTOLOAD_STRUCTURE		= 0x02,
64ab5d0362SJack F Vogel 	E1000_INVM_PHY_REGISTER_AUTOLOAD_STRUCTURE	= 0x03,
65ab5d0362SJack F Vogel 	E1000_INVM_RSA_KEY_SHA256_STRUCTURE		= 0x04,
66ab5d0362SJack F Vogel 	E1000_INVM_INVALIDATED_STRUCTURE		= 0x0F,
67ab5d0362SJack F Vogel };
68ab5d0362SJack F Vogel 
69ab5d0362SJack F Vogel #define E1000_INVM_RSA_KEY_SHA256_DATA_SIZE_IN_DWORDS	8
70ab5d0362SJack F Vogel #define E1000_INVM_CSR_AUTOLOAD_DATA_SIZE_IN_DWORDS	1
716ab6bfe3SJack F Vogel #define E1000_INVM_ULT_BYTES_SIZE	8
726ab6bfe3SJack F Vogel #define E1000_INVM_RECORD_SIZE_IN_BYTES	4
736ab6bfe3SJack F Vogel #define E1000_INVM_VER_FIELD_ONE	0x1FF8
746ab6bfe3SJack F Vogel #define E1000_INVM_VER_FIELD_TWO	0x7FE000
756ab6bfe3SJack F Vogel #define E1000_INVM_IMGTYPE_FIELD	0x1F800000
766ab6bfe3SJack F Vogel 
776ab6bfe3SJack F Vogel #define E1000_INVM_MAJOR_MASK	0x3F0
786ab6bfe3SJack F Vogel #define E1000_INVM_MINOR_MASK	0xF
796ab6bfe3SJack F Vogel #define E1000_INVM_MAJOR_SHIFT	4
80ab5d0362SJack F Vogel 
81ab5d0362SJack F Vogel #define ID_LED_DEFAULT_I210		((ID_LED_OFF1_ON2  << 8) | \
82ab5d0362SJack F Vogel 					 (ID_LED_DEF1_DEF2 <<  4) | \
83ab5d0362SJack F Vogel 					 (ID_LED_OFF1_OFF2))
84ab5d0362SJack F Vogel #define ID_LED_DEFAULT_I210_SERDES	((ID_LED_DEF1_DEF2 << 8) | \
85ab5d0362SJack F Vogel 					 (ID_LED_DEF1_DEF2 <<  4) | \
867609433eSJack F Vogel 					 (ID_LED_OFF1_ON2))
87ab5d0362SJack F Vogel 
886ab6bfe3SJack F Vogel /* NVM offset defaults for I211 devices */
896ab6bfe3SJack F Vogel #define NVM_INIT_CTRL_2_DEFAULT_I211	0X7243
906ab6bfe3SJack F Vogel #define NVM_INIT_CTRL_4_DEFAULT_I211	0x00C1
916ab6bfe3SJack F Vogel #define NVM_LED_1_CFG_DEFAULT_I211	0x0184
926ab6bfe3SJack F Vogel #define NVM_LED_0_2_CFG_DEFAULT_I211	0x200C
938cc64f1eSJack F Vogel 
948cc64f1eSJack F Vogel /* PLL Defines */
958cc64f1eSJack F Vogel #define E1000_PCI_PMCSR			0x44
968cc64f1eSJack F Vogel #define E1000_PCI_PMCSR_D3		0x03
978cc64f1eSJack F Vogel #define E1000_MAX_PLL_TRIES		5
988cc64f1eSJack F Vogel #define E1000_PHY_PLL_UNCONF		0xFF
998cc64f1eSJack F Vogel #define E1000_PHY_PLL_FREQ_PAGE		0xFC0000
1008cc64f1eSJack F Vogel #define E1000_PHY_PLL_FREQ_REG		0x000E
1018cc64f1eSJack F Vogel #define E1000_INVM_DEFAULT_AL		0x202F
1028cc64f1eSJack F Vogel #define E1000_INVM_AUTOLOAD		0x0A
1038cc64f1eSJack F Vogel #define E1000_INVM_PLL_WO_VAL		0x0010
1048cc64f1eSJack F Vogel 
105ab5d0362SJack F Vogel #endif
106