1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2024  Realtek Corporation.*/
3 
4 #ifndef __RTL92DU_TRX_H__
5 #define __RTL92DU_TRX_H__
6 
7 #define TX_SELE_HQ				BIT(0)	/* High Queue */
8 #define TX_SELE_LQ				BIT(1)	/* Low Queue */
9 #define TX_SELE_NQ				BIT(2)	/* Normal Queue */
10 
11 #define TX_TOTAL_PAGE_NUMBER_92DU			0xF8
12 #define TEST_PAGE_NUM_PUBQ_92DU				0x89
13 #define TX_TOTAL_PAGE_NUMBER_92D_DUAL_MAC		0x7A
14 #define NORMAL_PAGE_NUM_PUBQ_92D_DUAL_MAC		0x5A
15 #define NORMAL_PAGE_NUM_HPQ_92D_DUAL_MAC		0x10
16 #define NORMAL_PAGE_NUM_LPQ_92D_DUAL_MAC		0x10
17 #define NORMAL_PAGE_NUM_NORMALQ_92D_DUAL_MAC		0
18 
19 #define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER			0xF5
20 
21 #define WMM_NORMAL_PAGE_NUM_PUBQ_92D			0x65
22 #define WMM_NORMAL_PAGE_NUM_HPQ_92D			0x30
23 #define WMM_NORMAL_PAGE_NUM_LPQ_92D			0x30
24 #define WMM_NORMAL_PAGE_NUM_NPQ_92D			0x30
25 
26 #define WMM_NORMAL_PAGE_NUM_PUBQ_92D_DUAL_MAC		0x32
27 #define WMM_NORMAL_PAGE_NUM_HPQ_92D_DUAL_MAC		0x18
28 #define WMM_NORMAL_PAGE_NUM_LPQ_92D_DUAL_MAC		0x18
29 #define WMM_NORMAL_PAGE_NUM_NPQ_92D_DUAL_MAC		0x18
30 
set_tx_desc_bmc(__le32 * __txdesc,u32 __value)31 static inline void set_tx_desc_bmc(__le32 *__txdesc, u32 __value)
32 {
33 	le32p_replace_bits(__txdesc, __value, BIT(24));
34 }
35 
set_tx_desc_agg_break(__le32 * __txdesc,u32 __value)36 static inline void set_tx_desc_agg_break(__le32 *__txdesc, u32 __value)
37 {
38 	le32p_replace_bits((__txdesc + 1), __value, BIT(6));
39 }
40 
set_tx_desc_tx_desc_checksum(__le32 * __txdesc,u32 __value)41 static inline void set_tx_desc_tx_desc_checksum(__le32 *__txdesc, u32 __value)
42 {
43 	le32p_replace_bits((__txdesc + 7), __value, GENMASK(15, 0));
44 }
45 
46 void rtl92du_tx_fill_desc(struct ieee80211_hw *hw,
47 			  struct ieee80211_hdr *hdr, u8 *pdesc,
48 			  u8 *pbd_desc_tx, struct ieee80211_tx_info *info,
49 			  struct ieee80211_sta *sta,
50 			  struct sk_buff *skb, u8 hw_queue,
51 			  struct rtl_tcb_desc *ptcb_desc);
52 int rtl92du_endpoint_mapping(struct ieee80211_hw *hw);
53 u16 rtl92du_mq_to_hwq(__le16 fc, u16 mac80211_queue_index);
54 struct sk_buff *rtl92du_tx_aggregate_hdl(struct ieee80211_hw *hw,
55 					 struct sk_buff_head *list);
56 void rtl92du_tx_cleanup(struct ieee80211_hw *hw, struct sk_buff  *skb);
57 int rtl92du_tx_post_hdl(struct ieee80211_hw *hw, struct urb *urb,
58 			struct sk_buff *skb);
59 
60 #endif
61