xref: /linux/drivers/net/wireless/realtek/rtw88/mac.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2018-2019  Realtek Corporation
3  */
4 
5 #ifndef __RTW_MAC_H__
6 #define __RTW_MAC_H__
7 
8 #define RTW_HW_PORT_NUM		5
9 #define cut_version_to_mask(cut) (0x1 << ((cut) + 1))
10 #define DDMA_POLLING_COUNT	1000
11 #define C2H_PKT_BUF		256
12 #define REPORT_BUF		128
13 #define PHY_STATUS_SIZE		4
14 #define ILLEGAL_KEY_GROUP	0xFAAAAA00
15 
16 /* HW memory address */
17 #define OCPBASE_RXBUF_FW_88XX		0x18680000
18 #define OCPBASE_TXBUF_88XX		0x18780000
19 #define OCPBASE_ROM_88XX		0x00000000
20 #define OCPBASE_IMEM_88XX		0x00030000
21 #define OCPBASE_DMEM_88XX		0x00200000
22 #define OCPBASE_EMEM_88XX		0x00100000
23 
24 #define RSVD_PG_DRV_NUM			16
25 #define RSVD_PG_H2C_EXTRAINFO_NUM	24
26 #define RSVD_PG_H2C_STATICINFO_NUM	8
27 #define RSVD_PG_H2CQ_NUM		8
28 #define RSVD_PG_CPU_INSTRUCTION_NUM	0
29 #define RSVD_PG_FW_TXBUF_NUM		4
30 
31 void rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw,
32 			 u8 primary_ch_idx);
33 int rtw_pwr_seq_parser(struct rtw_dev *rtwdev,
34 		       const struct rtw_pwr_seq_cmd * const *cmd_seq);
35 int rtw_mac_power_on(struct rtw_dev *rtwdev);
36 void rtw_mac_power_off(struct rtw_dev *rtwdev);
37 int rtw_download_firmware(struct rtw_dev *rtwdev, struct rtw_fw_state *fw);
38 int rtw_mac_init(struct rtw_dev *rtwdev);
39 void rtw_mac_flush_queues(struct rtw_dev *rtwdev, u32 queues, bool drop);
40 int rtw_set_trx_fifo_info(struct rtw_dev *rtwdev);
41 int rtw_ddma_to_fw_fifo(struct rtw_dev *rtwdev, u32 ocp_src, u32 size);
42 
43 static inline void rtw_mac_flush_all_queues(struct rtw_dev *rtwdev, bool drop)
44 {
45 	rtw_mac_flush_queues(rtwdev, BIT(rtwdev->hw->queues) - 1, drop);
46 }
47 
48 #endif
49