2 * aQuantia Corporation Network Driver
3 * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
10 /* File hw_atl_utils.h: Declaration of common functions for Atlantic hardware
14 #ifndef HW_ATL_UTILS_H
15 #define HW_ATL_UTILS_H
17 #define HW_ATL_FLUSH() { (void)aq_hw_read_reg(self, 0x10); }
19 /* Hardware tx descriptor */
20 struct __packed hw_atl_txd_s {
23 u32 ctl2; /* 63..46 - payload length, 45 - ctx enable, 44 - ctx index */
26 /* Hardware tx context descriptor */
27 struct __packed hw_atl_txc_s {
34 /* Hardware rx descriptor */
35 struct __packed hw_atl_rxd_s {
40 /* Hardware rx descriptor writeback */
41 struct __packed hw_atl_rxd_wb_s {
50 struct __packed hw_atl_stats_s {
68 union __packed ip_addr {
78 struct __packed hw_aq_atl_utils_fw_rpc {
104 u16 friendly_name_len;
105 u16 friendly_name[65];
107 u32 next_wol_pattern_offset;
112 u8 ipv4_source_address[4];
113 u8 ipv4_dest_address[4];
114 u16 tcp_source_port_number;
115 u16 tcp_dest_port_number;
116 } ipv4_tcp_syn_parameters;
120 u8 ipv6_source_address[16];
121 u8 ipv6_dest_address[16];
122 u16 tcp_source_port_number;
123 u16 tcp_dest_port_number;
124 } ipv6_tcp_syn_parameters;
128 } eapol_request_id_message_parameters;
136 } wol_bit_map_pattern;
141 u32 is_wake_on_link_down;
142 u32 is_wake_on_link_up;
147 struct __packed hw_aq_atl_utils_mbox_header {
153 struct __packed hw_aq_atl_utils_mbox {
154 struct hw_aq_atl_utils_mbox_header header;
155 struct hw_atl_stats_s stats;
158 #define HAL_ATLANTIC_UTILS_CHIP_MIPS 0x00000001U
159 #define HAL_ATLANTIC_UTILS_CHIP_TPO2 0x00000002U
160 #define HAL_ATLANTIC_UTILS_CHIP_RPF2 0x00000004U
161 #define HAL_ATLANTIC_UTILS_CHIP_MPI_AQ 0x00000010U
162 #define HAL_ATLANTIC_UTILS_CHIP_REVISION_A0 0x01000000U
163 #define HAL_ATLANTIC_UTILS_CHIP_REVISION_B0 0x02000000U
164 #define HAL_ATLANTIC_UTILS_CHIP_REVISION_B1 0x04000000U
166 #define IS_CHIP_FEATURE(_F_) (HAL_ATLANTIC_UTILS_CHIP_##_F_ & \
169 enum hal_atl_utils_fw_state_e {
176 #define HAL_ATLANTIC_RATE_10G BIT(0)
177 #define HAL_ATLANTIC_RATE_5G BIT(1)
178 #define HAL_ATLANTIC_RATE_5GSR BIT(2)
179 #define HAL_ATLANTIC_RATE_2GS BIT(3)
180 #define HAL_ATLANTIC_RATE_1G BIT(4)
181 #define HAL_ATLANTIC_RATE_100M BIT(5)
182 #define HAL_ATLANTIC_RATE_INVALID BIT(6)
184 enum hw_atl_fw2x_rate {
185 FW2X_RATE_100M = 0x20,
186 FW2X_RATE_1G = 0x100,
187 FW2X_RATE_2G5 = 0x200,
188 FW2X_RATE_5G = 0x400,
189 FW2X_RATE_10G = 0x800,
192 enum hw_atl_fw2x_caps_lo {
193 CAPS_LO_10BASET_HD = 0x00,
195 CAPS_LO_100BASETX_HD,
196 CAPS_LO_100BASET4_HD,
197 CAPS_LO_100BASET2_HD,
198 CAPS_LO_100BASETX_FD,
199 CAPS_LO_100BASET2_FD,
200 CAPS_LO_1000BASET_HD,
201 CAPS_LO_1000BASET_FD,
202 CAPS_LO_2P5GBASET_FD,
207 enum hw_atl_fw2x_caps_hi {
208 CAPS_HI_RESERVED1 = 0x00,
212 CAPS_HI_ASYMMETRIC_PAUSE,
213 CAPS_HI_100BASETX_EEE,
216 CAPS_HI_1000BASET_FD_EEE,
217 CAPS_HI_2P5GBASET_FD_EEE,
218 CAPS_HI_5GBASET_FD_EEE,
219 CAPS_HI_10GBASET_FD_EEE,
229 CAPS_HI_MEDIA_DETECT,
234 CAPS_HI_EXT_LOOPBACK,
235 CAPS_HI_INT_LOOPBACK,
239 CAPS_HI_TRANSACTION_ID,
242 enum hw_atl_fw2x_ctrl {
243 CTRL_RESERVED1 = 0x00,
247 CTRL_ASYMMETRIC_PAUSE,
252 CTRL_2P5GBASET_FD_EEE,
254 CTRL_10GBASET_FD_EEE,
255 CTRL_THERMAL_SHUTDOWN,
257 CTRL_EEE_AUTO_DISABLE,
274 CTRL_FORCE_RECONNECT,
280 struct aq_hw_link_status_s;
282 int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops);
284 int hw_atl_utils_soft_reset(struct aq_hw_s *self);
286 void hw_atl_utils_hw_chip_features_init(struct aq_hw_s *self, u32 *p);
288 int hw_atl_utils_mpi_read_mbox(struct aq_hw_s *self,
289 struct hw_aq_atl_utils_mbox_header *pmbox);
291 void hw_atl_utils_mpi_read_stats(struct aq_hw_s *self,
292 struct hw_aq_atl_utils_mbox *pmbox);
294 void hw_atl_utils_mpi_set(struct aq_hw_s *self,
295 enum hal_atl_utils_fw_state_e state,
298 int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self);
300 int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self,
303 unsigned int hw_atl_utils_mbps_2_speed_index(unsigned int mbps);
305 int hw_atl_utils_hw_get_regs(struct aq_hw_s *self,
306 const struct aq_hw_caps_s *aq_hw_caps,
309 int hw_atl_utils_hw_set_power(struct aq_hw_s *self,
310 unsigned int power_state);
312 int hw_atl_utils_hw_deinit(struct aq_hw_s *self);
314 int hw_atl_utils_get_fw_version(struct aq_hw_s *self, u32 *fw_version);
316 int hw_atl_utils_update_stats(struct aq_hw_s *self);
318 struct aq_stats_s *hw_atl_utils_get_hw_stats(struct aq_hw_s *self);
319 int hw_atl_utils_fw_downld_dwords(struct aq_hw_s *self, u32 a,
322 int hw_atl_utils_fw_rpc_call(struct aq_hw_s *self, unsigned int rpc_size);
324 int hw_atl_utils_fw_rpc_wait(struct aq_hw_s *self,
325 struct hw_aq_atl_utils_fw_rpc **rpc);
327 extern const struct aq_fw_ops aq_fw_1x_ops;
328 extern const struct aq_fw_ops aq_fw_2x_ops;
330 #endif /* HW_ATL_UTILS_H */