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 #include "../aq_common.h"
19 #define HW_ATL_FLUSH() { (void)aq_hw_read_reg(self, 0x10); }
21 struct __packed hw_atl_stats_s {
39 union __packed ip_addr {
49 struct __packed hw_aq_atl_utils_fw_rpc {
75 u16 friendly_name_len;
76 u16 friendly_name[65];
78 u32 next_wol_pattern_offset;
83 u8 ipv4_source_address[4];
84 u8 ipv4_dest_address[4];
85 u16 tcp_source_port_number;
86 u16 tcp_dest_port_number;
87 } ipv4_tcp_syn_parameters;
91 u8 ipv6_source_address[16];
92 u8 ipv6_dest_address[16];
93 u16 tcp_source_port_number;
94 u16 tcp_dest_port_number;
95 } ipv6_tcp_syn_parameters;
99 } eapol_request_id_message_parameters;
107 } wol_bit_map_pattern;
112 u32 is_wake_on_link_down;
113 u32 is_wake_on_link_up;
118 struct __packed hw_aq_atl_utils_mbox {
122 struct hw_atl_stats_s stats;
125 struct __packed hw_atl_s {
127 struct hw_aq_atl_utils_mbox mbox;
131 unsigned int chip_features;
137 struct hw_aq_atl_utils_fw_rpc rpc;
140 #define SELF ((struct hw_atl_s *)self)
142 #define PHAL_ATLANTIC ((struct hw_atl_s *)((void *)(self)))
143 #define PHAL_ATLANTIC_A0 ((struct hw_atl_s *)((void *)(self)))
144 #define PHAL_ATLANTIC_B0 ((struct hw_atl_s *)((void *)(self)))
146 #define HAL_ATLANTIC_UTILS_CHIP_MIPS 0x00000001U
147 #define HAL_ATLANTIC_UTILS_CHIP_TPO2 0x00000002U
148 #define HAL_ATLANTIC_UTILS_CHIP_RPF2 0x00000004U
149 #define HAL_ATLANTIC_UTILS_CHIP_MPI_AQ 0x00000010U
150 #define HAL_ATLANTIC_UTILS_CHIP_REVISION_A0 0x01000000U
151 #define HAL_ATLANTIC_UTILS_CHIP_REVISION_B0 0x02000000U
153 #define IS_CHIP_FEATURE(_F_) (HAL_ATLANTIC_UTILS_CHIP_##_F_ & \
154 PHAL_ATLANTIC->chip_features)
156 enum hal_atl_utils_fw_state_e {
163 #define HAL_ATLANTIC_RATE_10G BIT(0)
164 #define HAL_ATLANTIC_RATE_5G BIT(1)
165 #define HAL_ATLANTIC_RATE_5GSR BIT(2)
166 #define HAL_ATLANTIC_RATE_2GS BIT(3)
167 #define HAL_ATLANTIC_RATE_1G BIT(4)
168 #define HAL_ATLANTIC_RATE_100M BIT(5)
169 #define HAL_ATLANTIC_RATE_INVALID BIT(6)
171 void hw_atl_utils_hw_chip_features_init(struct aq_hw_s *self, u32 *p);
173 void hw_atl_utils_mpi_read_stats(struct aq_hw_s *self,
174 struct hw_aq_atl_utils_mbox *pmbox);
176 void hw_atl_utils_mpi_set(struct aq_hw_s *self,
177 enum hal_atl_utils_fw_state_e state,
180 int hw_atl_utils_mpi_set_speed(struct aq_hw_s *self, u32 speed,
181 enum hal_atl_utils_fw_state_e state);
183 int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self,
184 struct aq_hw_link_status_s *link_status);
186 int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self,
187 struct aq_hw_caps_s *aq_hw_caps,
190 unsigned int hw_atl_utils_mbps_2_speed_index(unsigned int mbps);
192 int hw_atl_utils_hw_get_regs(struct aq_hw_s *self,
193 struct aq_hw_caps_s *aq_hw_caps,
196 int hw_atl_utils_hw_get_settings(struct aq_hw_s *self,
197 struct ethtool_cmd *cmd);
199 int hw_atl_utils_hw_set_power(struct aq_hw_s *self,
200 unsigned int power_state);
202 int hw_atl_utils_hw_deinit(struct aq_hw_s *self);
204 int hw_atl_utils_get_fw_version(struct aq_hw_s *self, u32 *fw_version);
206 int hw_atl_utils_get_hw_stats(struct aq_hw_s *self,
208 unsigned int *p_count);
210 #endif /* HW_ATL_UTILS_H */