18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright(c) 2009-2012  Realtek Corporation.*/
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef __RTL8723E_PWRSEQ_H__
58c2ecf20Sopenharmony_ci#define __RTL8723E_PWRSEQ_H__
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include "../pwrseqcmd.h"
88c2ecf20Sopenharmony_ci/*
98c2ecf20Sopenharmony_ci *	Check document WM-20110607-Paul-RTL8723A_Power_Architecture-R02.vsd
108c2ecf20Sopenharmony_ci *	There are 6 HW Power States:
118c2ecf20Sopenharmony_ci *	0: POFF--Power Off
128c2ecf20Sopenharmony_ci *	1: PDN--Power Down
138c2ecf20Sopenharmony_ci *	2: CARDEMU--Card Emulation
148c2ecf20Sopenharmony_ci *	3: ACT--Active Mode
158c2ecf20Sopenharmony_ci *	4: LPS--Low Power State
168c2ecf20Sopenharmony_ci *	5: SUS--Suspend
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci *	The transision from different states are defined below
198c2ecf20Sopenharmony_ci *	TRANS_CARDEMU_TO_ACT
208c2ecf20Sopenharmony_ci *	TRANS_ACT_TO_CARDEMU
218c2ecf20Sopenharmony_ci *	TRANS_CARDEMU_TO_SUS
228c2ecf20Sopenharmony_ci *	TRANS_SUS_TO_CARDEMU
238c2ecf20Sopenharmony_ci *	TRANS_CARDEMU_TO_PDN
248c2ecf20Sopenharmony_ci *	TRANS_ACT_TO_LPS
258c2ecf20Sopenharmony_ci *	TRANS_LPS_TO_ACT
268c2ecf20Sopenharmony_ci *
278c2ecf20Sopenharmony_ci *	TRANS_END
288c2ecf20Sopenharmony_ci */
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define	RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS	10
318c2ecf20Sopenharmony_ci#define	RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS	10
328c2ecf20Sopenharmony_ci#define	RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS	10
338c2ecf20Sopenharmony_ci#define	RTL8723A_TRANS_SUS_TO_CARDEMU_STEPS	10
348c2ecf20Sopenharmony_ci#define	RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS	10
358c2ecf20Sopenharmony_ci#define	RTL8723A_TRANS_PDN_TO_CARDEMU_STEPS	10
368c2ecf20Sopenharmony_ci#define	RTL8723A_TRANS_ACT_TO_LPS_STEPS		15
378c2ecf20Sopenharmony_ci#define	RTL8723A_TRANS_LPS_TO_ACT_STEPS		15
388c2ecf20Sopenharmony_ci#define	RTL8723A_TRANS_END_STEPS		1
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* format */
418c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }*/
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_CARDEMU_TO_ACT	\
448c2ecf20Sopenharmony_ci	/* disable SW LPS 0x04[10]=0*/	\
458c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
468c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(2), 0},\
478c2ecf20Sopenharmony_ci	/* wait till 0x04[17] = 1    power ready*/	\
488c2ecf20Sopenharmony_ci	{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
498c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), BIT(1)},\
508c2ecf20Sopenharmony_ci	/* release WLON reset  0x04[16]=1*/	\
518c2ecf20Sopenharmony_ci	{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
528c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)},\
538c2ecf20Sopenharmony_ci	/* disable HWPDN 0x04[15]=0*/ \
548c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
558c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0},\
568c2ecf20Sopenharmony_ci	/* disable WL suspend*/ \
578c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
588c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, (BIT(4)|BIT(3)), 0},\
598c2ecf20Sopenharmony_ci	/* polling until return 0*/ \
608c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
618c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)},\
628c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
638c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(0), 0},
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* format */
668c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_ACT_TO_CARDEMU	\
698c2ecf20Sopenharmony_ci	/*0x1F[7:0] = 0 turn off RF*/ \
708c2ecf20Sopenharmony_ci	{0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
718c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0},	\
728c2ecf20Sopenharmony_ci	{0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
738c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0},\
748c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
758c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \
768c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
778c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), 0},
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* format */
808c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value },*/
818c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_CARDEMU_TO_SUS			\
828c2ecf20Sopenharmony_ci		/*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/	\
838c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
848c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, \
858c2ecf20Sopenharmony_ci		BIT(4)|BIT(3), (BIT(4)|BIT(3))},\
868c2ecf20Sopenharmony_ci/*0x04[12:11] = 2b'01 enable WL suspend*/	\
878c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK| \
888c2ecf20Sopenharmony_ci		PWR_INTF_SDIO_MSK,\
898c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, \
908c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, \
918c2ecf20Sopenharmony_ci		BIT(3)|BIT(4), BIT(3)}, \
928c2ecf20Sopenharmony_ci/*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
938c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
948c2ecf20Sopenharmony_ci		PWR_INTF_PCI_MSK, PWR_BASEADDR_MAC, \
958c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(3)|BIT(4), \
968c2ecf20Sopenharmony_ci		BIT(3)|BIT(4)}, \
978c2ecf20Sopenharmony_ci/*Set SDIO suspend local register*/	\
988c2ecf20Sopenharmony_ci	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
998c2ecf20Sopenharmony_ci		PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO,\
1008c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(0), BIT(0)}, \
1018c2ecf20Sopenharmony_ci/*wait power state to suspend*/ \
1028c2ecf20Sopenharmony_ci	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1038c2ecf20Sopenharmony_ci		PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO,\
1048c2ecf20Sopenharmony_ci		PWR_CMD_POLLING, BIT(1), 0},
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* format */
1078c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_SUS_TO_CARDEMU	\
1108c2ecf20Sopenharmony_ci /*Set SDIO suspend local register*/	\
1118c2ecf20Sopenharmony_ci	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
1128c2ecf20Sopenharmony_ci		PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), 0},\
1138c2ecf20Sopenharmony_ci /*wait power state to suspend*/ \
1148c2ecf20Sopenharmony_ci	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK,\
1158c2ecf20Sopenharmony_ci		PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), BIT(1)},\
1168c2ecf20Sopenharmony_ci /*0x04[12:11] = 2b'00 disable WL suspend*/ \
1178c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
1188c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), 0},
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* format */
1218c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_CARDEMU_TO_CARDDIS \
1248c2ecf20Sopenharmony_ci /*0x04[12:11] = 2b'01 enable WL suspend*/	 \
1258c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1268c2ecf20Sopenharmony_ci		PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, \
1278c2ecf20Sopenharmony_ci		PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)}, \
1288c2ecf20Sopenharmony_ci/*0x04[10] = 1, enable SW LPS*/	\
1298c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1308c2ecf20Sopenharmony_ci		PWR_INTF_PCI_MSK, PWR_BASEADDR_MAC,\
1318c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(2), BIT(2)}, \
1328c2ecf20Sopenharmony_ci/*Set SDIO suspend local register*/ \
1338c2ecf20Sopenharmony_ci	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1348c2ecf20Sopenharmony_ci		PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO,\
1358c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(0), BIT(0)}, \
1368c2ecf20Sopenharmony_ci /*wait power state to suspend*/ \
1378c2ecf20Sopenharmony_ci	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1388c2ecf20Sopenharmony_ci		PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO,\
1398c2ecf20Sopenharmony_ci		PWR_CMD_POLLING, BIT(1), 0},
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/* format */
1428c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_CARDDIS_TO_CARDEMU\
1458c2ecf20Sopenharmony_ci/*Set SDIO suspend local register*/	\
1468c2ecf20Sopenharmony_ci	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1478c2ecf20Sopenharmony_ci		PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO,\
1488c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(0), 0}, \
1498c2ecf20Sopenharmony_ci /*wait power state to suspend*/ \
1508c2ecf20Sopenharmony_ci	{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1518c2ecf20Sopenharmony_ci		PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO,\
1528c2ecf20Sopenharmony_ci		PWR_CMD_POLLING, BIT(1), BIT(1)},\
1538c2ecf20Sopenharmony_ci /*0x04[12:11] = 2b'00 disable WL suspend*/ \
1548c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1558c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
1568c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(3)|BIT(4), 0},\
1578c2ecf20Sopenharmony_ci/*PCIe DMA start*/ \
1588c2ecf20Sopenharmony_ci	{0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1598c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
1608c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, 0xFF, 0},
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci/* format */
1638c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */
1648c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_CARDEMU_TO_PDN	\
1658c2ecf20Sopenharmony_ci	{0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1668c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
1678c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(0), 0},/* 0x04[16] = 0*/\
1688c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1698c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
1708c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(7), BIT(7)},/* 0x04[15] = 1*/
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/* format */
1738c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */
1748c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_PDN_TO_CARDEMU	\
1758c2ecf20Sopenharmony_ci	{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1768c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
1778c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(7), 0},/* 0x04[15] = 0*/
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci/* format */
1808c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_ACT_TO_LPS	\
1838c2ecf20Sopenharmony_ci	{0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1848c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
1858c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, 0xFF, 0xFF},/*PCIe DMA stop*/	\
1868c2ecf20Sopenharmony_ci	{0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1878c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
1888c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/	\
1898c2ecf20Sopenharmony_ci	/*Should be zero if no packet is transmitting*/	\
1908c2ecf20Sopenharmony_ci	{0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1918c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
1928c2ecf20Sopenharmony_ci		PWR_CMD_POLLING, 0xFF, 0},\
1938c2ecf20Sopenharmony_ci	/*Should be zero if no packet is transmitting*/	\
1948c2ecf20Sopenharmony_ci	{0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1958c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
1968c2ecf20Sopenharmony_ci		PWR_CMD_POLLING, 0xFF, 0},\
1978c2ecf20Sopenharmony_ci	/*Should be zero if no packet is transmitting*/	\
1988c2ecf20Sopenharmony_ci	{0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
1998c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2008c2ecf20Sopenharmony_ci		PWR_CMD_POLLING, 0xFF, 0},\
2018c2ecf20Sopenharmony_ci	/*Should be zero if no packet is transmitting*/	\
2028c2ecf20Sopenharmony_ci	{0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2038c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2048c2ecf20Sopenharmony_ci		PWR_CMD_POLLING, 0xFF, 0},\
2058c2ecf20Sopenharmony_ci	/*CCK and OFDM are disabled,and clock are gated*/ \
2068c2ecf20Sopenharmony_ci	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2078c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2088c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(0), 0},\
2098c2ecf20Sopenharmony_ci	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2108c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2118c2ecf20Sopenharmony_ci		PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/\
2128c2ecf20Sopenharmony_ci	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2138c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2148c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(1), 0},/*Whole BB is reset*/	\
2158c2ecf20Sopenharmony_ci	{0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2168c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2178c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/	\
2188c2ecf20Sopenharmony_ci	{0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2198c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2208c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(1), 0},/*check if removed later*/	\
2218c2ecf20Sopenharmony_ci	/*Respond TxOK to scheduler*/	\
2228c2ecf20Sopenharmony_ci	{0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2238c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2248c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(5), BIT(5)},\
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_LPS_TO_ACT\
2278c2ecf20Sopenharmony_ci/* format */	\
2288c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */	\
2298c2ecf20Sopenharmony_ci	{0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2308c2ecf20Sopenharmony_ci		PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO,\
2318c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\
2328c2ecf20Sopenharmony_ci	{0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2338c2ecf20Sopenharmony_ci		PWR_INTF_USB_MSK, PWR_BASEADDR_MAC,\
2348c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\
2358c2ecf20Sopenharmony_ci	{0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2368c2ecf20Sopenharmony_ci		PWR_INTF_PCI_MSK, PWR_BASEADDR_MAC,\
2378c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/\
2388c2ecf20Sopenharmony_ci	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2398c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2408c2ecf20Sopenharmony_ci		PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\
2418c2ecf20Sopenharmony_ci	/*.	0x08[4] = 0		 switch TSF to 40M*/\
2428c2ecf20Sopenharmony_ci	{0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2438c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2448c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(4), 0},  \
2458c2ecf20Sopenharmony_ci	/*Polling 0x109[7]=0  TSF in 40M*/\
2468c2ecf20Sopenharmony_ci	{0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2478c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2488c2ecf20Sopenharmony_ci		PWR_CMD_POLLING, BIT(7), 0}, \
2498c2ecf20Sopenharmony_ci	/*.	0x29[7:6] = 2b'00	 enable BB clock*/\
2508c2ecf20Sopenharmony_ci	{0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2518c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2528c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(6)|BIT(7), 0},\
2538c2ecf20Sopenharmony_ci	 /*.	0x101[1] = 1*/\
2548c2ecf20Sopenharmony_ci	{0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2558c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2568c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(1), BIT(1)},\
2578c2ecf20Sopenharmony_ci	 /*.	0x100[7:0] = 0xFF	 enable WMAC TRX*/\
2588c2ecf20Sopenharmony_ci	{0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2598c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2608c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, 0xFF, 0xFF},\
2618c2ecf20Sopenharmony_ci	 /*.	0x02[1:0] = 2b'11	 enable BB macro*/\
2628c2ecf20Sopenharmony_ci	{0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2638c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2648c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, BIT(1)|BIT(0), BIT(1)|BIT(0)},\
2658c2ecf20Sopenharmony_ci	{0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
2668c2ecf20Sopenharmony_ci		PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC,\
2678c2ecf20Sopenharmony_ci		PWR_CMD_WRITE, 0xFF, 0}, /*.	0x522 = 0*/
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci/* format */
2708c2ecf20Sopenharmony_ci/* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci#define RTL8723A_TRANS_END \
2738c2ecf20Sopenharmony_ci	{0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
2748c2ecf20Sopenharmony_ci	0, PWR_CMD_END, 0, 0}
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ciextern struct wlan_pwr_cfg rtl8723A_power_on_flow
2778c2ecf20Sopenharmony_ci		[RTL8723A_TRANS_CARDEMU_TO_ACT_STEPS +
2788c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_END_STEPS];
2798c2ecf20Sopenharmony_ciextern struct wlan_pwr_cfg rtl8723A_radio_off_flow
2808c2ecf20Sopenharmony_ci		[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS +
2818c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_END_STEPS];
2828c2ecf20Sopenharmony_ciextern struct wlan_pwr_cfg rtl8723A_card_disable_flow
2838c2ecf20Sopenharmony_ci		[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS +
2848c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS +
2858c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_END_STEPS];
2868c2ecf20Sopenharmony_ciextern struct wlan_pwr_cfg rtl8723A_card_enable_flow
2878c2ecf20Sopenharmony_ci		[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS +
2888c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS +
2898c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_END_STEPS];
2908c2ecf20Sopenharmony_ciextern struct wlan_pwr_cfg rtl8723A_suspend_flow
2918c2ecf20Sopenharmony_ci		[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS +
2928c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS +
2938c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_END_STEPS];
2948c2ecf20Sopenharmony_ciextern struct wlan_pwr_cfg rtl8723A_resume_flow
2958c2ecf20Sopenharmony_ci		[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS +
2968c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_CARDEMU_TO_SUS_STEPS +
2978c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_END_STEPS];
2988c2ecf20Sopenharmony_ciextern struct wlan_pwr_cfg rtl8723A_hwpdn_flow
2998c2ecf20Sopenharmony_ci		[RTL8723A_TRANS_ACT_TO_CARDEMU_STEPS +
3008c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_CARDEMU_TO_PDN_STEPS +
3018c2ecf20Sopenharmony_ci		 RTL8723A_TRANS_END_STEPS];
3028c2ecf20Sopenharmony_ciextern struct wlan_pwr_cfg rtl8723A_enter_lps_flow
3038c2ecf20Sopenharmony_ci		[RTL8723A_TRANS_ACT_TO_LPS_STEPS + RTL8723A_TRANS_END_STEPS];
3048c2ecf20Sopenharmony_ciextern struct wlan_pwr_cfg rtl8723A_leave_lps_flow
3058c2ecf20Sopenharmony_ci		[RTL8723A_TRANS_LPS_TO_ACT_STEPS + RTL8723A_TRANS_END_STEPS];
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci/* RTL8723 Power Configuration CMDs for PCIe interface */
3088c2ecf20Sopenharmony_ci#define RTL8723_NIC_PWR_ON_FLOW		rtl8723A_power_on_flow
3098c2ecf20Sopenharmony_ci#define RTL8723_NIC_RF_OFF_FLOW		rtl8723A_radio_off_flow
3108c2ecf20Sopenharmony_ci#define RTL8723_NIC_DISABLE_FLOW	rtl8723A_card_disable_flow
3118c2ecf20Sopenharmony_ci#define RTL8723_NIC_ENABLE_FLOW		rtl8723A_card_enable_flow
3128c2ecf20Sopenharmony_ci#define RTL8723_NIC_SUSPEND_FLOW	rtl8723A_suspend_flow
3138c2ecf20Sopenharmony_ci#define RTL8723_NIC_RESUME_FLOW		rtl8723A_resume_flow
3148c2ecf20Sopenharmony_ci#define RTL8723_NIC_PDN_FLOW		rtl8723A_hwpdn_flow
3158c2ecf20Sopenharmony_ci#define RTL8723_NIC_LPS_ENTER_FLOW	rtl8723A_enter_lps_flow
3168c2ecf20Sopenharmony_ci#define RTL8723_NIC_LPS_LEAVE_FLOW	rtl8723A_leave_lps_flow
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci#endif
319