rsi_boot_params.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*
  2. * Copyright (c) 2014 Redpine Signals Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef __RSI_BOOTPARAMS_HEADER_H__
  17. #define __RSI_BOOTPARAMS_HEADER_H__
  18. #define CRYSTAL_GOOD_TIME BIT(0)
  19. #define BOOTUP_MODE_INFO BIT(1)
  20. #define WIFI_TAPLL_CONFIGS BIT(5)
  21. #define WIFI_PLL960_CONFIGS BIT(6)
  22. #define WIFI_AFEPLL_CONFIGS BIT(7)
  23. #define WIFI_SWITCH_CLK_CONFIGS BIT(8)
  24. #define TA_PLL_M_VAL_20 9
  25. #define TA_PLL_N_VAL_20 0
  26. #define TA_PLL_P_VAL_20 4
  27. #define PLL960_M_VAL_20 0x14
  28. #define PLL960_N_VAL_20 0
  29. #define PLL960_P_VAL_20 5
  30. #define UMAC_CLK_40MHZ 80
  31. #define TA_PLL_M_VAL_40 9
  32. #define TA_PLL_N_VAL_40 0
  33. #define TA_PLL_P_VAL_40 4
  34. #define PLL960_M_VAL_40 0x14
  35. #define PLL960_N_VAL_40 0
  36. #define PLL960_P_VAL_40 5
  37. #define UMAC_CLK_20BW \
  38. (((TA_PLL_M_VAL_20 + 1) * 40) / \
  39. ((TA_PLL_N_VAL_20 + 1) * (TA_PLL_P_VAL_20 + 1)))
  40. #define VALID_20 \
  41. (WIFI_TAPLL_CONFIGS | WIFI_PLL960_CONFIGS | WIFI_AFEPLL_CONFIGS | \
  42. WIFI_SWITCH_CLK_CONFIGS | BOOTUP_MODE_INFO | CRYSTAL_GOOD_TIME)
  43. #define UMAC_CLK_40BW \
  44. (((TA_PLL_M_VAL_40 + 1) * 40) / \
  45. ((TA_PLL_N_VAL_40 + 1) * (TA_PLL_P_VAL_40 + 1)))
  46. #define VALID_40 \
  47. (WIFI_PLL960_CONFIGS | WIFI_AFEPLL_CONFIGS | WIFI_SWITCH_CLK_CONFIGS | \
  48. WIFI_TAPLL_CONFIGS | CRYSTAL_GOOD_TIME | BOOTUP_MODE_INFO)
  49. /* structure to store configs related to TAPLL programming */
  50. struct tapll_info {
  51. __le16 pll_reg_1;
  52. __le16 pll_reg_2;
  53. } __packed;
  54. /* structure to store configs related to PLL960 programming */
  55. struct pll960_info {
  56. __le16 pll_reg_1;
  57. __le16 pll_reg_2;
  58. __le16 pll_reg_3;
  59. } __packed;
  60. /* structure to store configs related to AFEPLL programming */
  61. struct afepll_info {
  62. __le16 pll_reg;
  63. } __packed;
  64. /* structure to store configs related to pll configs */
  65. struct pll_config {
  66. struct tapll_info tapll_info_g;
  67. struct pll960_info pll960_info_g;
  68. struct afepll_info afepll_info_g;
  69. } __packed;
  70. struct pll_config_9116 {
  71. __le16 pll_ctrl_set_reg;
  72. __le16 pll_ctrl_clr_reg;
  73. __le16 pll_modem_conig_reg;
  74. __le16 soc_clk_config_reg;
  75. __le16 adc_dac_strm1_config_reg;
  76. __le16 adc_dac_strm2_config_reg;
  77. } __packed;
  78. /* structure to store configs related to UMAC clk programming */
  79. struct switch_clk {
  80. __le16 switch_clk_info;
  81. /* If switch_bbp_lmac_clk_reg is set then this value will be programmed
  82. * into reg
  83. */
  84. __le16 bbp_lmac_clk_reg_val;
  85. /* if switch_umac_clk is set then this value will be programmed */
  86. __le16 umac_clock_reg_config;
  87. /* if switch_qspi_clk is set then this value will be programmed */
  88. __le16 qspi_uart_clock_reg_config;
  89. } __packed;
  90. #define RSI_SWITCH_TASS_CLK BIT(0)
  91. #define RSI_SWITCH_QSPI_CLK BIT(1)
  92. #define RSI_SWITCH_SLP_CLK_2_32 BIT(2)
  93. #define RSI_SWITCH_WLAN_BBP_LMAC_CLK_REG BIT(3)
  94. #define RSI_SWITCH_ZBBT_BBP_LMAC_CLK_REG BIT(4)
  95. #define RSI_SWITCH_BBP_LMAC_CLK_REG BIT(5)
  96. #define RSI_MODEM_CLK_160MHZ BIT(6)
  97. struct switch_clk_9116 {
  98. __le32 switch_clk_info;
  99. __le32 tass_clock_reg;
  100. __le32 wlan_bbp_lmac_clk_reg_val;
  101. __le32 zbbt_bbp_lmac_clk_reg_val;
  102. __le32 bbp_lmac_clk_en_val;
  103. } __packed;
  104. struct device_clk_info {
  105. struct pll_config pll_config_g;
  106. struct switch_clk switch_clk_g;
  107. } __packed;
  108. struct device_clk_info_9116 {
  109. struct pll_config_9116 pll_config_9116_g;
  110. struct switch_clk_9116 switch_clk_9116_g;
  111. } __packed;
  112. struct bootup_params {
  113. __le16 magic_number;
  114. __le16 crystal_good_time;
  115. __le32 valid;
  116. __le32 reserved_for_valids;
  117. __le16 bootup_mode_info;
  118. /* configuration used for digital loop back */
  119. __le16 digital_loop_back_params;
  120. __le16 rtls_timestamp_en;
  121. __le16 host_spi_intr_cfg;
  122. struct device_clk_info device_clk_info[3];
  123. /* ulp buckboost wait time */
  124. __le32 buckboost_wakeup_cnt;
  125. /* pmu wakeup wait time & WDT EN info */
  126. __le16 pmu_wakeup_wait;
  127. u8 shutdown_wait_time;
  128. /* Sleep clock source selection */
  129. u8 pmu_slp_clkout_sel;
  130. /* WDT programming values */
  131. __le32 wdt_prog_value;
  132. /* WDT soc reset delay */
  133. __le32 wdt_soc_rst_delay;
  134. /* dcdc modes configs */
  135. __le32 dcdc_operation_mode;
  136. __le32 soc_reset_wait_cnt;
  137. __le32 waiting_time_at_fresh_sleep;
  138. __le32 max_threshold_to_avoid_sleep;
  139. u8 beacon_resedue_alg_en;
  140. } __packed;
  141. struct bootup_params_9116 {
  142. __le16 magic_number;
  143. #define LOADED_TOKEN 0x5AA5 /* Bootup params are installed by host
  144. * or OTP/FLASH (Bootloader)
  145. */
  146. #define ROM_TOKEN 0x55AA /* Bootup params are taken from ROM
  147. * itself in MCU mode.
  148. */
  149. __le16 crystal_good_time;
  150. __le32 valid;
  151. __le32 reserved_for_valids;
  152. __le16 bootup_mode_info;
  153. #define BT_COEXIST BIT(0)
  154. #define BOOTUP_MODE (BIT(2) | BIT(1))
  155. #define CUR_DEV_MODE_9116 (bootup_params_9116.bootup_mode_info >> 1)
  156. __le16 digital_loop_back_params;
  157. __le16 rtls_timestamp_en;
  158. __le16 host_spi_intr_cfg;
  159. struct device_clk_info_9116 device_clk_info_9116[1];
  160. __le32 buckboost_wakeup_cnt;
  161. __le16 pmu_wakeup_wait;
  162. u8 shutdown_wait_time;
  163. u8 pmu_slp_clkout_sel;
  164. __le32 wdt_prog_value;
  165. __le32 wdt_soc_rst_delay;
  166. __le32 dcdc_operation_mode;
  167. __le32 soc_reset_wait_cnt;
  168. __le32 waiting_time_at_fresh_sleep;
  169. __le32 max_threshold_to_avoid_sleep;
  170. u8 beacon_resedue_alg_en;
  171. } __packed;
  172. #endif