1 // SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2 /* Copyright (C) 2014-2017 aQuantia Corporation. */
4 /* File hw_atl_utils_fw2x.c: Definition of firmware 2.x functions for
5 * Atlantic hardware abstraction layer.
10 #include "../atl_hw_regs.h"
12 #include "../atl_types.h"
13 #include "hw_atl_utils.h"
14 #include "hw_atl_llh.h"
16 #define HW_ATL_FW2X_MPI_EFUSE_ADDR 0x364
17 #define HW_ATL_FW2X_MPI_MBOX_ADDR 0x360
18 #define HW_ATL_FW2X_MPI_RPC_ADDR 0x334
20 #define HW_ATL_FW2X_MPI_CONTROL_ADDR 0x368
21 #define HW_ATL_FW2X_MPI_CONTROL2_ADDR 0x36C
22 #define HW_ATL_FW2X_MPI_LED_ADDR 0x31c
24 #define HW_ATL_FW2X_MPI_STATE_ADDR 0x370
25 #define HW_ATL_FW2X_MPI_STATE2_ADDR 0x374
27 #define HW_ATL_FW2X_CAP_SLEEP_PROXY BIT(CAPS_HI_SLEEP_PROXY)
28 #define HW_ATL_FW2X_CAP_WOL BIT(CAPS_HI_WOL)
30 #define HW_ATL_FW2X_CAP_EEE_1G_MASK BIT(CAPS_HI_1000BASET_FD_EEE)
31 #define HW_ATL_FW2X_CAP_EEE_2G5_MASK BIT(CAPS_HI_2P5GBASET_FD_EEE)
32 #define HW_ATL_FW2X_CAP_EEE_5G_MASK BIT(CAPS_HI_5GBASET_FD_EEE)
33 #define HW_ATL_FW2X_CAP_EEE_10G_MASK BIT(CAPS_HI_10GBASET_FD_EEE)
35 #define HAL_ATLANTIC_WOL_FILTERS_COUNT 8
36 #define HAL_ATLANTIC_UTILS_FW2X_MSG_WOL 0x0E
38 #define HW_ATL_FW_FEATURE_LED 0x03010026
40 struct fw2x_msg_wol_pattern
{
48 u8 magic_packet_enabled
;
50 struct fw2x_msg_wol_pattern filter
[HAL_ATLANTIC_WOL_FILTERS_COUNT
];
55 u32 link_down_timeout
;
58 static int aq_fw2x_set_link_speed(struct aq_hw_s
*self
, u32 speed
);
59 static int aq_fw2x_set_state(struct aq_hw_s
*self
,
60 enum hal_atl_utils_fw_state_e state
);
62 static int aq_fw2x_init(struct aq_hw_s
*self
)
65 struct hw_aq_atl_utils_mbox mbox
;
67 /* check 10 times by 1ms */
68 AQ_HW_WAIT_FOR(0U != (self
->mbox_addr
=
69 aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_MBOX_ADDR
)),
71 AQ_HW_WAIT_FOR(0U != (self
->rpc_addr
=
72 aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_RPC_ADDR
)),
76 hw_atl_utils_mpi_read_stats(self
, &mbox
);
78 self
->caps_lo
= mbox
.info
.caps_lo
;
83 static int aq_fw2x_deinit(struct aq_hw_s
*self
)
85 int err
= aq_fw2x_set_link_speed(self
, 0);
88 err
= aq_fw2x_set_state(self
, MPI_DEINIT
);
93 static enum hw_atl_fw2x_rate
link_speed_mask_2fw2x_ratemask(u32 speed
)
95 enum hw_atl_fw2x_rate rate
= 0;
97 if (speed
& AQ_NIC_RATE_10G
)
98 rate
|= FW2X_RATE_10G
;
100 if (speed
& AQ_NIC_RATE_5G
)
101 rate
|= FW2X_RATE_5G
;
103 if (speed
& AQ_NIC_RATE_5G5R
)
104 rate
|= FW2X_RATE_5G
;
106 if (speed
& AQ_NIC_RATE_2G5
)
107 rate
|= FW2X_RATE_2G5
;
109 if (speed
& AQ_NIC_RATE_1G
)
110 rate
|= FW2X_RATE_1G
;
112 if (speed
& AQ_NIC_RATE_100M
)
113 rate
|= FW2X_RATE_100M
;
118 static u32
fw2x_to_eee_mask(u32 speed
)
122 if (speed
& HW_ATL_FW2X_CAP_EEE_10G_MASK
)
123 rate
|= AQ_NIC_RATE_EEE_10G
;
125 if (speed
& HW_ATL_FW2X_CAP_EEE_5G_MASK
)
126 rate
|= AQ_NIC_RATE_EEE_5G
;
128 if (speed
& HW_ATL_FW2X_CAP_EEE_2G5_MASK
)
129 rate
|= AQ_NIC_RATE_EEE_2G5
;
131 if (speed
& HW_ATL_FW2X_CAP_EEE_1G_MASK
)
132 rate
|= AQ_NIC_RATE_EEE_1G
;
137 static int aq_fw2x_set_link_speed(struct aq_hw_s
*self
, u32 speed
)
139 u32 rate_mask
= link_speed_mask_2fw2x_ratemask(speed
);
140 u32 reg_val
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL_ADDR
);
141 u32 val
= rate_mask
| ((BIT(CAPS_LO_SMBUS_READ
) |
142 BIT(CAPS_LO_SMBUS_WRITE
) |
143 BIT(CAPS_LO_MACSEC
)) & reg_val
);
145 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL_ADDR
, val
);
150 static void aq_fw2x_set_mpi_flow_control(struct aq_hw_s
*self
, u32
*mpi_state
)
152 if (self
->aq_nic_cfg
->flow_control
& AQ_NIC_FC_RX
)
153 *mpi_state
|= BIT(CAPS_HI_PAUSE
);
155 *mpi_state
&= ~BIT(CAPS_HI_PAUSE
);
157 if (self
->aq_nic_cfg
->flow_control
& AQ_NIC_FC_TX
)
158 *mpi_state
|= BIT(CAPS_HI_ASYMMETRIC_PAUSE
);
160 *mpi_state
&= ~BIT(CAPS_HI_ASYMMETRIC_PAUSE
);
163 static int aq_fw2x_set_state(struct aq_hw_s
*self
,
164 enum hal_atl_utils_fw_state_e state
)
166 u32 mpi_state
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
);
170 mpi_state
&= ~BIT(CAPS_HI_LINK_DROP
);
171 aq_fw2x_set_mpi_flow_control(self
, &mpi_state
);
174 mpi_state
|= BIT(CAPS_HI_LINK_DROP
);
181 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
, mpi_state
);
185 static int aq_fw2x_update_link_status(struct aq_hw_s
*self
)
187 u32 mpi_state
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_STATE_ADDR
);
188 u32 speed
= mpi_state
& (FW2X_RATE_100M
| FW2X_RATE_1G
|
189 FW2X_RATE_2G5
| FW2X_RATE_5G
| FW2X_RATE_10G
);
190 struct aq_hw_link_status_s
*link_status
= &self
->aq_link_status
;
193 if (speed
& FW2X_RATE_10G
)
194 link_status
->mbps
= 10000;
195 else if (speed
& FW2X_RATE_5G
)
196 link_status
->mbps
= 5000;
197 else if (speed
& FW2X_RATE_2G5
)
198 link_status
->mbps
= 2500;
199 else if (speed
& FW2X_RATE_1G
)
200 link_status
->mbps
= 1000;
201 else if (speed
& FW2X_RATE_100M
)
202 link_status
->mbps
= 100;
204 link_status
->mbps
= 10000;
206 link_status
->mbps
= 0;
213 int aq_fw2x_get_mac_permanent(struct aq_hw_s
*self
, u8
*mac
)
218 u32 mac_addr
[2] = { 0 };
219 u32 efuse_addr
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_EFUSE_ADDR
);
221 pthread_mutex_lock(&self
->mbox_mutex
);
223 if (efuse_addr
!= 0) {
224 err
= hw_atl_utils_fw_downld_dwords(self
,
225 efuse_addr
+ (40U * 4U),
227 ARRAY_SIZE(mac_addr
));
230 mac_addr
[0] = rte_constant_bswap32(mac_addr
[0]);
231 mac_addr
[1] = rte_constant_bswap32(mac_addr
[1]);
234 rte_ether_addr_copy((struct rte_ether_addr
*)mac_addr
,
235 (struct rte_ether_addr
*)mac
);
237 if ((mac
[0] & 0x01U
) || ((mac
[0] | mac
[1] | mac
[2]) == 0x00U
)) {
238 unsigned int rnd
= (uint32_t)rte_rand();
240 //get_random_bytes(&rnd, sizeof(unsigned int));
247 mac
[5] = (u8
)(0xFFU
& l
);
249 mac
[4] = (u8
)(0xFFU
& l
);
251 mac
[3] = (u8
)(0xFFU
& l
);
253 mac
[2] = (u8
)(0xFFU
& l
);
254 mac
[1] = (u8
)(0xFFU
& h
);
256 mac
[0] = (u8
)(0xFFU
& h
);
260 pthread_mutex_unlock(&self
->mbox_mutex
);
265 static int aq_fw2x_update_stats(struct aq_hw_s
*self
)
268 u32 mpi_opts
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
);
269 u32 orig_stats_val
= mpi_opts
& BIT(CAPS_HI_STATISTICS
);
272 pthread_mutex_lock(&self
->mbox_mutex
);
274 /* Toggle statistics bit for FW to update */
275 mpi_opts
= mpi_opts
^ BIT(CAPS_HI_STATISTICS
);
276 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
, mpi_opts
);
278 /* Wait FW to report back */
279 AQ_HW_WAIT_FOR(orig_stats_val
!=
280 (aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_STATE2_ADDR
) &
281 BIT(CAPS_HI_STATISTICS
)),
286 err
= hw_atl_utils_update_stats(self
);
289 pthread_mutex_unlock(&self
->mbox_mutex
);
295 static int aq_fw2x_get_temp(struct aq_hw_s
*self
, int *temp
)
298 u32 mpi_opts
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
);
299 u32 temp_val
= mpi_opts
& BIT(CAPS_HI_TEMPERATURE
);
302 pthread_mutex_lock(&self
->mbox_mutex
);
304 /* Toggle statistics bit for FW to 0x36C.18 (CAPS_HI_TEMPERATURE) */
305 mpi_opts
= mpi_opts
^ BIT(CAPS_HI_TEMPERATURE
);
306 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
, mpi_opts
);
308 /* Wait FW to report back */
309 AQ_HW_WAIT_FOR(temp_val
!=
310 (aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_STATE2_ADDR
) &
311 BIT(CAPS_HI_TEMPERATURE
)), 1U, 10000U);
312 err
= hw_atl_utils_fw_downld_dwords(self
,
314 offsetof(struct hw_aq_atl_utils_mbox
, info
) +
315 offsetof(struct hw_aq_info
, phy_temperature
),
317 sizeof(temp_res
) / sizeof(u32
));
320 pthread_mutex_unlock(&self
->mbox_mutex
);
325 *temp
= temp_res
* 100 / 256;
329 static int aq_fw2x_get_cable_len(struct aq_hw_s
*self
, int *cable_len
)
334 err
= hw_atl_utils_fw_downld_dwords(self
,
336 offsetof(struct hw_aq_atl_utils_mbox
, info
) +
337 offsetof(struct hw_aq_info
, phy_temperature
),
339 sizeof(cable_len_res
) / sizeof(u32
));
344 *cable_len
= (cable_len_res
>> 16) & 0xFF;
352 static int aq_fw2x_set_sleep_proxy(struct aq_hw_s
*self
, u8
*mac
)
355 struct hw_aq_atl_utils_fw_rpc
*rpc
= NULL
;
356 struct offload_info
*cfg
= NULL
;
357 unsigned int rpc_size
= 0U;
360 rpc_size
= sizeof(rpc
->msg_id
) + sizeof(*cfg
);
362 err
= hw_atl_utils_fw_rpc_wait(self
, &rpc
);
366 memset(rpc
, 0, rpc_size
);
367 cfg
= (struct offload_info
*)(&rpc
->msg_id
+ 1);
369 memcpy(cfg
->mac_addr
, mac
, ETH_ALEN
);
370 cfg
->len
= sizeof(*cfg
);
372 /* Clear bit 0x36C.23 */
373 mpi_opts
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
);
374 mpi_opts
&= ~HW_ATL_FW2X_CAP_SLEEP_PROXY
;
376 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
, mpi_opts
);
378 err
= hw_atl_utils_fw_rpc_call(self
, rpc_size
);
382 /* Set bit 0x36C.23 */
383 mpi_opts
|= HW_ATL_FW2X_CAP_SLEEP_PROXY
;
384 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
, mpi_opts
);
386 AQ_HW_WAIT_FOR((aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_STATE2_ADDR
) &
387 HW_ATL_FW2X_CAP_SLEEP_PROXY
), 1U, 10000U);
392 static int aq_fw2x_set_wol_params(struct aq_hw_s
*self
, u8
*mac
)
395 struct fw2x_msg_wol
*msg
= NULL
;
398 struct hw_aq_atl_utils_fw_rpc
*rpc
= NULL
;
400 err
= hw_atl_utils_fw_rpc_wait(self
, &rpc
);
404 msg
= (struct fw2x_msg_wol
*)rpc
;
406 msg
->msg_id
= HAL_ATLANTIC_UTILS_FW2X_MSG_WOL
;
407 msg
->magic_packet_enabled
= true;
408 memcpy(msg
->hw_addr
, mac
, ETH_ALEN
);
410 mpi_opts
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
);
411 mpi_opts
&= ~(HW_ATL_FW2X_CAP_SLEEP_PROXY
| HW_ATL_FW2X_CAP_WOL
);
413 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
, mpi_opts
);
415 err
= hw_atl_utils_fw_rpc_call(self
, sizeof(*msg
));
419 /* Set bit 0x36C.24 */
420 mpi_opts
|= HW_ATL_FW2X_CAP_WOL
;
421 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
, mpi_opts
);
423 AQ_HW_WAIT_FOR((aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_STATE2_ADDR
) &
424 HW_ATL_FW2X_CAP_WOL
), 1U, 10000U);
429 static int aq_fw2x_set_power(struct aq_hw_s
*self
,
430 unsigned int power_state __rte_unused
,
435 if (self
->aq_nic_cfg
->wol
& AQ_NIC_WOL_ENABLED
) {
436 err
= aq_fw2x_set_sleep_proxy(self
, mac
);
439 err
= aq_fw2x_set_wol_params(self
, mac
);
447 static int aq_fw2x_set_eee_rate(struct aq_hw_s
*self
, u32 speed
)
449 u32 mpi_opts
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
);
450 mpi_opts
&= ~(HW_ATL_FW2X_CAP_EEE_1G_MASK
|
451 HW_ATL_FW2X_CAP_EEE_2G5_MASK
| HW_ATL_FW2X_CAP_EEE_5G_MASK
|
452 HW_ATL_FW2X_CAP_EEE_10G_MASK
);
454 if (speed
& AQ_NIC_RATE_EEE_10G
)
455 mpi_opts
|= HW_ATL_FW2X_CAP_EEE_10G_MASK
;
457 if (speed
& AQ_NIC_RATE_EEE_5G
)
458 mpi_opts
|= HW_ATL_FW2X_CAP_EEE_5G_MASK
;
460 if (speed
& AQ_NIC_RATE_EEE_2G5
)
461 mpi_opts
|= HW_ATL_FW2X_CAP_EEE_2G5_MASK
;
463 if (speed
& AQ_NIC_RATE_EEE_1G
)
464 mpi_opts
|= HW_ATL_FW2X_CAP_EEE_1G_MASK
;
466 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
, mpi_opts
);
471 static int aq_fw2x_get_eee_rate(struct aq_hw_s
*self
, u32
*rate
,
472 u32
*supported_rates
)
478 err
= hw_atl_utils_fw_downld_dwords(self
,
480 offsetof(struct hw_aq_atl_utils_mbox
, info
) +
481 offsetof(struct hw_aq_info
, caps_hi
),
483 sizeof(caps_hi
) / sizeof(u32
));
488 *supported_rates
= fw2x_to_eee_mask(caps_hi
);
490 mpi_state
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_STATE2_ADDR
);
491 *rate
= fw2x_to_eee_mask(mpi_state
);
496 static int aq_fw2x_get_flow_control(struct aq_hw_s
*self
, u32
*fc
)
498 u32 mpi_state
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
);
500 *fc
= ((mpi_state
& BIT(CAPS_HI_PAUSE
)) ? AQ_NIC_FC_RX
: 0) |
501 ((mpi_state
& BIT(CAPS_HI_ASYMMETRIC_PAUSE
)) ? AQ_NIC_FC_TX
: 0);
506 static int aq_fw2x_set_flow_control(struct aq_hw_s
*self
)
508 u32 mpi_state
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
);
510 aq_fw2x_set_mpi_flow_control(self
, &mpi_state
);
512 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL2_ADDR
, mpi_state
);
517 static int aq_fw2x_led_control(struct aq_hw_s
*self
, u32 mode
)
519 if (self
->fw_ver_actual
< HW_ATL_FW_FEATURE_LED
)
522 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_LED_ADDR
, mode
);
526 static int aq_fw2x_get_eeprom(struct aq_hw_s
*self
, int dev_addr
,
527 u32
*data
, u32 len
, u32 offset
)
529 u32 bytes_remains
= len
% sizeof(u32
);
530 u32 num_dwords
= len
/ sizeof(u32
);
531 struct smbus_request request
;
536 if ((self
->caps_lo
& BIT(CAPS_LO_SMBUS_READ
)) == 0)
539 pthread_mutex_lock(&self
->mbox_mutex
);
542 request
.device_id
= dev_addr
;
543 request
.address
= offset
;
544 request
.length
= len
;
546 /* Write SMBUS request to cfg memory */
547 err
= hw_atl_utils_fw_upload_dwords(self
, self
->rpc_addr
,
548 (u32
*)(void *)&request
,
549 sizeof(request
) / sizeof(u32
));
554 /* Toggle 0x368.CAPS_LO_SMBUS_READ bit */
555 mpi_opts
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL_ADDR
);
556 mpi_opts
^= BIT(CAPS_LO_SMBUS_READ
);
558 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL_ADDR
, mpi_opts
);
560 /* Wait until REQUEST_BIT matched in 0x370 */
562 AQ_HW_WAIT_FOR((aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_STATE_ADDR
) &
563 BIT(CAPS_LO_SMBUS_READ
)) == (mpi_opts
& BIT(CAPS_LO_SMBUS_READ
)),
569 err
= hw_atl_utils_fw_downld_dwords(self
, self
->rpc_addr
+ sizeof(u32
),
571 sizeof(result
) / sizeof(u32
));
582 err
= hw_atl_utils_fw_downld_dwords(self
,
583 self
->rpc_addr
+ sizeof(u32
) * 2,
594 err
= hw_atl_utils_fw_downld_dwords(self
,
595 self
->rpc_addr
+ (sizeof(u32
) * 2) +
596 (num_dwords
* sizeof(u32
)),
603 rte_memcpy((u8
*)data
+ len
- bytes_remains
,
604 &val
, bytes_remains
);
608 pthread_mutex_unlock(&self
->mbox_mutex
);
614 static int aq_fw2x_set_eeprom(struct aq_hw_s
*self
, int dev_addr
,
615 u32
*data
, u32 len
, u32 offset
)
617 struct smbus_request request
;
618 u32 mpi_opts
, result
= 0;
621 if ((self
->caps_lo
& BIT(CAPS_LO_SMBUS_WRITE
)) == 0)
625 request
.device_id
= dev_addr
;
626 request
.address
= offset
;
627 request
.length
= len
;
629 pthread_mutex_lock(&self
->mbox_mutex
);
631 /* Write SMBUS request to cfg memory */
632 err
= hw_atl_utils_fw_upload_dwords(self
, self
->rpc_addr
,
633 (u32
*)(void *)&request
,
634 sizeof(request
) / sizeof(u32
));
639 /* Write SMBUS data to cfg memory */
640 u32 num_dwords
= len
/ sizeof(u32
);
641 u32 bytes_remains
= len
% sizeof(u32
);
644 err
= hw_atl_utils_fw_upload_dwords(self
,
645 self
->rpc_addr
+ sizeof(request
),
656 rte_memcpy(&val
, (u8
*)data
+ (sizeof(u32
) * num_dwords
),
659 err
= hw_atl_utils_fw_upload_dwords(self
,
660 self
->rpc_addr
+ sizeof(request
) +
661 (num_dwords
* sizeof(u32
)),
669 /* Toggle 0x368.CAPS_LO_SMBUS_WRITE bit */
670 mpi_opts
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL_ADDR
);
671 mpi_opts
^= BIT(CAPS_LO_SMBUS_WRITE
);
673 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL_ADDR
, mpi_opts
);
675 /* Wait until REQUEST_BIT matched in 0x370 */
676 AQ_HW_WAIT_FOR((aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_STATE_ADDR
) &
677 BIT(CAPS_LO_SMBUS_WRITE
)) == (mpi_opts
& BIT(CAPS_LO_SMBUS_WRITE
)),
683 /* Read status of write operation */
684 err
= hw_atl_utils_fw_downld_dwords(self
, self
->rpc_addr
+ sizeof(u32
),
686 sizeof(result
) / sizeof(u32
));
697 pthread_mutex_unlock(&self
->mbox_mutex
);
702 static int aq_fw2x_send_macsec_request(struct aq_hw_s
*self
,
703 struct macsec_msg_fw_request
*req
,
704 struct macsec_msg_fw_response
*response
)
709 if (!req
|| !response
)
712 if ((self
->caps_lo
& BIT(CAPS_LO_MACSEC
)) == 0)
715 pthread_mutex_lock(&self
->mbox_mutex
);
717 /* Write macsec request to cfg memory */
718 err
= hw_atl_utils_fw_upload_dwords(self
, self
->rpc_addr
,
720 RTE_ALIGN(sizeof(*req
) / sizeof(u32
), sizeof(u32
)));
725 /* Toggle 0x368.CAPS_LO_MACSEC bit */
726 mpi_opts
= aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_CONTROL_ADDR
);
727 mpi_opts
^= BIT(CAPS_LO_MACSEC
);
729 aq_hw_write_reg(self
, HW_ATL_FW2X_MPI_CONTROL_ADDR
, mpi_opts
);
731 /* Wait until REQUEST_BIT matched in 0x370 */
732 AQ_HW_WAIT_FOR((aq_hw_read_reg(self
, HW_ATL_FW2X_MPI_STATE_ADDR
) &
733 BIT(CAPS_LO_MACSEC
)) == (mpi_opts
& BIT(CAPS_LO_MACSEC
)),
739 /* Read status of write operation */
740 err
= hw_atl_utils_fw_downld_dwords(self
, self
->rpc_addr
+ sizeof(u32
),
741 (u32
*)(void *)response
,
742 RTE_ALIGN(sizeof(*response
) / sizeof(u32
), sizeof(u32
)));
745 pthread_mutex_unlock(&self
->mbox_mutex
);
750 const struct aq_fw_ops aq_fw_2x_ops
= {
751 .init
= aq_fw2x_init
,
752 .deinit
= aq_fw2x_deinit
,
754 .get_mac_permanent
= aq_fw2x_get_mac_permanent
,
755 .set_link_speed
= aq_fw2x_set_link_speed
,
756 .set_state
= aq_fw2x_set_state
,
757 .update_link_status
= aq_fw2x_update_link_status
,
758 .update_stats
= aq_fw2x_update_stats
,
759 .set_power
= aq_fw2x_set_power
,
760 .get_temp
= aq_fw2x_get_temp
,
761 .get_cable_len
= aq_fw2x_get_cable_len
,
762 .set_eee_rate
= aq_fw2x_set_eee_rate
,
763 .get_eee_rate
= aq_fw2x_get_eee_rate
,
764 .get_flow_control
= aq_fw2x_get_flow_control
,
765 .set_flow_control
= aq_fw2x_set_flow_control
,
766 .led_control
= aq_fw2x_led_control
,
767 .get_eeprom
= aq_fw2x_get_eeprom
,
768 .set_eeprom
= aq_fw2x_set_eeprom
,
769 .send_macsec_req
= aq_fw2x_send_macsec_request
,