xref: /linux/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.h (revision 597473720f4dc69749542bfcfed4a927a43d935e)
1*03f3dd37SLarry Finger /* SPDX-License-Identifier: GPL-2.0 */
2*03f3dd37SLarry Finger /* Copyright(c) 2009-2010  Realtek Corporation.*/
3f1d2b4d3SLarry Finger 
4f1d2b4d3SLarry Finger #ifndef __RTL8821AE_PWRSEQ_H__
5f1d2b4d3SLarry Finger #define __RTL8821AE_PWRSEQ_H__
6f1d2b4d3SLarry Finger 
7f1d2b4d3SLarry Finger #include "../pwrseqcmd.h"
8f1d2b4d3SLarry Finger #include "../btcoexist/halbt_precomp.h"
9f1d2b4d3SLarry Finger 
10f1d2b4d3SLarry Finger #define	RTL8812_TRANS_CARDEMU_TO_ACT_STEPS	15
11f1d2b4d3SLarry Finger #define	RTL8812_TRANS_ACT_TO_CARDEMU_STEPS	15
12f1d2b4d3SLarry Finger #define	RTL8812_TRANS_CARDEMU_TO_SUS_STEPS	15
13f1d2b4d3SLarry Finger #define	RTL8812_TRANS_SUS_TO_CARDEMU_STEPS	15
14f1d2b4d3SLarry Finger #define	RTL8812_TRANS_CARDEMU_TO_PDN_STEPS	25
15f1d2b4d3SLarry Finger #define	RTL8812_TRANS_PDN_TO_CARDEMU_STEPS	15
16f1d2b4d3SLarry Finger #define	RTL8812_TRANS_ACT_TO_LPS_STEPS		15
17f1d2b4d3SLarry Finger #define	RTL8812_TRANS_LPS_TO_ACT_STEPS		15
18f1d2b4d3SLarry Finger #define	RTL8812_TRANS_END_STEPS			1
19f1d2b4d3SLarry Finger 
20f1d2b4d3SLarry Finger /* The following macros have the following format:
21f1d2b4d3SLarry Finger  * { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value
22f1d2b4d3SLarry Finger  *   comments },
23f1d2b4d3SLarry Finger  */
24f1d2b4d3SLarry Finger #define RTL8812_TRANS_CARDEMU_TO_ACT					\
25f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
26f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, 0 \
27f1d2b4d3SLarry Finger 	/* disable SW LPS 0x04[10]=0*/},	\
28f1d2b4d3SLarry Finger 	{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
29f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT1, BIT1 \
30f1d2b4d3SLarry Finger 	/* wait till 0x04[17] = 1    power ready*/},	\
31f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
32f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, 0 \
33f1d2b4d3SLarry Finger 	/* disable HWPDN 0x04[15]=0*/}, \
34f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
35f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3, 0 \
36f1d2b4d3SLarry Finger 	/* disable WL suspend*/},	\
37f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
38f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0 \
39f1d2b4d3SLarry Finger 	/* polling until return 0*/},	\
40f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
41f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT0, 0},
42f1d2b4d3SLarry Finger 
43f1d2b4d3SLarry Finger #define RTL8812_TRANS_ACT_TO_CARDEMU													\
44f1d2b4d3SLarry Finger 	{0x0c00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
45f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x04 \
46f1d2b4d3SLarry Finger 	 /* 0xc00[7:0] = 4	turn off 3-wire */},	\
47f1d2b4d3SLarry Finger 	{0x0e00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
48f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x04 \
49f1d2b4d3SLarry Finger 	 /* 0xe00[7:0] = 4	turn off 3-wire */},	\
50f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
51f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0 \
52f1d2b4d3SLarry Finger 	 /* 0x2[0] = 0	 RESET BB, CLOSE RF */},	\
53f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
54f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US \
55f1d2b4d3SLarry Finger 	/*Delay 1us*/},	\
56f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
57f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0 \
58f1d2b4d3SLarry Finger 	  /* Whole BB is reset*/},			\
59f1d2b4d3SLarry Finger 	{0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
60f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x2A \
61f1d2b4d3SLarry Finger 	 /* 0x07[7:0] = 0x28 sps pwm mode 0x2a for BT coex*/},	\
62f1d2b4d3SLarry Finger 	{0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
63f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x02, 0 \
64f1d2b4d3SLarry Finger 	/*0x8[1] = 0 ANA clk =500k */},	\
65f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
66f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1 \
67f1d2b4d3SLarry Finger 	 /*0x04[9] = 1 turn off MAC by HW state machine*/},	\
68f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
69f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT1, 0 \
70f1d2b4d3SLarry Finger 	 /*wait till 0x04[9] = 0 polling until return 0 to disable*/},
71f1d2b4d3SLarry Finger 
72f1d2b4d3SLarry Finger #define RTL8812_TRANS_CARDEMU_TO_SUS					\
73f1d2b4d3SLarry Finger 	{0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
74f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xF0, 0xc0}, \
75f1d2b4d3SLarry Finger 	{0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
76f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xF0, 0xE0}, \
77f1d2b4d3SLarry Finger 	{0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
78f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x07 \
79f1d2b4d3SLarry Finger 	/* gpio11 input mode, gpio10~8 output mode */},	\
80f1d2b4d3SLarry Finger 	{0x0045, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
81f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00 \
82f1d2b4d3SLarry Finger 	/* gpio 0~7 output same value as input ?? */},	\
83f1d2b4d3SLarry Finger 	{0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
84f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xff \
85f1d2b4d3SLarry Finger 	/* gpio0~7 output mode */},	\
86f1d2b4d3SLarry Finger 	{0x0047, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
87f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0 \
88f1d2b4d3SLarry Finger 	/* 0x47[7:0] = 00 gpio mode */},	\
89f1d2b4d3SLarry Finger 	{0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
90f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0 \
91f1d2b4d3SLarry Finger 	/* suspend option all off */},	\
92f1d2b4d3SLarry Finger 	{0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
93f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x80, BIT7 \
94f1d2b4d3SLarry Finger 	/*0x14[7] = 1 turn on ZCD */},	\
95f1d2b4d3SLarry Finger 	{0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
96f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x01, BIT0 \
97f1d2b4d3SLarry Finger 	/* 0x15[0] =1 trun on ZCD */},	\
98f1d2b4d3SLarry Finger 	{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
99f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x10, BIT4 \
100f1d2b4d3SLarry Finger 	/*0x23[4] = 1 hpon LDO sleep mode */},	\
101f1d2b4d3SLarry Finger 	{0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
102f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x02, 0 \
103f1d2b4d3SLarry Finger 	/*0x8[1] = 0 ANA clk =500k */},	\
104f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
105f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3, BIT3 \
106f1d2b4d3SLarry Finger 	/*0x04[11] = 2b'11 enable WL suspend for PCIe*/},
107f1d2b4d3SLarry Finger 
108f1d2b4d3SLarry Finger #define RTL8812_TRANS_SUS_TO_CARDEMU					\
109f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
110f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3, 0 \
111f1d2b4d3SLarry Finger 	/*0x04[11] = 2b'01enable WL suspend*/},   \
112f1d2b4d3SLarry Finger 	{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
113f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x10, 0 \
114f1d2b4d3SLarry Finger 	/*0x23[4] = 0 hpon LDO sleep mode leave */},	\
115f1d2b4d3SLarry Finger 	{0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
116f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x01, 0 \
117f1d2b4d3SLarry Finger 	/* 0x15[0] =0 trun off ZCD */},	\
118f1d2b4d3SLarry Finger 	{0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
119f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x80, 0 \
120f1d2b4d3SLarry Finger 	/*0x14[7] = 0 turn off ZCD */},	\
121f1d2b4d3SLarry Finger 	{0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
122f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00 \
123f1d2b4d3SLarry Finger 	/* gpio0~7 input mode */},	\
124f1d2b4d3SLarry Finger 	{0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
125f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00 \
126f1d2b4d3SLarry Finger 	/* gpio11 input mode, gpio10~8 input mode */},
127f1d2b4d3SLarry Finger 
128f1d2b4d3SLarry Finger #define RTL8812_TRANS_CARDEMU_TO_CARDDIS				\
129f1d2b4d3SLarry Finger 	{0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
130f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, 0 \
131f1d2b4d3SLarry Finger 	/*0x03[2] = 0, reset 8051*/},	\
132f1d2b4d3SLarry Finger 	{0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
133f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x05 \
134f1d2b4d3SLarry Finger 	/*0x80=05h if reload fw, fill the default value of host_CPU handshake field*/},	\
135f1d2b4d3SLarry Finger 	{0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
136f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xF0, 0xcc}, \
137f1d2b4d3SLarry Finger 	{0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
138f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xF0, 0xEC}, \
139f1d2b4d3SLarry Finger 	{0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
140f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x07 \
141f1d2b4d3SLarry Finger 	/* gpio11 input mode, gpio10~8 output mode */},	\
142f1d2b4d3SLarry Finger 	{0x0045, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
143f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00 \
144f1d2b4d3SLarry Finger 	/* gpio 0~7 output same value as input ?? */},	\
145f1d2b4d3SLarry Finger 	{0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
146f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xff \
147f1d2b4d3SLarry Finger 	/* gpio0~7 output mode */},	\
148f1d2b4d3SLarry Finger 	{0x0047, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
149f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0 \
150f1d2b4d3SLarry Finger 	/* 0x47[7:0] = 00 gpio mode */},	\
151f1d2b4d3SLarry Finger 	{0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
152f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x80, BIT7 \
153f1d2b4d3SLarry Finger 	/*0x14[7] = 1 turn on ZCD */},	\
154f1d2b4d3SLarry Finger 	{0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
155f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x01, BIT0 \
156f1d2b4d3SLarry Finger 	/* 0x15[0] =1 trun on ZCD */},	\
157f1d2b4d3SLarry Finger 	{0x0012, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
158f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x01, 0 \
159f1d2b4d3SLarry Finger 	/*0x12[0] = 0 force PFM mode */},	\
160f1d2b4d3SLarry Finger 	{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
161f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x10, BIT4 \
162f1d2b4d3SLarry Finger 	/*0x23[4] = 1 hpon LDO sleep mode */},	\
163f1d2b4d3SLarry Finger 	{0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
164f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x02, 0 \
165f1d2b4d3SLarry Finger 	/*0x8[1] = 0 ANA clk =500k */},	\
166f1d2b4d3SLarry Finger 	{0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
167f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x20 \
168f1d2b4d3SLarry Finger 	 /*0x07=0x20 , SOP option to disable BG/MB*/},	\
169f1d2b4d3SLarry Finger 	{0x001f, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
170f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0 \
171f1d2b4d3SLarry Finger 	 /*0x01f[1]=0 , disable RFC_0  control  REG_RF_CTRL_8812 */},	\
172f1d2b4d3SLarry Finger 	{0x0076, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
173f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0 \
174f1d2b4d3SLarry Finger 	 /*0x076[1]=0 , disable RFC_1  control REG_OPT_CTRL_8812 +2 */},	\
175f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
176f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3, BIT3 \
177f1d2b4d3SLarry Finger 	 /*0x04[11] = 2b'01 enable WL suspend*/},
178f1d2b4d3SLarry Finger 
179f1d2b4d3SLarry Finger #define RTL8812_TRANS_CARDDIS_TO_CARDEMU				\
180f1d2b4d3SLarry Finger 	{0x0012, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
181f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0 \
182f1d2b4d3SLarry Finger 	/*0x12[0] = 1 force PWM mode */},	\
183f1d2b4d3SLarry Finger 	{0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
184f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x80, 0 \
185f1d2b4d3SLarry Finger 	/*0x14[7] = 0 turn off ZCD */},	\
186f1d2b4d3SLarry Finger 	{0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
187f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x01, 0 \
188f1d2b4d3SLarry Finger 	/* 0x15[0] =0 trun off ZCD */},	\
189f1d2b4d3SLarry Finger 	{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
190f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x10, 0 \
191f1d2b4d3SLarry Finger 	/*0x23[4] = 0 hpon LDO leave sleep mode */},	\
192f1d2b4d3SLarry Finger 	{0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
193f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00 \
194f1d2b4d3SLarry Finger 	/* gpio0~7 input mode */},	\
195f1d2b4d3SLarry Finger 	{0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
196f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00 \
197f1d2b4d3SLarry Finger 	/* gpio11 input mode, gpio10~8 input mode */}, \
198f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
199f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, 0 \
200f1d2b4d3SLarry Finger 	 /*0x04[10] = 0, enable SW LPS PCIE only*/},	\
201f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
202f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3, 0 \
203f1d2b4d3SLarry Finger 	 /*0x04[11] = 2b'01enable WL suspend*/},	\
204f1d2b4d3SLarry Finger 	{0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
205f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, BIT2 \
206f1d2b4d3SLarry Finger 	 /*0x03[2] = 1, enable 8051*/},	\
207f1d2b4d3SLarry Finger 	{0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
208f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0 \
209f1d2b4d3SLarry Finger 	/*PCIe DMA start*/},
210f1d2b4d3SLarry Finger 
211f1d2b4d3SLarry Finger #define RTL8812_TRANS_CARDEMU_TO_PDN		\
212f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
213f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, BIT7 \
214f1d2b4d3SLarry Finger 	/* 0x04[15] = 1*/},
215f1d2b4d3SLarry Finger 
216f1d2b4d3SLarry Finger #define RTL8812_TRANS_PDN_TO_CARDEMU			\
217f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
218f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, 0 \
219f1d2b4d3SLarry Finger 	/* 0x04[15] = 0*/},
220f1d2b4d3SLarry Finger 
221f1d2b4d3SLarry Finger #define RTL8812_TRANS_ACT_TO_LPS		\
222f1d2b4d3SLarry Finger 	{0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
223f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF \
224f1d2b4d3SLarry Finger 	/*PCIe DMA stop*/},	\
225f1d2b4d3SLarry Finger 	{0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
226f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x7F \
227f1d2b4d3SLarry Finger 	/*Tx Pause*/},		\
228f1d2b4d3SLarry Finger 	{0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
229f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0 \
230f1d2b4d3SLarry Finger 	/*Should be zero if no packet is transmitting*/},	\
231f1d2b4d3SLarry Finger 	{0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
232f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0 \
233f1d2b4d3SLarry Finger 	/*Should be zero if no packet is transmitting*/},	\
234f1d2b4d3SLarry Finger 	{0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
235f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0 \
236f1d2b4d3SLarry Finger 	/*Should be zero if no packet is transmitting*/},	\
237f1d2b4d3SLarry Finger 	{0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
238f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0 \
239f1d2b4d3SLarry Finger 	/*Should be zero if no packet is transmitting*/},	\
240f1d2b4d3SLarry Finger 	{0x0c00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
241f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x04 \
242f1d2b4d3SLarry Finger 	 /* 0xc00[7:0] = 4	turn off 3-wire */},	\
243f1d2b4d3SLarry Finger 	{0x0e00, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
244f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x04 \
245f1d2b4d3SLarry Finger 	 /* 0xe00[7:0] = 4	turn off 3-wire */},	\
246f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
247f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0 \
248f1d2b4d3SLarry Finger 	/*CCK and OFDM are disabled,and clock are gated,and RF closed*/},	\
249f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
250f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US \
251f1d2b4d3SLarry Finger 	/*Delay 1us*/},	\
252f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
253f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0 \
254f1d2b4d3SLarry Finger 	  /* Whole BB is reset*/},			\
255f1d2b4d3SLarry Finger 	{0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
256f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x03 \
257f1d2b4d3SLarry Finger 	/*Reset MAC TRX*/},			\
258f1d2b4d3SLarry Finger 	{0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
259f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0 \
260f1d2b4d3SLarry Finger 	/*check if removed later*/},		\
261f1d2b4d3SLarry Finger 	{0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
262f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT5, BIT5 \
263f1d2b4d3SLarry Finger 	/*Respond TxOK to scheduler*/},
264f1d2b4d3SLarry Finger 
265f1d2b4d3SLarry Finger #define RTL8812_TRANS_LPS_TO_ACT					\
266f1d2b4d3SLarry Finger 	{0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
267f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_WRITE, 0xFF, 0x84 \
268f1d2b4d3SLarry Finger 	 /*SDIO RPWM*/},	\
269f1d2b4d3SLarry Finger 	{0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
270f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84 \
271f1d2b4d3SLarry Finger 	 /*USB RPWM*/},	\
272f1d2b4d3SLarry Finger 	{0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
273f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84 \
274f1d2b4d3SLarry Finger 	 /*PCIe RPWM*/},	\
275f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
276f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS \
277f1d2b4d3SLarry Finger 	 /*Delay*/},	\
278f1d2b4d3SLarry Finger 	{0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
279f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, 0 \
280f1d2b4d3SLarry Finger 	 /*.	0x08[4] = 0		 switch TSF to 40M*/},	\
281f1d2b4d3SLarry Finger 	{0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
282f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT7, 0 \
283f1d2b4d3SLarry Finger 	 /*Polling 0x109[7]=0  TSF in 40M*/},			\
284f1d2b4d3SLarry Finger 	{0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
285f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT6|BIT7, 0 \
286f1d2b4d3SLarry Finger 	 /*.	0x29[7:6] = 2b'00	 enable BB clock*/},	\
287f1d2b4d3SLarry Finger 	{0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
288f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1 \
289f1d2b4d3SLarry Finger 	 /*.	0x101[1] = 1*/},					\
290f1d2b4d3SLarry Finger 	{0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
291f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF \
292f1d2b4d3SLarry Finger 	 /*.	0x100[7:0] = 0xFF	 enable WMAC TRX*/},	\
293f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
294f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0 \
295f1d2b4d3SLarry Finger 	 /*.	0x02[1:0] = 2b'11	 enable BB macro*/},	\
296f1d2b4d3SLarry Finger 	{0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
297f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0 \
298f1d2b4d3SLarry Finger 	 /*.	0x522 = 0*/},
299f1d2b4d3SLarry Finger 
300f1d2b4d3SLarry Finger #define RTL8812_TRANS_END					\
301f1d2b4d3SLarry Finger 	{0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
302f1d2b4d3SLarry Finger 	0, PWR_CMD_END, 0, 0},
303f1d2b4d3SLarry Finger 
304f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg  rtl8812_power_on_flow
305f1d2b4d3SLarry Finger 		[RTL8812_TRANS_CARDEMU_TO_ACT_STEPS +
306f1d2b4d3SLarry Finger 		 RTL8812_TRANS_END_STEPS];
307f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg  rtl8812_radio_off_flow
308f1d2b4d3SLarry Finger 		[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
309f1d2b4d3SLarry Finger 		 RTL8812_TRANS_END_STEPS];
310f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg  rtl8812_card_disable_flow
311f1d2b4d3SLarry Finger 		[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
312f1d2b4d3SLarry Finger 		 RTL8812_TRANS_CARDEMU_TO_PDN_STEPS +
313f1d2b4d3SLarry Finger 		 RTL8812_TRANS_END_STEPS];
314f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg  rtl8812_card_enable_flow
315f1d2b4d3SLarry Finger 		[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
316f1d2b4d3SLarry Finger 		 RTL8812_TRANS_CARDEMU_TO_PDN_STEPS +
317f1d2b4d3SLarry Finger 		 RTL8812_TRANS_END_STEPS];
318f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg  rtl8812_suspend_flow
319f1d2b4d3SLarry Finger 		[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
320f1d2b4d3SLarry Finger 		 RTL8812_TRANS_CARDEMU_TO_SUS_STEPS +
321f1d2b4d3SLarry Finger 		 RTL8812_TRANS_END_STEPS];
322f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg  rtl8812_resume_flow
323f1d2b4d3SLarry Finger 		[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
324f1d2b4d3SLarry Finger 		 RTL8812_TRANS_CARDEMU_TO_SUS_STEPS +
325f1d2b4d3SLarry Finger 		 RTL8812_TRANS_END_STEPS];
326f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg  rtl8812_hwpdn_flow
327f1d2b4d3SLarry Finger 		[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
328f1d2b4d3SLarry Finger 		 RTL8812_TRANS_CARDEMU_TO_PDN_STEPS +
329f1d2b4d3SLarry Finger 		 RTL8812_TRANS_END_STEPS];
330f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg  rtl8812_enter_lps_flow
331f1d2b4d3SLarry Finger 		[RTL8812_TRANS_ACT_TO_LPS_STEPS +
332f1d2b4d3SLarry Finger 		 RTL8812_TRANS_END_STEPS];
333f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg  rtl8812_leave_lps_flow
334f1d2b4d3SLarry Finger 		[RTL8812_TRANS_LPS_TO_ACT_STEPS +
335f1d2b4d3SLarry Finger 		 RTL8812_TRANS_END_STEPS];
336f1d2b4d3SLarry Finger 
337f1d2b4d3SLarry Finger /* Check document WM-20130516-JackieLau-RTL8821A_Power_Architecture-R10.vsd
338f1d2b4d3SLarry Finger  *	There are 6 HW Power States:
339f1d2b4d3SLarry Finger  *	0: POFF--Power Off
340f1d2b4d3SLarry Finger  *	1: PDN--Power Down
341f1d2b4d3SLarry Finger  *	2: CARDEMU--Card Emulation
342f1d2b4d3SLarry Finger  *	3: ACT--Active Mode
343f1d2b4d3SLarry Finger  *	4: LPS--Low Power State
344f1d2b4d3SLarry Finger  *	5: SUS--Suspend
345f1d2b4d3SLarry Finger  *
346f1d2b4d3SLarry Finger  *	The transision from different states are defined below
347f1d2b4d3SLarry Finger  *	TRANS_CARDEMU_TO_ACT
348f1d2b4d3SLarry Finger  *	TRANS_ACT_TO_CARDEMU
349f1d2b4d3SLarry Finger  *	TRANS_CARDEMU_TO_SUS
350f1d2b4d3SLarry Finger  *	TRANS_SUS_TO_CARDEMU
351f1d2b4d3SLarry Finger  *	TRANS_CARDEMU_TO_PDN
352f1d2b4d3SLarry Finger  *	TRANS_ACT_TO_LPS
353f1d2b4d3SLarry Finger  *	TRANS_LPS_TO_ACT
354f1d2b4d3SLarry Finger  *
355f1d2b4d3SLarry Finger  *	TRANS_END
356f1d2b4d3SLarry Finger  */
357f1d2b4d3SLarry Finger #define	RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS	25
358f1d2b4d3SLarry Finger #define	RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS	15
359f1d2b4d3SLarry Finger #define	RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS	15
360f1d2b4d3SLarry Finger #define	RTL8821A_TRANS_SUS_TO_CARDEMU_STEPS	15
361f1d2b4d3SLarry Finger #define RTL8821A_TRANS_CARDDIS_TO_CARDEMU_STEPS	15
362f1d2b4d3SLarry Finger #define	RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS	15
363f1d2b4d3SLarry Finger #define	RTL8821A_TRANS_PDN_TO_CARDEMU_STEPS	15
364f1d2b4d3SLarry Finger #define	RTL8821A_TRANS_ACT_TO_LPS_STEPS		15
365f1d2b4d3SLarry Finger #define	RTL8821A_TRANS_LPS_TO_ACT_STEPS		15
366f1d2b4d3SLarry Finger #define	RTL8821A_TRANS_END_STEPS		1
367f1d2b4d3SLarry Finger 
368f1d2b4d3SLarry Finger #define RTL8821A_TRANS_CARDEMU_TO_ACT					\
369f1d2b4d3SLarry Finger 	{0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,			\
370f1d2b4d3SLarry Finger 	 PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,\
371f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0 \
372f1d2b4d3SLarry Finger 	 /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/},   \
373f1d2b4d3SLarry Finger 	{0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,		\
374f1d2b4d3SLarry Finger 	 PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,\
375f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, 0 \
376f1d2b4d3SLarry Finger 	 /*0x67[0] = 0 to disable BT_GPS_SEL pins*/},	\
377f1d2b4d3SLarry Finger 	{0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,			\
378f1d2b4d3SLarry Finger 	 PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,\
379f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS \
380f1d2b4d3SLarry Finger 	/*Delay 1ms*/},   \
381f1d2b4d3SLarry Finger 	{0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,			\
382f1d2b4d3SLarry Finger 	 PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,\
383f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT5, 0 \
384f1d2b4d3SLarry Finger 	 /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/},   \
385f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
386f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, (BIT4|BIT3|BIT2), 0 \
387f1d2b4d3SLarry Finger 	/* disable SW LPS 0x04[10]=0 and WLSUS_EN 0x04[12:11]=0*/},	\
388f1d2b4d3SLarry Finger 	{0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
389f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0 , BIT0 \
390f1d2b4d3SLarry Finger 	/* Disable USB suspend */},	\
391f1d2b4d3SLarry Finger 	{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
392f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT1, BIT1 \
393f1d2b4d3SLarry Finger 	/* wait till 0x04[17] = 1    power ready*/},	\
394f1d2b4d3SLarry Finger 	{0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
395f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0 , 0 \
396f1d2b4d3SLarry Finger 	/* Enable USB suspend */},	\
397f1d2b4d3SLarry Finger 	{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
398f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0 \
399f1d2b4d3SLarry Finger 	/* release WLON reset  0x04[16]=1*/},	\
400f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
401f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, 0 \
402f1d2b4d3SLarry Finger 	/* disable HWPDN 0x04[15]=0*/},	\
403f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
404f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, (BIT4|BIT3), 0 \
405f1d2b4d3SLarry Finger 	/* disable WL suspend*/},	\
406f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
407f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0 \
408f1d2b4d3SLarry Finger 	/* polling until return 0*/},	\
409f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
410f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT0, 0 \
411f1d2b4d3SLarry Finger 	/**/},	\
412f1d2b4d3SLarry Finger 	{0x004F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
413f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0 \
414f1d2b4d3SLarry Finger 	/*0x4C[24] = 0x4F[0] = 1, switch DPDT_SEL_P output from WL BB */},\
415f1d2b4d3SLarry Finger 	{0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
416f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, (BIT5|BIT4), (BIT5|BIT4) \
417f1d2b4d3SLarry Finger 	/*0x66[13] = 0x67[5] = 1, switch for PAPE_G/PAPE_A 	\
418f1d2b4d3SLarry Finger 	 from WL BB ; 0x66[12] = 0x67[4] = 1, switch LNAON from WL BB */},\
419f1d2b4d3SLarry Finger 	{0x0025, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
420f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT6, 0 \
421f1d2b4d3SLarry Finger 	/*anapar_mac<118> , 0x25[6]=0 by wlan single function*/},\
422f1d2b4d3SLarry Finger 	{0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
423f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1 \
424f1d2b4d3SLarry Finger 	/*Enable falling edge triggering interrupt*/},\
425f1d2b4d3SLarry Finger 	{0x0063, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
426f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1 \
427f1d2b4d3SLarry Finger 	/*Enable GPIO9 interrupt mode*/},\
428f1d2b4d3SLarry Finger 	{0x0062, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
429f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0 \
430f1d2b4d3SLarry Finger 	/*Enable GPIO9 input mode*/},\
431f1d2b4d3SLarry Finger 	{0x0058, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
432f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0 \
433f1d2b4d3SLarry Finger 	/*Enable HSISR GPIO[C:0] interrupt*/},\
434f1d2b4d3SLarry Finger 	{0x005A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
435f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1 \
436f1d2b4d3SLarry Finger 	/*Enable HSISR GPIO9 interrupt*/},\
437f1d2b4d3SLarry Finger 	{0x007A, PWR_CUT_TESTCHIP_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
438f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x3A \
439f1d2b4d3SLarry Finger 	/*0x7A = 0x3A start BT*/},\
440f1d2b4d3SLarry Finger 	{0x002E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
441f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF , 0x82  \
442f1d2b4d3SLarry Finger 	/* 0x2C[23:12]=0x820 ; XTAL trim */}, \
443f1d2b4d3SLarry Finger 	{0x0010, PWR_CUT_A_MSK , PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
444f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT6 , BIT6  \
445f1d2b4d3SLarry Finger 	/* 0x10[6]=1  */},
446f1d2b4d3SLarry Finger 
447f1d2b4d3SLarry Finger #define RTL8821A_TRANS_ACT_TO_CARDEMU					\
448f1d2b4d3SLarry Finger 	{0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
449f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0 \
450f1d2b4d3SLarry Finger 	/*0x1F[7:0] = 0 turn off RF*/},	\
451f1d2b4d3SLarry Finger 	{0x004F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
452f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0 \
453f1d2b4d3SLarry Finger 	/*0x4C[24] = 0x4F[0] = 0, switch DPDT_SEL_P output from		\
454f1d2b4d3SLarry Finger 	 register 0x65[2] */},\
455f1d2b4d3SLarry Finger 	{0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
456f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0 \
457f1d2b4d3SLarry Finger 	/*Enable rising edge triggering interrupt*/}, \
458f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
459f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1 \
460f1d2b4d3SLarry Finger 	 /*0x04[9] = 1 turn off MAC by HW state machine*/},	\
461f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
462f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT1, 0 \
463f1d2b4d3SLarry Finger 	 /*wait till 0x04[9] = 0 polling until return 0 to disable*/},	\
464f1d2b4d3SLarry Finger 	{0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,			\
465f1d2b4d3SLarry Finger 	 PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,\
466f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT5, BIT5 \
467f1d2b4d3SLarry Finger 	 /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/},   \
468f1d2b4d3SLarry Finger 	{0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,		\
469f1d2b4d3SLarry Finger 	 PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,\
470f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0 \
471f1d2b4d3SLarry Finger 	 /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/},
472f1d2b4d3SLarry Finger 
473f1d2b4d3SLarry Finger #define RTL8821A_TRANS_CARDEMU_TO_SUS					\
474f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
475f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4|BIT3, (BIT4|BIT3) \
476f1d2b4d3SLarry Finger 	 /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/},	\
477f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,		\
478f1d2b4d3SLarry Finger 	 PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,\
479f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3|BIT4, BIT3 \
480f1d2b4d3SLarry Finger 	 /*0x04[12:11] = 2b'01 enable WL suspend*/},	\
481f1d2b4d3SLarry Finger 	{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
482f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, BIT4 \
483f1d2b4d3SLarry Finger 	 /*0x23[4] = 1b'1 12H LDO enter sleep mode*/},   \
484f1d2b4d3SLarry Finger 	{0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
485f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x20 \
486f1d2b4d3SLarry Finger 	 /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/},   \
487f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
488f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3|BIT4, BIT3|BIT4 \
489f1d2b4d3SLarry Finger 	 /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/},	\
490f1d2b4d3SLarry Finger 	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
491f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, BIT0 \
492f1d2b4d3SLarry Finger 	 /*Set SDIO suspend local register*/},	\
493f1d2b4d3SLarry Finger 	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
494f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, 0 \
495f1d2b4d3SLarry Finger 	 /*wait power state to suspend*/},
496f1d2b4d3SLarry Finger 
497f1d2b4d3SLarry Finger #define RTL8821A_TRANS_SUS_TO_CARDEMU					\
498f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
499f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3 | BIT7, 0 \
500f1d2b4d3SLarry Finger 	 /*clear suspend enable and power down enable*/},	\
501f1d2b4d3SLarry Finger 	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
502f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, 0 \
503f1d2b4d3SLarry Finger 	 /*Set SDIO suspend local register*/},	\
504f1d2b4d3SLarry Finger 	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
505f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, BIT1 \
506f1d2b4d3SLarry Finger 	 /*wait power state to suspend*/},\
507f1d2b4d3SLarry Finger 	{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
508f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, 0 \
509f1d2b4d3SLarry Finger 	 /*0x23[4] = 1b'0 12H LDO enter normal mode*/},   \
510f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
511f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3|BIT4, 0 \
512692f5decSKevin Lo 	 /*0x04[12:11] = 2b'00 disable WL suspend*/},
513f1d2b4d3SLarry Finger 
514f1d2b4d3SLarry Finger #define RTL8821A_TRANS_CARDEMU_TO_CARDDIS				\
515f1d2b4d3SLarry Finger 	{0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
516f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x20 \
517f1d2b4d3SLarry Finger 	 /*0x07=0x20 , SOP option to disable BG/MB*/},	\
518f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,		\
519f1d2b4d3SLarry Finger 	 PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK,\
520f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3|BIT4, BIT3 \
521f1d2b4d3SLarry Finger 	 /*0x04[12:11] = 2b'01 enable WL suspend*/},	\
522f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
523f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, BIT2 \
524f1d2b4d3SLarry Finger 	 /*0x04[10] = 1, enable SW LPS*/},	\
525f1d2b4d3SLarry Finger         {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
526f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 1 \
527f1d2b4d3SLarry Finger 	 /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/},   \
528f1d2b4d3SLarry Finger 	{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
529f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, BIT4 \
530f1d2b4d3SLarry Finger 	 /*0x23[4] = 1b'1 12H LDO enter sleep mode*/},   \
531f1d2b4d3SLarry Finger 	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
532f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, BIT0 \
533f1d2b4d3SLarry Finger 	 /*Set SDIO suspend local register*/},	\
534f1d2b4d3SLarry Finger 	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
535f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, 0 \
536f1d2b4d3SLarry Finger 	 /*wait power state to suspend*/},
537f1d2b4d3SLarry Finger 
538f1d2b4d3SLarry Finger #define RTL8821A_TRANS_CARDDIS_TO_CARDEMU				\
539f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
540f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3 | BIT7, 0 \
541f1d2b4d3SLarry Finger 	 /*clear suspend enable and power down enable*/},	\
542f1d2b4d3SLarry Finger 	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
543f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, 0 \
544f1d2b4d3SLarry Finger 	 /*Set SDIO suspend local register*/},	\
545f1d2b4d3SLarry Finger 	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
546f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, BIT1 \
547f1d2b4d3SLarry Finger 	 /*wait power state to suspend*/},\
548f1d2b4d3SLarry Finger 	{0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
549f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0 \
550f1d2b4d3SLarry Finger 	 /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/},   \
551f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
552f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3|BIT4, 0 \
553692f5decSKevin Lo 	 /*0x04[12:11] = 2b'00 disable WL suspend*/},\
554f1d2b4d3SLarry Finger 	{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
555f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, 0 \
556f1d2b4d3SLarry Finger 	 /*0x23[4] = 1b'0 12H LDO enter normal mode*/},   \
557f1d2b4d3SLarry Finger 	{0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
558f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0 \
559f1d2b4d3SLarry Finger 	/*PCIe DMA start*/},
560f1d2b4d3SLarry Finger 
561f1d2b4d3SLarry Finger #define RTL8821A_TRANS_CARDEMU_TO_PDN					\
562f1d2b4d3SLarry Finger 	{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
563f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, BIT4 \
564f1d2b4d3SLarry Finger 	 /*0x23[4] = 1b'1 12H LDO enter sleep mode*/},   \
565f1d2b4d3SLarry Finger 	{0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,		\
566f1d2b4d3SLarry Finger 	 PWR_INTF_SDIO_MSK|PWR_INTF_USB_MSK,\
567f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x20 \
568f1d2b4d3SLarry Finger 	 /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/},   \
569f1d2b4d3SLarry Finger 	{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
570f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0 \
571f1d2b4d3SLarry Finger 	/* 0x04[16] = 0*/},\
572f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
573f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, BIT7 \
574f1d2b4d3SLarry Finger 	/* 0x04[15] = 1*/},
575f1d2b4d3SLarry Finger 
576f1d2b4d3SLarry Finger #define RTL8821A_TRANS_PDN_TO_CARDEMU				\
577f1d2b4d3SLarry Finger 	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
578f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, 0 \
579f1d2b4d3SLarry Finger 	/* 0x04[15] = 0*/},
580f1d2b4d3SLarry Finger 
581f1d2b4d3SLarry Finger #define RTL8821A_TRANS_ACT_TO_LPS					\
582f1d2b4d3SLarry Finger 	{0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
583f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF \
584f1d2b4d3SLarry Finger 	/*PCIe DMA stop*/},	\
585f1d2b4d3SLarry Finger 	{0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
586f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF \
587f1d2b4d3SLarry Finger 	/*Tx Pause*/},	\
588f1d2b4d3SLarry Finger 	{0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
589f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0 \
590f1d2b4d3SLarry Finger 	/*Should be zero if no packet is transmitting*/},	\
591f1d2b4d3SLarry Finger 	{0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
592f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0 \
593f1d2b4d3SLarry Finger 	/*Should be zero if no packet is transmitting*/},	\
594f1d2b4d3SLarry Finger 	{0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
595f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0 \
596f1d2b4d3SLarry Finger 	/*Should be zero if no packet is transmitting*/},	\
597f1d2b4d3SLarry Finger 	{0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
598f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0 \
599f1d2b4d3SLarry Finger 	/*Should be zero if no packet is transmitting*/},	\
600f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
601f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0 \
602f1d2b4d3SLarry Finger 	/*CCK and OFDM are disabled,and clock are gated*/},	\
603f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
604f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US \
605f1d2b4d3SLarry Finger 	/*Delay 1us*/},	\
606f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
607f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0 \
608f1d2b4d3SLarry Finger 	/*Whole BB is reset*/},	\
609f1d2b4d3SLarry Finger 	{0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
610f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x03 \
611f1d2b4d3SLarry Finger 	/*Reset MAC TRX*/},	\
612f1d2b4d3SLarry Finger 	{0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
613f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0 \
614f1d2b4d3SLarry Finger 	/*check if removed later*/},	\
615f1d2b4d3SLarry Finger 	{0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
616f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00 \
617f1d2b4d3SLarry Finger 	/*When driver enter Sus/ Disable, enable LOP for BT*/},	\
618f1d2b4d3SLarry Finger 	{0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
619f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT5, BIT5 \
620f1d2b4d3SLarry Finger 	/*Respond TxOK to scheduler*/},
621f1d2b4d3SLarry Finger 
622f1d2b4d3SLarry Finger #define RTL8821A_TRANS_LPS_TO_ACT					\
623f1d2b4d3SLarry Finger 	{0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
624f1d2b4d3SLarry Finger 	PWR_BASEADDR_SDIO, PWR_CMD_WRITE, 0xFF, 0x84 \
625f1d2b4d3SLarry Finger 	 /*SDIO RPWM*/},\
626f1d2b4d3SLarry Finger 	{0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
627f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84 \
628f1d2b4d3SLarry Finger 	 /*USB RPWM*/},\
629f1d2b4d3SLarry Finger 	{0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
630f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84 \
631f1d2b4d3SLarry Finger 	 /*PCIe RPWM*/},\
632f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
633f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS \
634f1d2b4d3SLarry Finger 	 /*Delay*/},\
635f1d2b4d3SLarry Finger 	{0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
636f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, 0 \
637f1d2b4d3SLarry Finger 	 /*.	0x08[4] = 0		 switch TSF to 40M*/},\
638f1d2b4d3SLarry Finger 	{0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
639f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT7, 0 \
640f1d2b4d3SLarry Finger 	 /*Polling 0x109[7]=0  TSF in 40M*/},\
641f1d2b4d3SLarry Finger 	{0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
642f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT6|BIT7, 0 \
643f1d2b4d3SLarry Finger 	 /*.	0x29[7:6] = 2b'00	 enable BB clock*/},\
644f1d2b4d3SLarry Finger 	{0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
645f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1 \
646f1d2b4d3SLarry Finger 	 /*.	0x101[1] = 1*/},\
647f1d2b4d3SLarry Finger 	{0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
648f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF \
649f1d2b4d3SLarry Finger 	 /*.	0x100[7:0] = 0xFF	 enable WMAC TRX*/},\
650f1d2b4d3SLarry Finger 	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
651f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1|BIT0, BIT1|BIT0 \
652f1d2b4d3SLarry Finger 	 /*.	0x02[1:0] = 2b'11	 enable BB macro*/},\
653f1d2b4d3SLarry Finger 	{0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
654f1d2b4d3SLarry Finger 	PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0 \
655f1d2b4d3SLarry Finger 	 /*.	0x522 = 0*/},
656f1d2b4d3SLarry Finger 
657f1d2b4d3SLarry Finger #define RTL8821A_TRANS_END					\
658f1d2b4d3SLarry Finger 	{0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
659f1d2b4d3SLarry Finger 	0, PWR_CMD_END, 0, 0},
660f1d2b4d3SLarry Finger 
661f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg rtl8821A_power_on_flow
662f1d2b4d3SLarry Finger 		[RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS +
663f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_END_STEPS];
664f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg rtl8821A_radio_off_flow
665f1d2b4d3SLarry Finger 		[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS +
666f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_END_STEPS];
667f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg rtl8821A_card_disable_flow
668f1d2b4d3SLarry Finger 		[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS +
669f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS +
670f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_END_STEPS];
671f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg rtl8821A_card_enable_flow
672f1d2b4d3SLarry Finger 		[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS +
673f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS +
674f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_END_STEPS];
675f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg rtl8821A_suspend_flow
676f1d2b4d3SLarry Finger 		[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS +
677f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS +
678f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_END_STEPS];
679f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg rtl8821A_resume_flow
680f1d2b4d3SLarry Finger 		[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS +
681f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS +
682f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_END_STEPS];
683f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg rtl8821A_hwpdn_flow
684f1d2b4d3SLarry Finger 		[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS +
685f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS +
686f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_END_STEPS];
687f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg rtl8821A_enter_lps_flow
688f1d2b4d3SLarry Finger 		[RTL8821A_TRANS_ACT_TO_LPS_STEPS +
689f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_END_STEPS];
690f1d2b4d3SLarry Finger extern struct wlan_pwr_cfg rtl8821A_leave_lps_flow
691f1d2b4d3SLarry Finger 		[RTL8821A_TRANS_LPS_TO_ACT_STEPS +
692f1d2b4d3SLarry Finger 		 RTL8821A_TRANS_END_STEPS];
693f1d2b4d3SLarry Finger 
694f1d2b4d3SLarry Finger /*RTL8812 Power Configuration CMDs for PCIe interface*/
695f1d2b4d3SLarry Finger #define RTL8812_NIC_PWR_ON_FLOW			rtl8812_power_on_flow
696f1d2b4d3SLarry Finger #define RTL8812_NIC_RF_OFF_FLOW			rtl8812_radio_off_flow
697f1d2b4d3SLarry Finger #define RTL8812_NIC_DISABLE_FLOW		rtl8812_card_disable_flow
698f1d2b4d3SLarry Finger #define RTL8812_NIC_ENABLE_FLOW			rtl8812_card_enable_flow
699f1d2b4d3SLarry Finger #define RTL8812_NIC_SUSPEND_FLOW		rtl8812_suspend_flow
700f1d2b4d3SLarry Finger #define RTL8812_NIC_RESUME_FLOW			rtl8812_resume_flow
701f1d2b4d3SLarry Finger #define RTL8812_NIC_PDN_FLOW			rtl8812_hwpdn_flow
702f1d2b4d3SLarry Finger #define RTL8812_NIC_LPS_ENTER_FLOW		rtl8812_enter_lps_flow
703f1d2b4d3SLarry Finger #define RTL8812_NIC_LPS_LEAVE_FLOW		rtl8812_leave_lps_flow
704f1d2b4d3SLarry Finger 
705f1d2b4d3SLarry Finger /* RTL8821 Power Configuration CMDs for PCIe interface */
706f1d2b4d3SLarry Finger #define RTL8821A_NIC_PWR_ON_FLOW		rtl8821A_power_on_flow
707f1d2b4d3SLarry Finger #define RTL8821A_NIC_RF_OFF_FLOW		rtl8821A_radio_off_flow
708f1d2b4d3SLarry Finger #define RTL8821A_NIC_DISABLE_FLOW		rtl8821A_card_disable_flow
709f1d2b4d3SLarry Finger #define RTL8821A_NIC_ENABLE_FLOW		rtl8821A_card_enable_flow
710f1d2b4d3SLarry Finger #define RTL8821A_NIC_SUSPEND_FLOW		rtl8821A_suspend_flow
711f1d2b4d3SLarry Finger #define RTL8821A_NIC_RESUME_FLOW		rtl8821A_resume_flow
712f1d2b4d3SLarry Finger #define RTL8821A_NIC_PDN_FLOW			rtl8821A_hwpdn_flow
713f1d2b4d3SLarry Finger #define RTL8821A_NIC_LPS_ENTER_FLOW		rtl8821A_enter_lps_flow
714f1d2b4d3SLarry Finger #define RTL8821A_NIC_LPS_LEAVE_FLOW		rtl8821A_leave_lps_flow
715f1d2b4d3SLarry Finger 
716f1d2b4d3SLarry Finger #endif
717