xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852be/phl/hci/phl_trx_pcie.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2019 Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  *****************************************************************************/
15 #ifndef _PHL_TRX_PCIE_H_
16 #define _PHL_TRX_PCIE_H_
17 
18 #define WP_DELAY_THRES_MS 1000
19 #define WD_PAGE_SIZE 128
20 #ifdef CONFIG_PHL_REDUCE_MEM
21 #define RX_BUF_SIZE 8192 /* Rx buffer size (without RXBD info length) to 8 byte alignment  by DD suggestion  */
22 #else
23 #define RX_BUF_SIZE 11460 /* Rx buffer size (without RXBD info length) to 8 byte alignment  by DD suggestion  */
24 #endif
25 
26 enum dump_list_type {
27 	TYPE_WD_PAGE = 0,
28 	TYPE_PHL_RING = 1,
29 	TYPE_RING_STS = 2,
30 	TYPE_H2C_PKT = 3,
31 	TYPE_MAX = 0xFF
32 };
33 
34 
35 
36 struct rtw_rx_buf_ring {
37 	struct rtw_rx_buf *rx_buf;
38 	_os_list idle_rxbuf_list;
39 	_os_list busy_rxbuf_list;
40 	u16 idle_rxbuf_cnt;
41 	u16 busy_rxbuf_cnt;
42 	_os_lock idle_rxbuf_lock;
43 	_os_lock busy_rxbuf_lock;
44 };
45 
46 struct rtw_wp_tag {
47 	u8 *ptr;
48 };
49 
50 struct rtw_h2c_work {
51 	struct rtw_h2c_pkt *cmd;
52 	struct rtw_h2c_pkt *data;
53 	struct rtw_h2c_pkt *ldata;
54 	struct rtw_h2c_pkt **cmd_ring;
55 	struct rtw_h2c_pkt **data_ring;
56 	struct rtw_h2c_pkt **ldata_ring;
57 	_os_lock       	lock;
58 	u16		cmd_cnt;
59 	u16		cmd_idx;
60 	u16		data_cnt;
61 	u16		data_idx;
62 	u16		ldata_cnt;
63 	u16		ldata_idx;
64 };
65 
66 struct rtw_wd_page_ring {
67 	struct rtw_wd_page *wd_page;
68 	struct rtw_wd_page *wd_work;
69 	struct rtw_wd_page **wd_work_ring;
70  	_os_list	idle_wd_page_list;
71   	_os_list	busy_wd_page_list;
72 	_os_list	pending_wd_page_list;
73 	_os_lock	idle_lock;
74  	_os_lock	busy_lock;
75 	_os_lock	pending_lock;
76 	_os_lock	work_lock;
77 	_os_lock	wp_tag_lock;
78 	u16 		idle_wd_page_cnt;
79 	u16 		busy_wd_page_cnt;
80 	u16 		pending_wd_page_cnt;
81 	u16		wd_work_cnt;
82 	u16		wd_work_idx;
83 	struct rtw_h2c_work h2c_work;
84 	struct rtw_wp_tag wp_tag[WP_MAX_SEQ_NUMBER];
85 	u16 wp_seq;
86 	u16 cur_hw_res;
87 };
88 
89 struct phl_buf {
90 	u8 *vir_addr;
91 	_dma phy_addr;
92 	u8 cache;
93 	u16 buf_len;
94 };
95 
96 
97 
98 
99 /* struct hana_temp{ */
100 /* 	struct wp_tag wp_tag[DMA_CHANNEL_ENTRY][4096]; */
101 /* 	struct wp_tag wp_tag_hq_b0[4096]; */
102 /* 	struct wp_tag wp_tag_mq_b0[4096]; */
103 /* 	struct wp_tag wp_tag_mq_no_ps_b0[4096]; */
104 /* 	struct wp_tag wp_tag_hq_b1[4096]; */
105 /* 	struct wp_tag wp_tag_mq_b1[4096]; */
106 /* 	struct wp_tag wp_tag_mq_no_ps_b1[4096]; */
107 /* }; */
108 
109 enum rtw_phl_status phl_hook_trx_ops_pci(struct phl_info_t *phl_info);
110 
111 enum rtw_phl_status phl_cmd_set_l2_leave(struct phl_info_t *phl_info);
112 #endif	/* _PHL_TRX_PCIE_H_ */
113