rsi_boot_params.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 8
  25. #define TA_PLL_N_VAL_20 1
  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 40
  31. #define TA_PLL_M_VAL_40 46
  32. #define TA_PLL_N_VAL_40 3
  33. #define TA_PLL_P_VAL_40 3
  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_PLL960_CONFIGS | WIFI_AFEPLL_CONFIGS | WIFI_SWITCH_CLK_CONFIGS)
  42. #define UMAC_CLK_40BW \
  43. (((TA_PLL_M_VAL_40 + 1) * 40) / \
  44. ((TA_PLL_N_VAL_40 + 1) * (TA_PLL_P_VAL_40 + 1)))
  45. #define VALID_40 \
  46. (WIFI_PLL960_CONFIGS | WIFI_AFEPLL_CONFIGS | WIFI_SWITCH_CLK_CONFIGS | \
  47. WIFI_TAPLL_CONFIGS | CRYSTAL_GOOD_TIME | BOOTUP_MODE_INFO)
  48. /* structure to store configs related to TAPLL programming */
  49. struct tapll_info {
  50. __le16 pll_reg_1;
  51. __le16 pll_reg_2;
  52. } __packed;
  53. /* structure to store configs related to PLL960 programming */
  54. struct pll960_info {
  55. __le16 pll_reg_1;
  56. __le16 pll_reg_2;
  57. __le16 pll_reg_3;
  58. } __packed;
  59. /* structure to store configs related to AFEPLL programming */
  60. struct afepll_info {
  61. __le16 pll_reg;
  62. } __packed;
  63. /* structure to store configs related to pll configs */
  64. struct pll_config {
  65. struct tapll_info tapll_info_g;
  66. struct pll960_info pll960_info_g;
  67. struct afepll_info afepll_info_g;
  68. } __packed;
  69. /* structure to store configs related to UMAC clk programming */
  70. struct switch_clk {
  71. __le16 switch_clk_info;
  72. /* If switch_bbp_lmac_clk_reg is set then this value will be programmed
  73. * into reg
  74. */
  75. __le16 bbp_lmac_clk_reg_val;
  76. /* if switch_umac_clk is set then this value will be programmed */
  77. __le16 umac_clock_reg_config;
  78. /* if switch_qspi_clk is set then this value will be programmed */
  79. __le16 qspi_uart_clock_reg_config;
  80. } __packed;
  81. struct device_clk_info {
  82. struct pll_config pll_config_g;
  83. struct switch_clk switch_clk_g;
  84. } __packed;
  85. struct bootup_params {
  86. __le16 magic_number;
  87. __le16 crystal_good_time;
  88. __le32 valid;
  89. __le32 reserved_for_valids;
  90. __le16 bootup_mode_info;
  91. /* configuration used for digital loop back */
  92. __le16 digital_loop_back_params;
  93. __le16 rtls_timestamp_en;
  94. __le16 host_spi_intr_cfg;
  95. struct device_clk_info device_clk_info[3];
  96. /* ulp buckboost wait time */
  97. __le32 buckboost_wakeup_cnt;
  98. /* pmu wakeup wait time & WDT EN info */
  99. __le16 pmu_wakeup_wait;
  100. u8 shutdown_wait_time;
  101. /* Sleep clock source selection */
  102. u8 pmu_slp_clkout_sel;
  103. /* WDT programming values */
  104. __le32 wdt_prog_value;
  105. /* WDT soc reset delay */
  106. __le32 wdt_soc_rst_delay;
  107. /* dcdc modes configs */
  108. __le32 dcdc_operation_mode;
  109. __le32 soc_reset_wait_cnt;
  110. } __packed;
  111. #endif