1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015-2020
5 #ifndef _TXGBE_EEPROM_H_
6 #define _TXGBE_EEPROM_H_
8 /* Checksum and EEPROM pointers */
9 #define TXGBE_PBANUM_PTR_GUARD 0xFAFA
10 #define TXGBE_EEPROM_SUM 0xBABA
12 #define TXGBE_FW_PTR 0x0F
13 #define TXGBE_PBANUM0_PTR 0x05
14 #define TXGBE_PBANUM1_PTR 0x06
15 #define TXGBE_SW_REGION_PTR 0x1C
17 #define TXGBE_EE_CSUM_MAX 0x800
18 #define TXGBE_EEPROM_CHECKSUM 0x2F
20 #define TXGBE_SAN_MAC_ADDR_PTR 0x18
21 #define TXGBE_DEVICE_CAPS 0x1C
22 #define TXGBE_EEPROM_VERSION_L 0x1D
23 #define TXGBE_EEPROM_VERSION_H 0x1E
24 #define TXGBE_ISCSI_BOOT_CONFIG 0x07
26 #define TXGBE_DEVICE_CAPS_ALLOW_ANY_SFP 0x1
28 s32 txgbe_init_eeprom_params(struct txgbe_hw *hw);
29 s32 txgbe_calc_eeprom_checksum(struct txgbe_hw *hw);
30 s32 txgbe_validate_eeprom_checksum(struct txgbe_hw *hw, u16 *checksum_val);
31 s32 txgbe_update_eeprom_checksum(struct txgbe_hw *hw);
32 s32 txgbe_get_eeprom_semaphore(struct txgbe_hw *hw);
33 void txgbe_release_eeprom_semaphore(struct txgbe_hw *hw);
35 s32 txgbe_ee_read16(struct txgbe_hw *hw, u32 offset, u16 *data);
36 s32 txgbe_ee_readw_sw(struct txgbe_hw *hw, u32 offset, u16 *data);
37 s32 txgbe_ee_readw_buffer(struct txgbe_hw *hw, u32 offset, u32 words,
39 s32 txgbe_ee_read32(struct txgbe_hw *hw, u32 addr, u32 *data);
40 s32 txgbe_ee_read_buffer(struct txgbe_hw *hw, u32 addr, u32 len, void *data);
42 s32 txgbe_ee_write16(struct txgbe_hw *hw, u32 offset, u16 data);
43 s32 txgbe_ee_writew_sw(struct txgbe_hw *hw, u32 offset, u16 data);
44 s32 txgbe_ee_writew_buffer(struct txgbe_hw *hw, u32 offset, u32 words,
46 s32 txgbe_ee_write32(struct txgbe_hw *hw, u32 addr, u32 data);
47 s32 txgbe_ee_write_buffer(struct txgbe_hw *hw, u32 addr, u32 len, void *data);
50 #endif /* _TXGBE_EEPROM_H_ */