pwrseq.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2014 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * The full GNU General Public License is included in this distribution in the
  15. * file called LICENSE.
  16. *
  17. * Contact Information:
  18. * wlanfae <wlanfae@realtek.com>
  19. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  20. * Hsinchu 300, Taiwan.
  21. *
  22. * Larry Finger <Larry.Finger@lwfinger.net>
  23. *
  24. *****************************************************************************/
  25. #ifndef __RTL8723BE_PWRSEQ_H__
  26. #define __RTL8723BE_PWRSEQ_H__
  27. #include "../pwrseqcmd.h"
  28. /**
  29. * Check document WM-20130425-JackieLau-RTL8723B_Power_Architecture v05.vsd
  30. * There are 6 HW Power States:
  31. * 0: POFF--Power Off
  32. * 1: PDN--Power Down
  33. * 2: CARDEMU--Card Emulation
  34. * 3: ACT--Active Mode
  35. * 4: LPS--Low Power State
  36. * 5: SUS--Suspend
  37. *
  38. * The transision from different states are defined below
  39. * TRANS_CARDEMU_TO_ACT
  40. * TRANS_ACT_TO_CARDEMU
  41. * TRANS_CARDEMU_TO_SUS
  42. * TRANS_SUS_TO_CARDEMU
  43. * TRANS_CARDEMU_TO_PDN
  44. * TRANS_ACT_TO_LPS
  45. * TRANS_LPS_TO_ACT
  46. *
  47. * TRANS_END
  48. */
  49. #define RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS 23
  50. #define RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS 15
  51. #define RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS 15
  52. #define RTL8723B_TRANS_SUS_TO_CARDEMU_STEPS 15
  53. #define RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS 15
  54. #define RTL8723B_TRANS_PDN_TO_CARDEMU_STEPS 15
  55. #define RTL8723B_TRANS_ACT_TO_LPS_STEPS 15
  56. #define RTL8723B_TRANS_LPS_TO_ACT_STEPS 15
  57. #define RTL8723B_TRANS_END_STEPS 1
  58. #define RTL8723B_TRANS_CARDEMU_TO_ACT \
  59. /* format */ \
  60. /* comments here */ \
  61. /* {offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value}, */\
  62. /*0x20[0] = 1b'1 enable LDOA12 MACRO block for all interface*/ \
  63. {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
  64. PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, \
  65. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)}, \
  66. /*0x67[0] = 0 to disable BT_GPS_SEL pins*/ \
  67. {0x0067, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
  68. PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, \
  69. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, \
  70. /*Delay 1ms*/ \
  71. {0x0001, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
  72. PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, \
  73. PWR_BASEADDR_MAC, PWR_CMD_DELAY, 1, PWRSEQ_DELAY_MS}, \
  74. /*0x00[5] = 1b'0 release analog Ips to digital ,1:isolation*/ \
  75. {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
  76. PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, \
  77. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(5), 0}, \
  78. /* disable SW LPS 0x04[10]=0 and WLSUS_EN 0x04[11]=0*/ \
  79. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  80. PWR_BASEADDR_MAC, PWR_CMD_WRITE, (BIT(4)|BIT(3)|BIT(2)), 0}, \
  81. /* Disable USB suspend */ \
  82. {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \
  83. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0) , BIT(0)}, \
  84. /* wait till 0x04[17] = 1 power ready*/ \
  85. {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  86. PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), BIT(1)}, \
  87. /* Enable USB suspend */ \
  88. {0x0075, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \
  89. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0) , 0}, \
  90. /* release WLON reset 0x04[16]=1*/ \
  91. {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  92. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)}, \
  93. /* disable HWPDN 0x04[15]=0*/ \
  94. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  95. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0}, \
  96. /* disable WL suspend*/ \
  97. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  98. PWR_BASEADDR_MAC, PWR_CMD_WRITE, (BIT(4)|BIT(3)), 0}, \
  99. /* polling until return 0*/ \
  100. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  101. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)}, \
  102. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  103. PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(0), 0}, \
  104. /* Enable WL control XTAL setting*/ \
  105. {0x0010, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  106. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(6), BIT(6)}, \
  107. /*Enable falling edge triggering interrupt*/ \
  108. {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  109. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \
  110. /*Enable GPIO9 interrupt mode*/ \
  111. {0x0063, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  112. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \
  113. /*Enable GPIO9 input mode*/ \
  114. {0x0062, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  115. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), 0}, \
  116. /*Enable HSISR GPIO[C:0] interrupt*/ \
  117. {0x0058, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  118. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)}, \
  119. /*Enable HSISR GPIO9 interrupt*/ \
  120. {0x005A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  121. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \
  122. /*For GPIO9 internal pull high setting by test chip*/ \
  123. {0x0068, PWR_CUT_TESTCHIP_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
  124. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3), BIT(3)}, \
  125. /*For GPIO9 internal pull high setting*/ \
  126. {0x0069, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  127. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(6), BIT(6)},
  128. #define RTL8723B_TRANS_ACT_TO_CARDEMU \
  129. /* format */ \
  130. /* comments here */ \
  131. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\
  132. /*0x1F[7:0] = 0 turn off RF*/ \
  133. {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  134. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0}, \
  135. /*0x4C[24] = 0x4F[0] = 0, */ \
  136. /*switch DPDT_SEL_P output from register 0x65[2] */ \
  137. {0x004F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  138. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0}, \
  139. /*Enable rising edge triggering interrupt*/ \
  140. {0x0049, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  141. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), 0}, \
  142. /*0x04[9] = 1 turn off MAC by HW state machine*/ \
  143. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  144. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \
  145. /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \
  146. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  147. PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), 0}, \
  148. /* Enable BT control XTAL setting*/ \
  149. {0x0010, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  150. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(6), 0}, \
  151. /*0x00[5] = 1b'1 analog Ips to digital ,1:isolation*/ \
  152. {0x0000, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
  153. PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, \
  154. PWR_CMD_WRITE, BIT(5), BIT(5)}, \
  155. /*0x20[0] = 1b'0 disable LDOA12 MACRO block*/ \
  156. {0x0020, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
  157. PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, \
  158. PWR_CMD_WRITE, BIT(0), 0},
  159. #define RTL8723B_TRANS_CARDEMU_TO_SUS \
  160. /* format */ \
  161. /* comments here */ \
  162. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value },*/\
  163. /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
  164. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \
  165. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4) | BIT(3), (BIT(4) | BIT(3))}, \
  166. /*0x04[12:11] = 2b'01 enable WL suspend*/ \
  167. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
  168. PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, \
  169. PWR_CMD_WRITE, BIT(3) | BIT(4), BIT(3)}, \
  170. /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
  171. {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  172. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), BIT(4)}, \
  173. /*0x07[7:0] = 0x20 SDIO SOP option to disable BG/MB/ACK/SWR*/ \
  174. {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  175. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x20}, \
  176. /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \
  177. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \
  178. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3) | BIT(4), BIT(3) | BIT(4)},\
  179. /*Set SDIO suspend local register*/ \
  180. {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  181. PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), BIT(0)}, \
  182. /*wait power state to suspend*/ \
  183. {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  184. PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), 0},
  185. #define RTL8723B_TRANS_SUS_TO_CARDEMU \
  186. /* format */ \
  187. /* comments here */ \
  188. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\
  189. /*clear suspend enable and power down enable*/ \
  190. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  191. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3) | BIT(7), 0}, \
  192. /*Set SDIO suspend local register*/ \
  193. {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  194. PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), 0}, \
  195. /*wait power state to suspend*/ \
  196. {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  197. PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), BIT(1)}, \
  198. /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
  199. {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  200. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, \
  201. /*0x04[12:11] = 2b'01enable WL suspend*/ \
  202. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  203. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), 0},
  204. #define RTL8723B_TRANS_CARDEMU_TO_CARDDIS \
  205. /* format */ \
  206. /* comments here */ \
  207. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\
  208. /*0x07=0x20 , SOP option to disable BG/MB*/ \
  209. {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  210. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x20}, \
  211. /*0x04[12:11] = 2b'01 enable WL suspend*/ \
  212. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
  213. PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, \
  214. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)}, \
  215. /*0x04[10] = 1, enable SW LPS*/ \
  216. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \
  217. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(2), BIT(2)}, \
  218. /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \
  219. {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, \
  220. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 1}, \
  221. /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
  222. {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  223. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), BIT(4)}, \
  224. /*Set SDIO suspend local register*/ \
  225. {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  226. PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), BIT(0)}, \
  227. /*wait power state to suspend*/ \
  228. {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  229. PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), 0},
  230. #define RTL8723B_TRANS_CARDDIS_TO_CARDEMU \
  231. /* format */ \
  232. /* comments here */ \
  233. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\
  234. /*clear suspend enable and power down enable*/ \
  235. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  236. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3) | BIT(7), 0}, \
  237. /*Set SDIO suspend local register*/ \
  238. {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  239. PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), 0}, \
  240. /*wait power state to suspend*/ \
  241. {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  242. PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), BIT(1)}, \
  243. /*0x48[16] = 0 to disable GPIO9 as EXT WAKEUP*/ \
  244. {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, \
  245. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0}, \
  246. /*0x04[12:11] = 2b'01enable WL suspend*/ \
  247. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  248. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), 0}, \
  249. /*0x23[4] = 1b'0 12H LDO enter normal mode*/ \
  250. {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  251. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, \
  252. /*PCIe DMA start*/ \
  253. {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \
  254. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0},
  255. #define RTL8723B_TRANS_CARDEMU_TO_PDN \
  256. /* format */ \
  257. /* comments here */ \
  258. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\
  259. /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
  260. {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  261. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), BIT(4)}, \
  262. /*0x07[7:0] = 0x20 SOP option to disable BG/MB/ACK/SWR*/ \
  263. {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \
  264. PWR_INTF_SDIO_MSK | PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, \
  265. PWR_CMD_WRITE, 0xFF, 0x20}, \
  266. /* 0x04[16] = 0*/ \
  267. {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  268. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0}, \
  269. /* 0x04[15] = 1*/ \
  270. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  271. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), BIT(7)},
  272. #define RTL8723B_TRANS_PDN_TO_CARDEMU \
  273. /* format */ \
  274. /* comments here */ \
  275. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\
  276. /* 0x04[15] = 0*/ \
  277. {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  278. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0},
  279. #define RTL8723B_TRANS_ACT_TO_LPS \
  280. /* format */ \
  281. /* comments here */ \
  282. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\
  283. /*PCIe DMA stop*/ \
  284. {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \
  285. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF}, \
  286. /*Tx Pause*/ \
  287. {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  288. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF}, \
  289. /*Should be zero if no packet is transmitting*/ \
  290. {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  291. PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \
  292. /*Should be zero if no packet is transmitting*/ \
  293. {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  294. PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \
  295. /*Should be zero if no packet is transmitting*/ \
  296. {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  297. PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \
  298. /*Should be zero if no packet is transmitting*/ \
  299. {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  300. PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \
  301. /*CCK and OFDM are disabled,and clock are gated*/ \
  302. {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  303. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0}, \
  304. /*Delay 1us*/ \
  305. {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  306. PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US}, \
  307. /*Whole BB is reset*/ \
  308. {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  309. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), 0}, \
  310. /*Reset MAC TRX*/ \
  311. {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  312. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x03}, \
  313. /*check if removed later*/ \
  314. {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  315. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), 0}, \
  316. /*When driver enter Sus/ Disable, enable LOP for BT*/ \
  317. {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  318. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00}, \
  319. /*Respond TxOK to scheduler*/ \
  320. {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  321. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(5), BIT(5)},
  322. #define RTL8723B_TRANS_LPS_TO_ACT \
  323. /* format */ \
  324. /* comments here */ \
  325. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\
  326. /*SDIO RPWM*/ \
  327. {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \
  328. PWR_BASEADDR_SDIO, PWR_CMD_WRITE, 0xFF, 0x84}, \
  329. /*USB RPWM*/ \
  330. {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, \
  331. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84}, \
  332. /*PCIe RPWM*/ \
  333. {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \
  334. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84}, \
  335. /*Delay*/ \
  336. {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  337. PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, \
  338. /*. 0x08[4] = 0 switch TSF to 40M*/ \
  339. {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  340. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, \
  341. /*Polling 0x109[7]=0 TSF in 40M*/ \
  342. {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  343. PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(7), 0}, \
  344. /*. 0x29[7:6] = 2b'00 enable BB clock*/ \
  345. {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  346. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(6)|BIT(7), 0}, \
  347. /*. 0x101[1] = 1*/ \
  348. {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  349. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \
  350. /*. 0x100[7:0] = 0xFF enable WMAC TRX*/ \
  351. {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  352. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF}, \
  353. /*. 0x02[1:0] = 2b'11 enable BB macro*/ \
  354. {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  355. PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1) | BIT(0), BIT(1) | BIT(0)}, \
  356. /*. 0x522 = 0*/ \
  357. {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \
  358. PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0},
  359. #define RTL8723B_TRANS_END \
  360. /* format */ \
  361. /* comments here */ \
  362. /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\
  363. {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, 0, \
  364. PWR_CMD_END, 0, 0},
  365. extern struct wlan_pwr_cfg rtl8723B_power_on_flow
  366. [RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS +
  367. RTL8723B_TRANS_END_STEPS];
  368. extern struct wlan_pwr_cfg rtl8723B_radio_off_flow
  369. [RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS +
  370. RTL8723B_TRANS_END_STEPS];
  371. extern struct wlan_pwr_cfg rtl8723B_card_disable_flow
  372. [RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS +
  373. RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS +
  374. RTL8723B_TRANS_END_STEPS];
  375. extern struct wlan_pwr_cfg rtl8723B_card_enable_flow
  376. [RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS +
  377. RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS +
  378. RTL8723B_TRANS_END_STEPS];
  379. extern struct wlan_pwr_cfg rtl8723B_suspend_flow
  380. [RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS +
  381. RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS +
  382. RTL8723B_TRANS_END_STEPS];
  383. extern struct wlan_pwr_cfg rtl8723B_resume_flow
  384. [RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS +
  385. RTL8723B_TRANS_CARDEMU_TO_SUS_STEPS +
  386. RTL8723B_TRANS_END_STEPS];
  387. extern struct wlan_pwr_cfg rtl8723B_hwpdn_flow
  388. [RTL8723B_TRANS_ACT_TO_CARDEMU_STEPS +
  389. RTL8723B_TRANS_CARDEMU_TO_PDN_STEPS +
  390. RTL8723B_TRANS_END_STEPS];
  391. extern struct wlan_pwr_cfg rtl8723B_enter_lps_flow
  392. [RTL8723B_TRANS_ACT_TO_LPS_STEPS +
  393. RTL8723B_TRANS_END_STEPS];
  394. extern struct wlan_pwr_cfg rtl8723B_leave_lps_flow
  395. [RTL8723B_TRANS_LPS_TO_ACT_STEPS +
  396. RTL8723B_TRANS_END_STEPS];
  397. /* RTL8723 Power Configuration CMDs for PCIe interface */
  398. #define RTL8723_NIC_PWR_ON_FLOW rtl8723B_power_on_flow
  399. #define RTL8723_NIC_RF_OFF_FLOW rtl8723B_radio_off_flow
  400. #define RTL8723_NIC_DISABLE_FLOW rtl8723B_card_disable_flow
  401. #define RTL8723_NIC_ENABLE_FLOW rtl8723B_card_enable_flow
  402. #define RTL8723_NIC_SUSPEND_FLOW rtl8723B_suspend_flow
  403. #define RTL8723_NIC_RESUME_FLOW rtl8723B_resume_flow
  404. #define RTL8723_NIC_PDN_FLOW rtl8723B_hwpdn_flow
  405. #define RTL8723_NIC_LPS_ENTER_FLOW rtl8723B_enter_lps_flow
  406. #define RTL8723_NIC_LPS_LEAVE_FLOW rtl8723B_leave_lps_flow
  407. #endif