1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2018 Intel Corporation */
7 #include <linux/types.h>
8 #include <linux/if_ether.h>
9 #include <linux/netdevice.h>
12 #include "igc_defines.h"
19 #define IGC_DEV_ID_I225_LM 0x15F2
20 #define IGC_DEV_ID_I225_V 0x15F3
21 #define IGC_DEV_ID_I225_I 0x15F8
22 #define IGC_DEV_ID_I220_V 0x15F7
23 #define IGC_DEV_ID_I225_K 0x3100
24 #define IGC_DEV_ID_I225_K2 0x3101
25 #define IGC_DEV_ID_I226_K 0x3102
26 #define IGC_DEV_ID_I225_LMVP 0x5502
27 #define IGC_DEV_ID_I226_LMVP 0x5503
28 #define IGC_DEV_ID_I225_IT 0x0D9F
29 #define IGC_DEV_ID_I226_LM 0x125B
30 #define IGC_DEV_ID_I226_V 0x125C
31 #define IGC_DEV_ID_I226_IT 0x125D
32 #define IGC_DEV_ID_I221_V 0x125E
33 #define IGC_DEV_ID_I226_BLANK_NVM 0x125F
34 #define IGC_DEV_ID_I225_BLANK_NVM 0x15FD
36 /* Function pointers for the MAC. */
37 struct igc_mac_operations {
38 s32 (*check_for_link)(struct igc_hw *hw);
39 s32 (*reset_hw)(struct igc_hw *hw);
40 s32 (*init_hw)(struct igc_hw *hw);
41 s32 (*setup_physical_interface)(struct igc_hw *hw);
42 void (*rar_set)(struct igc_hw *hw, u8 *address, u32 index);
43 s32 (*read_mac_addr)(struct igc_hw *hw);
44 s32 (*get_speed_and_duplex)(struct igc_hw *hw, u16 *speed,
46 s32 (*acquire_swfw_sync)(struct igc_hw *hw, u16 mask);
47 void (*release_swfw_sync)(struct igc_hw *hw, u16 mask);
53 igc_num_macs /* List is 1-based, so subtract 1 for true count. */
57 igc_media_type_unknown = 0,
58 igc_media_type_copper = 1,
68 s32 (*get_invariants)(struct igc_hw *hw);
69 struct igc_mac_operations *mac_ops;
70 const struct igc_phy_operations *phy_ops;
71 struct igc_nvm_operations *nvm_ops;
74 extern const struct igc_info igc_base_info;
77 struct igc_mac_operations ops;
80 u8 perm_addr[ETH_ALEN];
82 enum igc_mac_type type;
89 u32 mta_shadow[MAX_MTA_REG];
92 bool asf_firmware_present;
93 bool arc_subsystem_valid;
100 struct igc_nvm_operations {
101 s32 (*acquire)(struct igc_hw *hw);
102 s32 (*read)(struct igc_hw *hw, u16 offset, u16 i, u16 *data);
103 void (*release)(struct igc_hw *hw);
104 s32 (*write)(struct igc_hw *hw, u16 offset, u16 i, u16 *data);
105 s32 (*update)(struct igc_hw *hw);
106 s32 (*validate)(struct igc_hw *hw);
109 struct igc_phy_operations {
110 s32 (*acquire)(struct igc_hw *hw);
111 s32 (*check_reset_block)(struct igc_hw *hw);
112 s32 (*force_speed_duplex)(struct igc_hw *hw);
113 s32 (*get_phy_info)(struct igc_hw *hw);
114 s32 (*read_reg)(struct igc_hw *hw, u32 address, u16 *data);
115 void (*release)(struct igc_hw *hw);
116 s32 (*reset)(struct igc_hw *hw);
117 s32 (*write_reg)(struct igc_hw *hw, u32 address, u16 data);
120 struct igc_nvm_info {
121 struct igc_nvm_operations ops;
122 enum igc_nvm_type type;
131 struct igc_phy_info {
132 struct igc_phy_operations ops;
136 u32 reset_delay_us; /* in usec */
139 enum igc_media_type media_type;
141 u16 autoneg_advertised;
147 bool speed_downgraded;
148 bool autoneg_wait_to_complete;
151 struct igc_bus_info {
161 igc_fc_default = 0xFF
165 u32 high_water; /* Flow control high-water mark */
166 u32 low_water; /* Flow control low-water mark */
167 u16 pause_time; /* Flow control pause timer */
168 bool send_xon; /* Flow control send XON */
169 bool strict_ieee; /* Strict IEEE mode */
170 enum igc_fc_mode current_mode; /* Type of flow control */
171 enum igc_fc_mode requested_mode;
174 struct igc_dev_spec_base {
175 bool clear_semaphore_once;
183 unsigned long io_base;
185 struct igc_mac_info mac;
186 struct igc_fc_info fc;
187 struct igc_nvm_info nvm;
188 struct igc_phy_info phy;
190 struct igc_bus_info bus;
193 struct igc_dev_spec_base _base;
197 u16 subsystem_vendor_id;
198 u16 subsystem_device_id;
204 /* Statistics counters collected by the MAC */
205 struct igc_hw_stats {
278 struct net_device *igc_get_hw_dev(struct igc_hw *hw);
279 #define hw_dbg(format, arg...) \
280 netdev_dbg(igc_get_hw_dev(hw), format, ##arg)
282 s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value);
283 s32 igc_write_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value);
284 void igc_read_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value);
285 void igc_write_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value);
287 #endif /* _IGC_HW_H_ */