18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/* Atlantic Network Driver
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2014-2019 aQuantia Corporation
58c2ecf20Sopenharmony_ci * Copyright (C) 2019-2020 Marvell International Ltd.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/* File aq_hw.h: Declaration of abstract interface for NIC hardware specific
98c2ecf20Sopenharmony_ci * functions.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef AQ_HW_H
138c2ecf20Sopenharmony_ci#define AQ_HW_H
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include "aq_common.h"
168c2ecf20Sopenharmony_ci#include "aq_rss.h"
178c2ecf20Sopenharmony_ci#include "hw_atl/hw_atl_utils.h"
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define AQ_HW_MAC_COUNTER_HZ   312500000ll
208c2ecf20Sopenharmony_ci#define AQ_HW_PHY_COUNTER_HZ   160000000ll
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cienum aq_tc_mode {
238c2ecf20Sopenharmony_ci	AQ_TC_MODE_INVALID = -1,
248c2ecf20Sopenharmony_ci	AQ_TC_MODE_8TCS,
258c2ecf20Sopenharmony_ci	AQ_TC_MODE_4TCS,
268c2ecf20Sopenharmony_ci};
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define AQ_RX_FIRST_LOC_FVLANID     0U
298c2ecf20Sopenharmony_ci#define AQ_RX_LAST_LOC_FVLANID	   15U
308c2ecf20Sopenharmony_ci#define AQ_RX_FIRST_LOC_FETHERT    16U
318c2ecf20Sopenharmony_ci#define AQ_RX_LAST_LOC_FETHERT	   31U
328c2ecf20Sopenharmony_ci#define AQ_RX_FIRST_LOC_FL3L4	   32U
338c2ecf20Sopenharmony_ci#define AQ_RX_LAST_LOC_FL3L4	   39U
348c2ecf20Sopenharmony_ci#define AQ_RX_MAX_RXNFC_LOC	   AQ_RX_LAST_LOC_FL3L4
358c2ecf20Sopenharmony_ci#define AQ_VLAN_MAX_FILTERS   \
368c2ecf20Sopenharmony_ci			(AQ_RX_LAST_LOC_FVLANID - AQ_RX_FIRST_LOC_FVLANID + 1U)
378c2ecf20Sopenharmony_ci#define AQ_RX_QUEUE_NOT_ASSIGNED   0xFFU
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define AQ_FRAC_PER_NS 0x100000000LL
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* Used for rate to Mbps conversion */
428c2ecf20Sopenharmony_ci#define AQ_MBPS_DIVISOR         125000 /* 1000000 / 8 */
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* NIC H/W capabilities */
458c2ecf20Sopenharmony_cistruct aq_hw_caps_s {
468c2ecf20Sopenharmony_ci	u64 hw_features;
478c2ecf20Sopenharmony_ci	u64 link_speed_msk;
488c2ecf20Sopenharmony_ci	unsigned int hw_priv_flags;
498c2ecf20Sopenharmony_ci	u32 media_type;
508c2ecf20Sopenharmony_ci	u32 rxds_max;
518c2ecf20Sopenharmony_ci	u32 txds_max;
528c2ecf20Sopenharmony_ci	u32 rxds_min;
538c2ecf20Sopenharmony_ci	u32 txds_min;
548c2ecf20Sopenharmony_ci	u32 txhwb_alignment;
558c2ecf20Sopenharmony_ci	u32 irq_mask;
568c2ecf20Sopenharmony_ci	u32 vecs;
578c2ecf20Sopenharmony_ci	u32 mtu;
588c2ecf20Sopenharmony_ci	u32 mac_regs_count;
598c2ecf20Sopenharmony_ci	u32 hw_alive_check_addr;
608c2ecf20Sopenharmony_ci	u8 msix_irqs;
618c2ecf20Sopenharmony_ci	u8 tcs_max;
628c2ecf20Sopenharmony_ci	u8 rxd_alignment;
638c2ecf20Sopenharmony_ci	u8 rxd_size;
648c2ecf20Sopenharmony_ci	u8 txd_alignment;
658c2ecf20Sopenharmony_ci	u8 txd_size;
668c2ecf20Sopenharmony_ci	u8 tx_rings;
678c2ecf20Sopenharmony_ci	u8 rx_rings;
688c2ecf20Sopenharmony_ci	bool flow_control;
698c2ecf20Sopenharmony_ci	bool is_64_dma;
708c2ecf20Sopenharmony_ci	bool op64bit;
718c2ecf20Sopenharmony_ci	u32 quirks;
728c2ecf20Sopenharmony_ci	u32 priv_data_len;
738c2ecf20Sopenharmony_ci};
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistruct aq_hw_link_status_s {
768c2ecf20Sopenharmony_ci	unsigned int mbps;
778c2ecf20Sopenharmony_ci	bool full_duplex;
788c2ecf20Sopenharmony_ci	u32 lp_link_speed_msk;
798c2ecf20Sopenharmony_ci	u32 lp_flow_control;
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cistruct aq_stats_s {
838c2ecf20Sopenharmony_ci	u64 brc;
848c2ecf20Sopenharmony_ci	u64 btc;
858c2ecf20Sopenharmony_ci	u64 uprc;
868c2ecf20Sopenharmony_ci	u64 mprc;
878c2ecf20Sopenharmony_ci	u64 bprc;
888c2ecf20Sopenharmony_ci	u64 erpt;
898c2ecf20Sopenharmony_ci	u64 uptc;
908c2ecf20Sopenharmony_ci	u64 mptc;
918c2ecf20Sopenharmony_ci	u64 bptc;
928c2ecf20Sopenharmony_ci	u64 erpr;
938c2ecf20Sopenharmony_ci	u64 mbtc;
948c2ecf20Sopenharmony_ci	u64 bbtc;
958c2ecf20Sopenharmony_ci	u64 mbrc;
968c2ecf20Sopenharmony_ci	u64 bbrc;
978c2ecf20Sopenharmony_ci	u64 ubrc;
988c2ecf20Sopenharmony_ci	u64 ubtc;
998c2ecf20Sopenharmony_ci	u64 dpc;
1008c2ecf20Sopenharmony_ci	u64 dma_pkt_rc;
1018c2ecf20Sopenharmony_ci	u64 dma_pkt_tc;
1028c2ecf20Sopenharmony_ci	u64 dma_oct_rc;
1038c2ecf20Sopenharmony_ci	u64 dma_oct_tc;
1048c2ecf20Sopenharmony_ci};
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define AQ_HW_IRQ_INVALID 0U
1078c2ecf20Sopenharmony_ci#define AQ_HW_IRQ_LEGACY  1U
1088c2ecf20Sopenharmony_ci#define AQ_HW_IRQ_MSI     2U
1098c2ecf20Sopenharmony_ci#define AQ_HW_IRQ_MSIX    3U
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define AQ_HW_SERVICE_IRQS   1U
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define AQ_HW_POWER_STATE_D0   0U
1148c2ecf20Sopenharmony_ci#define AQ_HW_POWER_STATE_D3   3U
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci#define AQ_HW_FLAG_STARTED     0x00000004U
1178c2ecf20Sopenharmony_ci#define AQ_HW_FLAG_STOPPING    0x00000008U
1188c2ecf20Sopenharmony_ci#define AQ_HW_FLAG_RESETTING   0x00000010U
1198c2ecf20Sopenharmony_ci#define AQ_HW_FLAG_CLOSING     0x00000020U
1208c2ecf20Sopenharmony_ci#define AQ_HW_PTP_AVAILABLE    0x01000000U
1218c2ecf20Sopenharmony_ci#define AQ_HW_LINK_DOWN        0x04000000U
1228c2ecf20Sopenharmony_ci#define AQ_HW_FLAG_ERR_UNPLUG  0x40000000U
1238c2ecf20Sopenharmony_ci#define AQ_HW_FLAG_ERR_HW      0x80000000U
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci#define AQ_HW_FLAG_ERRORS      (AQ_HW_FLAG_ERR_HW | AQ_HW_FLAG_ERR_UNPLUG)
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci#define AQ_NIC_FLAGS_IS_NOT_READY (AQ_NIC_FLAG_STOPPING | \
1288c2ecf20Sopenharmony_ci			AQ_NIC_FLAG_RESETTING | AQ_NIC_FLAG_CLOSING | \
1298c2ecf20Sopenharmony_ci			AQ_NIC_FLAG_ERR_UNPLUG | AQ_NIC_FLAG_ERR_HW)
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci#define AQ_NIC_FLAGS_IS_NOT_TX_READY (AQ_NIC_FLAGS_IS_NOT_READY | \
1328c2ecf20Sopenharmony_ci					AQ_NIC_LINK_DOWN)
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define AQ_HW_MEDIA_TYPE_TP    1U
1358c2ecf20Sopenharmony_ci#define AQ_HW_MEDIA_TYPE_FIBRE 2U
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define AQ_HW_TXD_MULTIPLE 8U
1388c2ecf20Sopenharmony_ci#define AQ_HW_RXD_MULTIPLE 8U
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define AQ_HW_QUEUES_MAX                32U
1418c2ecf20Sopenharmony_ci#define AQ_HW_MULTICAST_ADDRESS_MAX     32U
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci#define AQ_HW_PTP_TC                    2U
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define AQ_HW_LED_BLINK    0x2U
1468c2ecf20Sopenharmony_ci#define AQ_HW_LED_DEFAULT  0x0U
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci#define AQ_HW_MEDIA_DETECT_CNT 6000
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_cienum aq_priv_flags {
1518c2ecf20Sopenharmony_ci	AQ_HW_LOOPBACK_DMA_SYS,
1528c2ecf20Sopenharmony_ci	AQ_HW_LOOPBACK_PKT_SYS,
1538c2ecf20Sopenharmony_ci	AQ_HW_LOOPBACK_DMA_NET,
1548c2ecf20Sopenharmony_ci	AQ_HW_LOOPBACK_PHYINT_SYS,
1558c2ecf20Sopenharmony_ci	AQ_HW_LOOPBACK_PHYEXT_SYS,
1568c2ecf20Sopenharmony_ci};
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci#define AQ_HW_LOOPBACK_MASK	(BIT(AQ_HW_LOOPBACK_DMA_SYS) |\
1598c2ecf20Sopenharmony_ci				 BIT(AQ_HW_LOOPBACK_PKT_SYS) |\
1608c2ecf20Sopenharmony_ci				 BIT(AQ_HW_LOOPBACK_DMA_NET) |\
1618c2ecf20Sopenharmony_ci				 BIT(AQ_HW_LOOPBACK_PHYINT_SYS) |\
1628c2ecf20Sopenharmony_ci				 BIT(AQ_HW_LOOPBACK_PHYEXT_SYS))
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci#define ATL_HW_CHIP_MIPS         0x00000001U
1658c2ecf20Sopenharmony_ci#define ATL_HW_CHIP_TPO2         0x00000002U
1668c2ecf20Sopenharmony_ci#define ATL_HW_CHIP_RPF2         0x00000004U
1678c2ecf20Sopenharmony_ci#define ATL_HW_CHIP_MPI_AQ       0x00000010U
1688c2ecf20Sopenharmony_ci#define ATL_HW_CHIP_ATLANTIC     0x00800000U
1698c2ecf20Sopenharmony_ci#define ATL_HW_CHIP_REVISION_A0  0x01000000U
1708c2ecf20Sopenharmony_ci#define ATL_HW_CHIP_REVISION_B0  0x02000000U
1718c2ecf20Sopenharmony_ci#define ATL_HW_CHIP_REVISION_B1  0x04000000U
1728c2ecf20Sopenharmony_ci#define ATL_HW_CHIP_ANTIGUA      0x08000000U
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci#define ATL_HW_IS_CHIP_FEATURE(_HW_, _F_) (!!(ATL_HW_CHIP_##_F_ & \
1758c2ecf20Sopenharmony_ci	(_HW_)->chip_features))
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_cistruct aq_hw_s {
1788c2ecf20Sopenharmony_ci	atomic_t flags;
1798c2ecf20Sopenharmony_ci	u8 rbl_enabled:1;
1808c2ecf20Sopenharmony_ci	struct aq_nic_cfg_s *aq_nic_cfg;
1818c2ecf20Sopenharmony_ci	const struct aq_fw_ops *aq_fw_ops;
1828c2ecf20Sopenharmony_ci	void __iomem *mmio;
1838c2ecf20Sopenharmony_ci	struct aq_hw_link_status_s aq_link_status;
1848c2ecf20Sopenharmony_ci	struct hw_atl_utils_mbox mbox;
1858c2ecf20Sopenharmony_ci	struct hw_atl_stats_s last_stats;
1868c2ecf20Sopenharmony_ci	struct aq_stats_s curr_stats;
1878c2ecf20Sopenharmony_ci	u64 speed;
1888c2ecf20Sopenharmony_ci	u32 itr_tx;
1898c2ecf20Sopenharmony_ci	u32 itr_rx;
1908c2ecf20Sopenharmony_ci	unsigned int chip_features;
1918c2ecf20Sopenharmony_ci	u32 fw_ver_actual;
1928c2ecf20Sopenharmony_ci	atomic_t dpc;
1938c2ecf20Sopenharmony_ci	u32 mbox_addr;
1948c2ecf20Sopenharmony_ci	u32 rpc_addr;
1958c2ecf20Sopenharmony_ci	u32 settings_addr;
1968c2ecf20Sopenharmony_ci	u32 rpc_tid;
1978c2ecf20Sopenharmony_ci	struct hw_atl_utils_fw_rpc rpc;
1988c2ecf20Sopenharmony_ci	s64 ptp_clk_offset;
1998c2ecf20Sopenharmony_ci	u16 phy_id;
2008c2ecf20Sopenharmony_ci	void *priv;
2018c2ecf20Sopenharmony_ci};
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_cistruct aq_ring_s;
2048c2ecf20Sopenharmony_cistruct aq_ring_param_s;
2058c2ecf20Sopenharmony_cistruct sk_buff;
2068c2ecf20Sopenharmony_cistruct aq_rx_filter_l3l4;
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_cistruct aq_hw_ops {
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci	int (*hw_ring_tx_xmit)(struct aq_hw_s *self, struct aq_ring_s *aq_ring,
2118c2ecf20Sopenharmony_ci			       unsigned int frags);
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci	int (*hw_ring_rx_receive)(struct aq_hw_s *self,
2148c2ecf20Sopenharmony_ci				  struct aq_ring_s *aq_ring);
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci	int (*hw_ring_rx_fill)(struct aq_hw_s *self, struct aq_ring_s *aq_ring,
2178c2ecf20Sopenharmony_ci			       unsigned int sw_tail_old);
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci	int (*hw_ring_tx_head_update)(struct aq_hw_s *self,
2208c2ecf20Sopenharmony_ci				      struct aq_ring_s *aq_ring);
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci	int (*hw_set_mac_address)(struct aq_hw_s *self, u8 *mac_addr);
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	int (*hw_soft_reset)(struct aq_hw_s *self);
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci	int (*hw_prepare)(struct aq_hw_s *self,
2278c2ecf20Sopenharmony_ci			  const struct aq_fw_ops **fw_ops);
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci	int (*hw_reset)(struct aq_hw_s *self);
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci	int (*hw_init)(struct aq_hw_s *self, u8 *mac_addr);
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci	int (*hw_start)(struct aq_hw_s *self);
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci	int (*hw_stop)(struct aq_hw_s *self);
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci	int (*hw_ring_tx_init)(struct aq_hw_s *self, struct aq_ring_s *aq_ring,
2388c2ecf20Sopenharmony_ci			       struct aq_ring_param_s *aq_ring_param);
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci	int (*hw_ring_tx_start)(struct aq_hw_s *self,
2418c2ecf20Sopenharmony_ci				struct aq_ring_s *aq_ring);
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci	int (*hw_ring_tx_stop)(struct aq_hw_s *self,
2448c2ecf20Sopenharmony_ci			       struct aq_ring_s *aq_ring);
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci	int (*hw_ring_rx_init)(struct aq_hw_s *self,
2478c2ecf20Sopenharmony_ci			       struct aq_ring_s *aq_ring,
2488c2ecf20Sopenharmony_ci			       struct aq_ring_param_s *aq_ring_param);
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci	int (*hw_ring_rx_start)(struct aq_hw_s *self,
2518c2ecf20Sopenharmony_ci				struct aq_ring_s *aq_ring);
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci	int (*hw_ring_rx_stop)(struct aq_hw_s *self,
2548c2ecf20Sopenharmony_ci			       struct aq_ring_s *aq_ring);
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci	int (*hw_irq_enable)(struct aq_hw_s *self, u64 mask);
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci	int (*hw_irq_disable)(struct aq_hw_s *self, u64 mask);
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci	int (*hw_irq_read)(struct aq_hw_s *self, u64 *mask);
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci	int (*hw_packet_filter_set)(struct aq_hw_s *self,
2638c2ecf20Sopenharmony_ci				    unsigned int packet_filter);
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci	int (*hw_filter_l3l4_set)(struct aq_hw_s *self,
2668c2ecf20Sopenharmony_ci				  struct aq_rx_filter_l3l4 *data);
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci	int (*hw_filter_l3l4_clear)(struct aq_hw_s *self,
2698c2ecf20Sopenharmony_ci				    struct aq_rx_filter_l3l4 *data);
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	int (*hw_filter_l2_set)(struct aq_hw_s *self,
2728c2ecf20Sopenharmony_ci				struct aq_rx_filter_l2 *data);
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci	int (*hw_filter_l2_clear)(struct aq_hw_s *self,
2758c2ecf20Sopenharmony_ci				  struct aq_rx_filter_l2 *data);
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci	int (*hw_filter_vlan_set)(struct aq_hw_s *self,
2788c2ecf20Sopenharmony_ci				  struct aq_rx_filter_vlan *aq_vlans);
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci	int (*hw_filter_vlan_ctrl)(struct aq_hw_s *self, bool enable);
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	int (*hw_multicast_list_set)(struct aq_hw_s *self,
2838c2ecf20Sopenharmony_ci				     u8 ar_mac[AQ_HW_MULTICAST_ADDRESS_MAX]
2848c2ecf20Sopenharmony_ci				     [ETH_ALEN],
2858c2ecf20Sopenharmony_ci				     u32 count);
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	int (*hw_interrupt_moderation_set)(struct aq_hw_s *self);
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci	int (*hw_rss_set)(struct aq_hw_s *self,
2908c2ecf20Sopenharmony_ci			  struct aq_rss_parameters *rss_params);
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci	int (*hw_rss_hash_set)(struct aq_hw_s *self,
2938c2ecf20Sopenharmony_ci			       struct aq_rss_parameters *rss_params);
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci	int (*hw_tc_rate_limit_set)(struct aq_hw_s *self);
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci	int (*hw_get_regs)(struct aq_hw_s *self,
2988c2ecf20Sopenharmony_ci			   const struct aq_hw_caps_s *aq_hw_caps,
2998c2ecf20Sopenharmony_ci			   u32 *regs_buff);
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci	struct aq_stats_s *(*hw_get_hw_stats)(struct aq_hw_s *self);
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci	u32 (*hw_get_fw_version)(struct aq_hw_s *self);
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci	int (*hw_set_offload)(struct aq_hw_s *self,
3068c2ecf20Sopenharmony_ci			      struct aq_nic_cfg_s *aq_nic_cfg);
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci	int (*hw_ring_hwts_rx_fill)(struct aq_hw_s *self,
3098c2ecf20Sopenharmony_ci				    struct aq_ring_s *aq_ring);
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	int (*hw_ring_hwts_rx_receive)(struct aq_hw_s *self,
3128c2ecf20Sopenharmony_ci				       struct aq_ring_s *ring);
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci	void (*hw_get_ptp_ts)(struct aq_hw_s *self, u64 *stamp);
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci	int (*hw_adj_clock_freq)(struct aq_hw_s *self, s32 delta);
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci	int (*hw_adj_sys_clock)(struct aq_hw_s *self, s64 delta);
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci	int (*hw_set_sys_clock)(struct aq_hw_s *self, u64 time, u64 ts);
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci	int (*hw_ts_to_sys_clock)(struct aq_hw_s *self, u64 ts, u64 *time);
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci	int (*hw_gpio_pulse)(struct aq_hw_s *self, u32 index, u64 start,
3258c2ecf20Sopenharmony_ci			     u32 period);
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci	int (*hw_extts_gpio_enable)(struct aq_hw_s *self, u32 index,
3288c2ecf20Sopenharmony_ci				    u32 enable);
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci	int (*hw_get_sync_ts)(struct aq_hw_s *self, u64 *ts);
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci	u16 (*rx_extract_ts)(struct aq_hw_s *self, u8 *p, unsigned int len,
3338c2ecf20Sopenharmony_ci			     u64 *timestamp);
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci	int (*extract_hwts)(struct aq_hw_s *self, u8 *p, unsigned int len,
3368c2ecf20Sopenharmony_ci			    u64 *timestamp);
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci	int (*hw_set_fc)(struct aq_hw_s *self, u32 fc, u32 tc);
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci	int (*hw_set_loopback)(struct aq_hw_s *self, u32 mode, bool enable);
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci	int (*hw_get_mac_temp)(struct aq_hw_s *self, u32 *temp);
3438c2ecf20Sopenharmony_ci};
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_cistruct aq_fw_ops {
3468c2ecf20Sopenharmony_ci	int (*init)(struct aq_hw_s *self);
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci	int (*deinit)(struct aq_hw_s *self);
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci	int (*reset)(struct aq_hw_s *self);
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci	int (*renegotiate)(struct aq_hw_s *self);
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci	int (*get_mac_permanent)(struct aq_hw_s *self, u8 *mac);
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci	int (*set_link_speed)(struct aq_hw_s *self, u32 speed);
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci	int (*set_state)(struct aq_hw_s *self,
3598c2ecf20Sopenharmony_ci			 enum hal_atl_utils_fw_state_e state);
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci	int (*update_link_status)(struct aq_hw_s *self);
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci	int (*update_stats)(struct aq_hw_s *self);
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci	int (*get_mac_temp)(struct aq_hw_s *self, int *temp);
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci	int (*get_phy_temp)(struct aq_hw_s *self, int *temp);
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci	u32 (*get_flow_control)(struct aq_hw_s *self, u32 *fcmode);
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci	int (*set_flow_control)(struct aq_hw_s *self);
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci	int (*led_control)(struct aq_hw_s *self, u32 mode);
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci	int (*set_phyloopback)(struct aq_hw_s *self, u32 mode, bool enable);
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci	int (*set_power)(struct aq_hw_s *self, unsigned int power_state,
3788c2ecf20Sopenharmony_ci			 u8 *mac);
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci	int (*send_fw_request)(struct aq_hw_s *self,
3818c2ecf20Sopenharmony_ci			       const struct hw_fw_request_iface *fw_req,
3828c2ecf20Sopenharmony_ci			       size_t size);
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci	void (*enable_ptp)(struct aq_hw_s *self, int enable);
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci	void (*adjust_ptp)(struct aq_hw_s *self, uint64_t adj);
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci	int (*set_eee_rate)(struct aq_hw_s *self, u32 speed);
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_ci	int (*get_eee_rate)(struct aq_hw_s *self, u32 *rate,
3918c2ecf20Sopenharmony_ci			    u32 *supported_rates);
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci	int (*set_downshift)(struct aq_hw_s *self, u32 counter);
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci	int (*set_media_detect)(struct aq_hw_s *self, bool enable);
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci	u32 (*get_link_capabilities)(struct aq_hw_s *self);
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci	int (*send_macsec_req)(struct aq_hw_s *self,
4008c2ecf20Sopenharmony_ci			       struct macsec_msg_fw_request *msg,
4018c2ecf20Sopenharmony_ci			       struct macsec_msg_fw_response *resp);
4028c2ecf20Sopenharmony_ci};
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ci#endif /* AQ_HW_H */
405