1811853daSPing-Ke Shih // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2811853daSPing-Ke Shih /* Copyright(c) 2018-2019  Realtek Corporation
3811853daSPing-Ke Shih  */
4811853daSPing-Ke Shih 
5811853daSPing-Ke Shih #include "main.h"
6811853daSPing-Ke Shih #include "coex.h"
7811853daSPing-Ke Shih #include "fw.h"
8811853daSPing-Ke Shih #include "tx.h"
9811853daSPing-Ke Shih #include "rx.h"
10811853daSPing-Ke Shih #include "phy.h"
11811853daSPing-Ke Shih #include "rtw8723d.h"
12811853daSPing-Ke Shih #include "rtw8723d_table.h"
13811853daSPing-Ke Shih #include "mac.h"
14811853daSPing-Ke Shih #include "reg.h"
15811853daSPing-Ke Shih #include "debug.h"
16811853daSPing-Ke Shih 
17ba9f0d1bSPing-Ke Shih static const struct rtw_hw_reg rtw8723d_txagc[] = {
18ba9f0d1bSPing-Ke Shih 	[DESC_RATE1M]	= { .addr = 0xe08, .mask = 0x0000ff00 },
19ba9f0d1bSPing-Ke Shih 	[DESC_RATE2M]	= { .addr = 0x86c, .mask = 0x0000ff00 },
20ba9f0d1bSPing-Ke Shih 	[DESC_RATE5_5M]	= { .addr = 0x86c, .mask = 0x00ff0000 },
21ba9f0d1bSPing-Ke Shih 	[DESC_RATE11M]	= { .addr = 0x86c, .mask = 0xff000000 },
22ba9f0d1bSPing-Ke Shih 	[DESC_RATE6M]	= { .addr = 0xe00, .mask = 0x000000ff },
23ba9f0d1bSPing-Ke Shih 	[DESC_RATE9M]	= { .addr = 0xe00, .mask = 0x0000ff00 },
24ba9f0d1bSPing-Ke Shih 	[DESC_RATE12M]	= { .addr = 0xe00, .mask = 0x00ff0000 },
25ba9f0d1bSPing-Ke Shih 	[DESC_RATE18M]	= { .addr = 0xe00, .mask = 0xff000000 },
26ba9f0d1bSPing-Ke Shih 	[DESC_RATE24M]	= { .addr = 0xe04, .mask = 0x000000ff },
27ba9f0d1bSPing-Ke Shih 	[DESC_RATE36M]	= { .addr = 0xe04, .mask = 0x0000ff00 },
28ba9f0d1bSPing-Ke Shih 	[DESC_RATE48M]	= { .addr = 0xe04, .mask = 0x00ff0000 },
29ba9f0d1bSPing-Ke Shih 	[DESC_RATE54M]	= { .addr = 0xe04, .mask = 0xff000000 },
30ba9f0d1bSPing-Ke Shih 	[DESC_RATEMCS0]	= { .addr = 0xe10, .mask = 0x000000ff },
31ba9f0d1bSPing-Ke Shih 	[DESC_RATEMCS1]	= { .addr = 0xe10, .mask = 0x0000ff00 },
32ba9f0d1bSPing-Ke Shih 	[DESC_RATEMCS2]	= { .addr = 0xe10, .mask = 0x00ff0000 },
33ba9f0d1bSPing-Ke Shih 	[DESC_RATEMCS3]	= { .addr = 0xe10, .mask = 0xff000000 },
34ba9f0d1bSPing-Ke Shih 	[DESC_RATEMCS4]	= { .addr = 0xe14, .mask = 0x000000ff },
35ba9f0d1bSPing-Ke Shih 	[DESC_RATEMCS5]	= { .addr = 0xe14, .mask = 0x0000ff00 },
36ba9f0d1bSPing-Ke Shih 	[DESC_RATEMCS6]	= { .addr = 0xe14, .mask = 0x00ff0000 },
37ba9f0d1bSPing-Ke Shih 	[DESC_RATEMCS7]	= { .addr = 0xe14, .mask = 0xff000000 },
38ba9f0d1bSPing-Ke Shih };
39ba9f0d1bSPing-Ke Shih 
40ab0a031eSPing-Ke Shih static void rtw8723de_efuse_parsing(struct rtw_efuse *efuse,
41ab0a031eSPing-Ke Shih 				    struct rtw8723d_efuse *map)
42ab0a031eSPing-Ke Shih {
43ab0a031eSPing-Ke Shih 	ether_addr_copy(efuse->addr, map->e.mac_addr);
44ab0a031eSPing-Ke Shih }
45ab0a031eSPing-Ke Shih 
46ab0a031eSPing-Ke Shih static int rtw8723d_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
47ab0a031eSPing-Ke Shih {
48ab0a031eSPing-Ke Shih 	struct rtw_efuse *efuse = &rtwdev->efuse;
49ab0a031eSPing-Ke Shih 	struct rtw8723d_efuse *map;
50ab0a031eSPing-Ke Shih 	int i;
51ab0a031eSPing-Ke Shih 
52ab0a031eSPing-Ke Shih 	map = (struct rtw8723d_efuse *)log_map;
53ab0a031eSPing-Ke Shih 
54ab0a031eSPing-Ke Shih 	efuse->rfe_option = 0;
55ab0a031eSPing-Ke Shih 	efuse->rf_board_option = map->rf_board_option;
56ab0a031eSPing-Ke Shih 	efuse->crystal_cap = map->xtal_k;
57ab0a031eSPing-Ke Shih 	efuse->pa_type_2g = map->pa_type;
58ab0a031eSPing-Ke Shih 	efuse->lna_type_2g = map->lna_type_2g[0];
59ab0a031eSPing-Ke Shih 	efuse->channel_plan = map->channel_plan;
60ab0a031eSPing-Ke Shih 	efuse->country_code[0] = map->country_code[0];
61ab0a031eSPing-Ke Shih 	efuse->country_code[1] = map->country_code[1];
62ab0a031eSPing-Ke Shih 	efuse->bt_setting = map->rf_bt_setting;
63ab0a031eSPing-Ke Shih 	efuse->regd = map->rf_board_option & 0x7;
64ab0a031eSPing-Ke Shih 	efuse->thermal_meter[0] = map->thermal_meter;
65ab0a031eSPing-Ke Shih 	efuse->thermal_meter_k = map->thermal_meter;
66ab0a031eSPing-Ke Shih 
67ab0a031eSPing-Ke Shih 	for (i = 0; i < 4; i++)
68ab0a031eSPing-Ke Shih 		efuse->txpwr_idx_table[i] = map->txpwr_idx_table[i];
69ab0a031eSPing-Ke Shih 
70ab0a031eSPing-Ke Shih 	switch (rtw_hci_type(rtwdev)) {
71ab0a031eSPing-Ke Shih 	case RTW_HCI_TYPE_PCIE:
72ab0a031eSPing-Ke Shih 		rtw8723de_efuse_parsing(efuse, map);
73ab0a031eSPing-Ke Shih 		break;
74ab0a031eSPing-Ke Shih 	default:
75ab0a031eSPing-Ke Shih 		/* unsupported now */
76ab0a031eSPing-Ke Shih 		return -ENOTSUPP;
77ab0a031eSPing-Ke Shih 	}
78ab0a031eSPing-Ke Shih 
79ab0a031eSPing-Ke Shih 	return 0;
80ab0a031eSPing-Ke Shih }
81ab0a031eSPing-Ke Shih 
821afb5eb7SPing-Ke Shih static void rtw8723d_cfg_ldo25(struct rtw_dev *rtwdev, bool enable)
831afb5eb7SPing-Ke Shih {
841afb5eb7SPing-Ke Shih 	u8 ldo_pwr;
851afb5eb7SPing-Ke Shih 
861afb5eb7SPing-Ke Shih 	ldo_pwr = rtw_read8(rtwdev, REG_LDO_EFUSE_CTRL + 3);
871afb5eb7SPing-Ke Shih 	if (enable) {
881afb5eb7SPing-Ke Shih 		ldo_pwr &= ~BIT_MASK_LDO25_VOLTAGE;
891afb5eb7SPing-Ke Shih 		ldo_pwr = (BIT_LDO25_VOLTAGE_V25 << 4) | BIT_LDO25_EN;
901afb5eb7SPing-Ke Shih 	} else {
911afb5eb7SPing-Ke Shih 		ldo_pwr &= ~BIT_LDO25_EN;
921afb5eb7SPing-Ke Shih 	}
931afb5eb7SPing-Ke Shih 	rtw_write8(rtwdev, REG_LDO_EFUSE_CTRL + 3, ldo_pwr);
941afb5eb7SPing-Ke Shih }
951afb5eb7SPing-Ke Shih 
96ba9f0d1bSPing-Ke Shih static void
97ba9f0d1bSPing-Ke Shih rtw8723d_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs)
98ba9f0d1bSPing-Ke Shih {
99ba9f0d1bSPing-Ke Shih 	struct rtw_hal *hal = &rtwdev->hal;
100ba9f0d1bSPing-Ke Shih 	const struct rtw_hw_reg *txagc;
101ba9f0d1bSPing-Ke Shih 	u8 rate, pwr_index;
102ba9f0d1bSPing-Ke Shih 	int j;
103ba9f0d1bSPing-Ke Shih 
104ba9f0d1bSPing-Ke Shih 	for (j = 0; j < rtw_rate_size[rs]; j++) {
105ba9f0d1bSPing-Ke Shih 		rate = rtw_rate_section[rs][j];
106ba9f0d1bSPing-Ke Shih 		pwr_index = hal->tx_pwr_tbl[path][rate];
107ba9f0d1bSPing-Ke Shih 
108ba9f0d1bSPing-Ke Shih 		if (rate >= ARRAY_SIZE(rtw8723d_txagc)) {
109ba9f0d1bSPing-Ke Shih 			rtw_warn(rtwdev, "rate 0x%x isn't supported\n", rate);
110ba9f0d1bSPing-Ke Shih 			continue;
111ba9f0d1bSPing-Ke Shih 		}
112ba9f0d1bSPing-Ke Shih 		txagc = &rtw8723d_txagc[rate];
113ba9f0d1bSPing-Ke Shih 		if (!txagc->addr) {
114ba9f0d1bSPing-Ke Shih 			rtw_warn(rtwdev, "rate 0x%x isn't defined\n", rate);
115ba9f0d1bSPing-Ke Shih 			continue;
116ba9f0d1bSPing-Ke Shih 		}
117ba9f0d1bSPing-Ke Shih 
118ba9f0d1bSPing-Ke Shih 		rtw_write32_mask(rtwdev, txagc->addr, txagc->mask, pwr_index);
119ba9f0d1bSPing-Ke Shih 	}
120ba9f0d1bSPing-Ke Shih }
121ba9f0d1bSPing-Ke Shih 
122ba9f0d1bSPing-Ke Shih static void rtw8723d_set_tx_power_index(struct rtw_dev *rtwdev)
123ba9f0d1bSPing-Ke Shih {
124ba9f0d1bSPing-Ke Shih 	struct rtw_hal *hal = &rtwdev->hal;
125ba9f0d1bSPing-Ke Shih 	int rs, path;
126ba9f0d1bSPing-Ke Shih 
127ba9f0d1bSPing-Ke Shih 	for (path = 0; path < hal->rf_path_num; path++) {
128ba9f0d1bSPing-Ke Shih 		for (rs = 0; rs <= RTW_RATE_SECTION_HT_1S; rs++)
129ba9f0d1bSPing-Ke Shih 			rtw8723d_set_tx_power_index_by_rate(rtwdev, path, rs);
130ba9f0d1bSPing-Ke Shih 	}
131ba9f0d1bSPing-Ke Shih }
132ba9f0d1bSPing-Ke Shih 
13344baa97cSPing-Ke Shih static void rtw8723d_efuse_grant(struct rtw_dev *rtwdev, bool on)
13444baa97cSPing-Ke Shih {
13544baa97cSPing-Ke Shih 	if (on) {
13644baa97cSPing-Ke Shih 		rtw_write8(rtwdev, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON);
13744baa97cSPing-Ke Shih 
13844baa97cSPing-Ke Shih 		rtw_write16_set(rtwdev, REG_SYS_FUNC_EN, BIT_FEN_ELDR);
13944baa97cSPing-Ke Shih 		rtw_write16_set(rtwdev, REG_SYS_CLKR, BIT_LOADER_CLK_EN | BIT_ANA8M);
14044baa97cSPing-Ke Shih 	} else {
14144baa97cSPing-Ke Shih 		rtw_write8(rtwdev, REG_EFUSE_ACCESS, EFUSE_ACCESS_OFF);
14244baa97cSPing-Ke Shih 	}
14344baa97cSPing-Ke Shih }
14444baa97cSPing-Ke Shih 
145811853daSPing-Ke Shih static struct rtw_chip_ops rtw8723d_ops = {
146ab0a031eSPing-Ke Shih 	.read_efuse		= rtw8723d_read_efuse,
147e0c27cdbSPing-Ke Shih 	.read_rf		= rtw_phy_read_rf_sipi,
148e0c27cdbSPing-Ke Shih 	.write_rf		= rtw_phy_write_rf_reg_sipi,
149ba9f0d1bSPing-Ke Shih 	.set_tx_power_index	= rtw8723d_set_tx_power_index,
150811853daSPing-Ke Shih 	.set_antenna		= NULL,
1511afb5eb7SPing-Ke Shih 	.cfg_ldo25		= rtw8723d_cfg_ldo25,
15244baa97cSPing-Ke Shih 	.efuse_grant		= rtw8723d_efuse_grant,
15393ae973fSPing-Ke Shih 	.config_bfee		= NULL,
15493ae973fSPing-Ke Shih 	.set_gid_table		= NULL,
15593ae973fSPing-Ke Shih 	.cfg_csi_rate		= NULL,
156811853daSPing-Ke Shih };
157811853daSPing-Ke Shih 
158c57bd7c3SPing-Ke Shih static const struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8723d[] = {
159c57bd7c3SPing-Ke Shih 	{0x0005,
160c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
161c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
162c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
163c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(3) | BIT(7), 0},
164c57bd7c3SPing-Ke Shih 	{0x0086,
165c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
166c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_SDIO_MSK,
167c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_SDIO,
168c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), 0},
169c57bd7c3SPing-Ke Shih 	{0x0086,
170c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
171c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_SDIO_MSK,
172c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_SDIO,
173c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, BIT(1), BIT(1)},
174c57bd7c3SPing-Ke Shih 	{0x004A,
175c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
176c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_USB_MSK,
177c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
178c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), 0},
179c57bd7c3SPing-Ke Shih 	{0x0005,
180c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
181c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
182c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
183c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(3) | BIT(4), 0},
184c57bd7c3SPing-Ke Shih 	{0x0023,
185c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
186c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_SDIO_MSK,
187c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
188c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(4), 0},
189c57bd7c3SPing-Ke Shih 	{0x0301,
190c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
191c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_PCI_MSK,
192c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
193c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0},
194c57bd7c3SPing-Ke Shih 	{0xFFFF,
195c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
196c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
197c57bd7c3SPing-Ke Shih 	 0,
198c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_END, 0, 0},
199c57bd7c3SPing-Ke Shih };
200c57bd7c3SPing-Ke Shih 
201c57bd7c3SPing-Ke Shih static const struct rtw_pwr_seq_cmd trans_cardemu_to_act_8723d[] = {
202c57bd7c3SPing-Ke Shih 	{0x0020,
203c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
204c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
205c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
206c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
207c57bd7c3SPing-Ke Shih 	{0x0001,
208c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
209c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
210c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
211c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_DELAY, 1, RTW_PWR_DELAY_MS},
212c57bd7c3SPing-Ke Shih 	{0x0000,
213c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
214c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
215c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
216c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(5), 0},
217c57bd7c3SPing-Ke Shih 	{0x0005,
218c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
219c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
220c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
221c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, (BIT(4) | BIT(3) | BIT(2)), 0},
222c57bd7c3SPing-Ke Shih 	{0x0075,
223c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
224c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_PCI_MSK,
225c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
226c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
227c57bd7c3SPing-Ke Shih 	{0x0006,
228c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
229c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
230c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
231c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, BIT(1), BIT(1)},
232c57bd7c3SPing-Ke Shih 	{0x0075,
233c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
234c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_PCI_MSK,
235c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
236c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), 0},
237c57bd7c3SPing-Ke Shih 	{0x0006,
238c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
239c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
240c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
241c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
242c57bd7c3SPing-Ke Shih 	{0x0005,
243c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
244c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
245c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
246c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, (BIT(1) | BIT(0)), 0},
247c57bd7c3SPing-Ke Shih 	{0x0005,
248c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
249c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
250c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
251c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(7), 0},
252c57bd7c3SPing-Ke Shih 	{0x0005,
253c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
254c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
255c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
256c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, (BIT(4) | BIT(3)), 0},
257c57bd7c3SPing-Ke Shih 	{0x0005,
258c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
259c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
260c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
261c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
262c57bd7c3SPing-Ke Shih 	{0x0005,
263c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
264c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
265c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
266c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, BIT(0), 0},
267c57bd7c3SPing-Ke Shih 	{0x0010,
268c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
269c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
270c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
271c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(6), BIT(6)},
272c57bd7c3SPing-Ke Shih 	{0x0049,
273c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
274c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
275c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
276c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(1), BIT(1)},
277c57bd7c3SPing-Ke Shih 	{0x0063,
278c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
279c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
280c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
281c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(1), BIT(1)},
282c57bd7c3SPing-Ke Shih 	{0x0062,
283c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
284c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
285c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
286c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(1), 0},
287c57bd7c3SPing-Ke Shih 	{0x0058,
288c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
289c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
290c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
291c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
292c57bd7c3SPing-Ke Shih 	{0x005A,
293c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
294c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
295c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
296c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(1), BIT(1)},
297c57bd7c3SPing-Ke Shih 	{0x0068,
298c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_TEST_MSK,
299c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
300c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
301c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(3), BIT(3)},
302c57bd7c3SPing-Ke Shih 	{0x0069,
303c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
304c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
305c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
306c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(6), BIT(6)},
307c57bd7c3SPing-Ke Shih 	{0x001f,
308c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
309c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
310c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
311c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0x00},
312c57bd7c3SPing-Ke Shih 	{0x0077,
313c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
314c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
315c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
316c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0x00},
317c57bd7c3SPing-Ke Shih 	{0x001f,
318c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
319c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
320c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
321c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0x07},
322c57bd7c3SPing-Ke Shih 	{0x0077,
323c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
324c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
325c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
326c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0x07},
327c57bd7c3SPing-Ke Shih 	{0xFFFF,
328c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
329c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
330c57bd7c3SPing-Ke Shih 	 0,
331c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_END, 0, 0},
332c57bd7c3SPing-Ke Shih };
333c57bd7c3SPing-Ke Shih 
334c57bd7c3SPing-Ke Shih static const struct rtw_pwr_seq_cmd *card_enable_flow_8723d[] = {
335c57bd7c3SPing-Ke Shih 	trans_carddis_to_cardemu_8723d,
336c57bd7c3SPing-Ke Shih 	trans_cardemu_to_act_8723d,
337c57bd7c3SPing-Ke Shih 	NULL
338c57bd7c3SPing-Ke Shih };
339c57bd7c3SPing-Ke Shih 
340c57bd7c3SPing-Ke Shih static const struct rtw_pwr_seq_cmd trans_act_to_lps_8723d[] = {
341c57bd7c3SPing-Ke Shih 	{0x0301,
342c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
343c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_PCI_MSK,
344c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
345c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0xFF},
346c57bd7c3SPing-Ke Shih 	{0x0522,
347c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
348c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
349c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
350c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0xFF},
351c57bd7c3SPing-Ke Shih 	{0x05F8,
352c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
353c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
354c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
355c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, 0xFF, 0},
356c57bd7c3SPing-Ke Shih 	{0x05F9,
357c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
358c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
359c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
360c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, 0xFF, 0},
361c57bd7c3SPing-Ke Shih 	{0x05FA,
362c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
363c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
364c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
365c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, 0xFF, 0},
366c57bd7c3SPing-Ke Shih 	{0x05FB,
367c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
368c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
369c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
370c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, 0xFF, 0},
371c57bd7c3SPing-Ke Shih 	{0x0002,
372c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
373c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
374c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
375c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), 0},
376c57bd7c3SPing-Ke Shih 	{0x0002,
377c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
378c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
379c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
380c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_DELAY, 0, RTW_PWR_DELAY_US},
381c57bd7c3SPing-Ke Shih 	{0x0002,
382c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
383c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
384c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
385c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(1), 0},
386c57bd7c3SPing-Ke Shih 	{0x0100,
387c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
388c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
389c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
390c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0x03},
391c57bd7c3SPing-Ke Shih 	{0x0101,
392c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
393c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
394c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
395c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(1), 0},
396c57bd7c3SPing-Ke Shih 	{0x0093,
397c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
398c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_SDIO_MSK,
399c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
400c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0x00},
401c57bd7c3SPing-Ke Shih 	{0x0553,
402c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
403c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
404c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
405c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(5), BIT(5)},
406c57bd7c3SPing-Ke Shih 	{0xFFFF,
407c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
408c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
409c57bd7c3SPing-Ke Shih 	 0,
410c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_END, 0, 0},
411c57bd7c3SPing-Ke Shih };
412c57bd7c3SPing-Ke Shih 
413c57bd7c3SPing-Ke Shih static const struct rtw_pwr_seq_cmd trans_act_to_pre_carddis_8723d[] = {
414c57bd7c3SPing-Ke Shih 	{0x0003,
415c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
416c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
417c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
418c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(2), 0},
419c57bd7c3SPing-Ke Shih 	{0x0080,
420c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
421c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
422c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
423c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0},
424c57bd7c3SPing-Ke Shih 	{0xFFFF,
425c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
426c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
427c57bd7c3SPing-Ke Shih 	 0,
428c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_END, 0, 0},
429c57bd7c3SPing-Ke Shih };
430c57bd7c3SPing-Ke Shih 
431c57bd7c3SPing-Ke Shih static const struct rtw_pwr_seq_cmd trans_act_to_cardemu_8723d[] = {
432c57bd7c3SPing-Ke Shih 	{0x0002,
433c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
434c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
435c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
436c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), 0},
437c57bd7c3SPing-Ke Shih 	{0x0049,
438c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
439c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
440c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
441c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(1), 0},
442c57bd7c3SPing-Ke Shih 	{0x0006,
443c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
444c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
445c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
446c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
447c57bd7c3SPing-Ke Shih 	{0x0005,
448c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
449c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
450c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
451c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(1), BIT(1)},
452c57bd7c3SPing-Ke Shih 	{0x0005,
453c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
454c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
455c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
456c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, BIT(1), 0},
457c57bd7c3SPing-Ke Shih 	{0x0010,
458c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
459c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
460c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
461c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(6), 0},
462c57bd7c3SPing-Ke Shih 	{0x0000,
463c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
464c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
465c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
466c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(5), BIT(5)},
467c57bd7c3SPing-Ke Shih 	{0x0020,
468c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
469c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
470c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
471c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), 0},
472c57bd7c3SPing-Ke Shih 	{0xFFFF,
473c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
474c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
475c57bd7c3SPing-Ke Shih 	 0,
476c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_END, 0, 0},
477c57bd7c3SPing-Ke Shih };
478c57bd7c3SPing-Ke Shih 
479c57bd7c3SPing-Ke Shih static const struct rtw_pwr_seq_cmd trans_cardemu_to_carddis_8723d[] = {
480c57bd7c3SPing-Ke Shih 	{0x0007,
481c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
482c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_SDIO_MSK,
483c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
484c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0x20},
485c57bd7c3SPing-Ke Shih 	{0x0005,
486c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
487c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
488c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
489c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(3) | BIT(4), BIT(3)},
490c57bd7c3SPing-Ke Shih 	{0x0005,
491c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
492c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_PCI_MSK,
493c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
494c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(2), BIT(2)},
495c57bd7c3SPing-Ke Shih 	{0x0005,
496c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
497c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_PCI_MSK,
498c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
499c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(3) | BIT(4), BIT(3) | BIT(4)},
500c57bd7c3SPing-Ke Shih 	{0x004A,
501c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
502c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_USB_MSK,
503c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
504c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), 1},
505c57bd7c3SPing-Ke Shih 	{0x0023,
506c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
507c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_SDIO_MSK,
508c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
509c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(4), BIT(4)},
510c57bd7c3SPing-Ke Shih 	{0x0086,
511c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
512c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_SDIO_MSK,
513c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_SDIO,
514c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
515c57bd7c3SPing-Ke Shih 	{0x0086,
516c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
517c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_SDIO_MSK,
518c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_SDIO,
519c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_POLLING, BIT(1), 0},
520c57bd7c3SPing-Ke Shih 	{0xFFFF,
521c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
522c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
523c57bd7c3SPing-Ke Shih 	 0,
524c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_END, 0, 0},
525c57bd7c3SPing-Ke Shih };
526c57bd7c3SPing-Ke Shih 
527c57bd7c3SPing-Ke Shih static const struct rtw_pwr_seq_cmd trans_act_to_post_carddis_8723d[] = {
528c57bd7c3SPing-Ke Shih 	{0x001D,
529c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
530c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
531c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
532c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), 0},
533c57bd7c3SPing-Ke Shih 	{0x001D,
534c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
535c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
536c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
537c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
538c57bd7c3SPing-Ke Shih 	{0x001C,
539c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
540c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
541c57bd7c3SPing-Ke Shih 	 RTW_PWR_ADDR_MAC,
542c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_WRITE, 0xFF, 0x0E},
543c57bd7c3SPing-Ke Shih 	{0xFFFF,
544c57bd7c3SPing-Ke Shih 	 RTW_PWR_CUT_ALL_MSK,
545c57bd7c3SPing-Ke Shih 	 RTW_PWR_INTF_ALL_MSK,
546c57bd7c3SPing-Ke Shih 	 0,
547c57bd7c3SPing-Ke Shih 	 RTW_PWR_CMD_END, 0, 0},
548c57bd7c3SPing-Ke Shih };
549c57bd7c3SPing-Ke Shih 
550c57bd7c3SPing-Ke Shih static const struct rtw_pwr_seq_cmd *card_disable_flow_8723d[] = {
551c57bd7c3SPing-Ke Shih 	trans_act_to_lps_8723d,
552c57bd7c3SPing-Ke Shih 	trans_act_to_pre_carddis_8723d,
553c57bd7c3SPing-Ke Shih 	trans_act_to_cardemu_8723d,
554c57bd7c3SPing-Ke Shih 	trans_cardemu_to_carddis_8723d,
555c57bd7c3SPing-Ke Shih 	trans_act_to_post_carddis_8723d,
556c57bd7c3SPing-Ke Shih 	NULL
557c57bd7c3SPing-Ke Shih };
558c57bd7c3SPing-Ke Shih 
559d91277deSPing-Ke Shih static const struct rtw_page_table page_table_8723d[] = {
560d91277deSPing-Ke Shih 	{12, 2, 2, 0, 1},
561d91277deSPing-Ke Shih 	{12, 2, 2, 0, 1},
562d91277deSPing-Ke Shih 	{12, 2, 2, 0, 1},
563d91277deSPing-Ke Shih 	{12, 2, 2, 0, 1},
564d91277deSPing-Ke Shih 	{12, 2, 2, 0, 1},
565d91277deSPing-Ke Shih };
566d91277deSPing-Ke Shih 
567d91277deSPing-Ke Shih static const struct rtw_rqpn rqpn_table_8723d[] = {
568d91277deSPing-Ke Shih 	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
569d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
570d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH},
571d91277deSPing-Ke Shih 	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
572d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
573d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH},
574d91277deSPing-Ke Shih 	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
575d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_HIGH,
576d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
577d91277deSPing-Ke Shih 	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
578d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
579d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
580d91277deSPing-Ke Shih 	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
581d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
582d91277deSPing-Ke Shih 	 RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH},
583d91277deSPing-Ke Shih };
584d91277deSPing-Ke Shih 
585e0c27cdbSPing-Ke Shih static const struct rtw_rf_sipi_addr rtw8723d_rf_sipi_addr[] = {
586e0c27cdbSPing-Ke Shih 	[RF_PATH_A] = { .hssi_1 = 0x820, .lssi_read    = 0x8a0,
587e0c27cdbSPing-Ke Shih 			.hssi_2 = 0x824, .lssi_read_pi = 0x8b8},
588e0c27cdbSPing-Ke Shih 	[RF_PATH_B] = { .hssi_1 = 0x828, .lssi_read    = 0x8a4,
589e0c27cdbSPing-Ke Shih 			.hssi_2 = 0x82c, .lssi_read_pi = 0x8bc},
590e0c27cdbSPing-Ke Shih };
591e0c27cdbSPing-Ke Shih 
5929874f685SPing-Ke Shih static const struct rtw_rfe_def rtw8723d_rfe_defs[] = {
5939874f685SPing-Ke Shih 	[0] = { .phy_pg_tbl	= &rtw8723d_bb_pg_tbl,
5949874f685SPing-Ke Shih 		.txpwr_lmt_tbl	= &rtw8723d_txpwr_lmt_tbl,},
5959874f685SPing-Ke Shih };
5969874f685SPing-Ke Shih 
597811853daSPing-Ke Shih struct rtw_chip_info rtw8723d_hw_spec = {
598811853daSPing-Ke Shih 	.ops = &rtw8723d_ops,
599811853daSPing-Ke Shih 	.id = RTW_CHIP_TYPE_8723D,
600811853daSPing-Ke Shih 	.fw_name = "rtw88/rtw8723d_fw.bin",
60115d2fcc6SPing-Ke Shih 	.wlan_cpu = RTW_WCPU_11N,
602811853daSPing-Ke Shih 	.tx_pkt_desc_sz = 40,
603811853daSPing-Ke Shih 	.tx_buf_desc_sz = 16,
604811853daSPing-Ke Shih 	.rx_pkt_desc_sz = 24,
605811853daSPing-Ke Shih 	.rx_buf_desc_sz = 8,
606811853daSPing-Ke Shih 	.phy_efuse_size = 512,
607811853daSPing-Ke Shih 	.log_efuse_size = 512,
608811853daSPing-Ke Shih 	.ptct_efuse_size = 96 + 1,
609d91277deSPing-Ke Shih 	.txff_size = 32768,
610d91277deSPing-Ke Shih 	.rxff_size = 16384,
611811853daSPing-Ke Shih 	.txgi_factor = 1,
612811853daSPing-Ke Shih 	.is_pwr_by_rate_dec = true,
613811853daSPing-Ke Shih 	.max_power_index = 0x3f,
614811853daSPing-Ke Shih 	.csi_buf_pg_num = 0,
615811853daSPing-Ke Shih 	.band = RTW_BAND_2G,
616d91277deSPing-Ke Shih 	.page_size = 128,
617811853daSPing-Ke Shih 	.ht_supported = true,
618811853daSPing-Ke Shih 	.vht_supported = false,
619811853daSPing-Ke Shih 	.lps_deep_mode_supported = 0,
620811853daSPing-Ke Shih 	.sys_func_en = 0xFD,
621c57bd7c3SPing-Ke Shih 	.pwr_on_seq = card_enable_flow_8723d,
622c57bd7c3SPing-Ke Shih 	.pwr_off_seq = card_disable_flow_8723d,
623d91277deSPing-Ke Shih 	.page_table = page_table_8723d,
624d91277deSPing-Ke Shih 	.rqpn_table = rqpn_table_8723d,
625e0c27cdbSPing-Ke Shih 	.rf_sipi_addr = {0x840, 0x844},
626e0c27cdbSPing-Ke Shih 	.rf_sipi_read_addr = rtw8723d_rf_sipi_addr,
627e0c27cdbSPing-Ke Shih 	.fix_rf_phy_num = 2,
6289874f685SPing-Ke Shih 	.mac_tbl = &rtw8723d_mac_tbl,
6299874f685SPing-Ke Shih 	.agc_tbl = &rtw8723d_agc_tbl,
6309874f685SPing-Ke Shih 	.bb_tbl = &rtw8723d_bb_tbl,
6319874f685SPing-Ke Shih 	.rf_tbl = {&rtw8723d_rf_a_tbl},
6329874f685SPing-Ke Shih 	.rfe_defs = rtw8723d_rfe_defs,
6339874f685SPing-Ke Shih 	.rfe_defs_size = ARRAY_SIZE(rtw8723d_rfe_defs),
634811853daSPing-Ke Shih };
635811853daSPing-Ke Shih EXPORT_SYMBOL(rtw8723d_hw_spec);
636811853daSPing-Ke Shih 
637811853daSPing-Ke Shih MODULE_FIRMWARE("rtw88/rtw8723d_fw.bin");
638