phy_shim.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /*
  2. * Copyright (c) 2010 Broadcom Corporation
  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 ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /*
  17. * phy_shim.h: stuff defined in phy_shim.c and included only by the phy
  18. */
  19. #ifndef _BRCM_PHY_SHIM_H_
  20. #define _BRCM_PHY_SHIM_H_
  21. #include "types.h"
  22. #define RADAR_TYPE_NONE 0 /* Radar type None */
  23. #define RADAR_TYPE_ETSI_1 1 /* ETSI 1 Radar type */
  24. #define RADAR_TYPE_ETSI_2 2 /* ETSI 2 Radar type */
  25. #define RADAR_TYPE_ETSI_3 3 /* ETSI 3 Radar type */
  26. #define RADAR_TYPE_ITU_E 4 /* ITU E Radar type */
  27. #define RADAR_TYPE_ITU_K 5 /* ITU K Radar type */
  28. #define RADAR_TYPE_UNCLASSIFIED 6 /* Unclassified Radar type */
  29. #define RADAR_TYPE_BIN5 7 /* long pulse radar type */
  30. #define RADAR_TYPE_STG2 8 /* staggered-2 radar */
  31. #define RADAR_TYPE_STG3 9 /* staggered-3 radar */
  32. #define RADAR_TYPE_FRA 10 /* French radar */
  33. /* French radar pulse widths */
  34. #define FRA_T1_20MHZ 52770
  35. #define FRA_T2_20MHZ 61538
  36. #define FRA_T3_20MHZ 66002
  37. #define FRA_T1_40MHZ 105541
  38. #define FRA_T2_40MHZ 123077
  39. #define FRA_T3_40MHZ 132004
  40. #define FRA_ERR_20MHZ 60
  41. #define FRA_ERR_40MHZ 120
  42. #define ANTSEL_NA 0 /* No boardlevel selection available */
  43. #define ANTSEL_2x4 1 /* 2x4 boardlevel selection available */
  44. #define ANTSEL_2x3 2 /* 2x3 CB2 boardlevel selection available */
  45. /* Rx Antenna diversity control values */
  46. #define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */
  47. #define ANT_RX_DIV_FORCE_1 1 /* Use antenna 1 */
  48. #define ANT_RX_DIV_START_1 2 /* Choose starting with 1 */
  49. #define ANT_RX_DIV_START_0 3 /* Choose starting with 0 */
  50. #define ANT_RX_DIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity */
  51. #define ANT_RX_DIV_DEF ANT_RX_DIV_START_0 /* default antdiv setting */
  52. #define WL_ANT_RX_MAX 2 /* max 2 receive antennas */
  53. #define WL_ANT_HT_RX_MAX 3 /* max 3 receive antennas/cores */
  54. #define WL_ANT_IDX_1 0 /* antenna index 1 */
  55. #define WL_ANT_IDX_2 1 /* antenna index 2 */
  56. /* values for n_preamble_type */
  57. #define BRCMS_N_PREAMBLE_MIXEDMODE 0
  58. #define BRCMS_N_PREAMBLE_GF 1
  59. #define BRCMS_N_PREAMBLE_GF_BRCM 2
  60. #define WL_TX_POWER_RATES_LEGACY 45
  61. #define WL_TX_POWER_MCS20_FIRST 12
  62. #define WL_TX_POWER_MCS20_NUM 16
  63. #define WL_TX_POWER_MCS40_FIRST 28
  64. #define WL_TX_POWER_MCS40_NUM 17
  65. #define WL_TX_POWER_RATES 101
  66. #define WL_TX_POWER_CCK_FIRST 0
  67. #define WL_TX_POWER_CCK_NUM 4
  68. /* Index for first 20MHz OFDM SISO rate */
  69. #define WL_TX_POWER_OFDM_FIRST 4
  70. /* Index for first 20MHz OFDM CDD rate */
  71. #define WL_TX_POWER_OFDM20_CDD_FIRST 12
  72. /* Index for first 40MHz OFDM SISO rate */
  73. #define WL_TX_POWER_OFDM40_SISO_FIRST 52
  74. /* Index for first 40MHz OFDM CDD rate */
  75. #define WL_TX_POWER_OFDM40_CDD_FIRST 60
  76. #define WL_TX_POWER_OFDM_NUM 8
  77. /* Index for first 20MHz MCS SISO rate */
  78. #define WL_TX_POWER_MCS20_SISO_FIRST 20
  79. /* Index for first 20MHz MCS CDD rate */
  80. #define WL_TX_POWER_MCS20_CDD_FIRST 28
  81. /* Index for first 20MHz MCS STBC rate */
  82. #define WL_TX_POWER_MCS20_STBC_FIRST 36
  83. /* Index for first 20MHz MCS SDM rate */
  84. #define WL_TX_POWER_MCS20_SDM_FIRST 44
  85. /* Index for first 40MHz MCS SISO rate */
  86. #define WL_TX_POWER_MCS40_SISO_FIRST 68
  87. /* Index for first 40MHz MCS CDD rate */
  88. #define WL_TX_POWER_MCS40_CDD_FIRST 76
  89. /* Index for first 40MHz MCS STBC rate */
  90. #define WL_TX_POWER_MCS40_STBC_FIRST 84
  91. /* Index for first 40MHz MCS SDM rate */
  92. #define WL_TX_POWER_MCS40_SDM_FIRST 92
  93. #define WL_TX_POWER_MCS_1_STREAM_NUM 8
  94. #define WL_TX_POWER_MCS_2_STREAM_NUM 8
  95. /* Index for 40MHz rate MCS 32 */
  96. #define WL_TX_POWER_MCS_32 100
  97. #define WL_TX_POWER_MCS_32_NUM 1
  98. /* sslpnphy specifics */
  99. /* Index for first 20MHz MCS SISO rate */
  100. #define WL_TX_POWER_MCS20_SISO_FIRST_SSN 12
  101. /* struct tx_power::flags bits */
  102. #define WL_TX_POWER_F_ENABLED 1
  103. #define WL_TX_POWER_F_HW 2
  104. #define WL_TX_POWER_F_MIMO 4
  105. #define WL_TX_POWER_F_SISO 8
  106. /* values to force tx/rx chain */
  107. #define BRCMS_N_TXRX_CHAIN0 0
  108. #define BRCMS_N_TXRX_CHAIN1 1
  109. struct brcms_phy;
  110. struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw,
  111. struct brcms_info *wl,
  112. struct brcms_c_info *wlc);
  113. void wlc_phy_shim_detach(struct phy_shim_info *physhim);
  114. /* PHY to WL utility functions */
  115. struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim,
  116. void (*fn)(struct brcms_phy *pi),
  117. void *arg, const char *name);
  118. void wlapi_free_timer(struct wlapi_timer *t);
  119. void wlapi_add_timer(struct wlapi_timer *t, uint ms, int periodic);
  120. bool wlapi_del_timer(struct wlapi_timer *t);
  121. void wlapi_intrson(struct phy_shim_info *physhim);
  122. u32 wlapi_intrsoff(struct phy_shim_info *physhim);
  123. void wlapi_intrsrestore(struct phy_shim_info *physhim, u32 macintmask);
  124. void wlapi_bmac_write_shm(struct phy_shim_info *physhim, uint offset, u16 v);
  125. u16 wlapi_bmac_read_shm(struct phy_shim_info *physhim, uint offset);
  126. void wlapi_bmac_mhf(struct phy_shim_info *physhim, u8 idx, u16 mask, u16 val,
  127. int bands);
  128. void wlapi_bmac_corereset(struct phy_shim_info *physhim, u32 flags);
  129. void wlapi_suspend_mac_and_wait(struct phy_shim_info *physhim);
  130. void wlapi_switch_macfreq(struct phy_shim_info *physhim, u8 spurmode);
  131. void wlapi_enable_mac(struct phy_shim_info *physhim);
  132. void wlapi_bmac_mctrl(struct phy_shim_info *physhim, u32 mask, u32 val);
  133. void wlapi_bmac_phy_reset(struct phy_shim_info *physhim);
  134. void wlapi_bmac_bw_set(struct phy_shim_info *physhim, u16 bw);
  135. void wlapi_bmac_phyclk_fgc(struct phy_shim_info *physhim, bool clk);
  136. void wlapi_bmac_macphyclk_set(struct phy_shim_info *physhim, bool clk);
  137. void wlapi_bmac_core_phypll_ctl(struct phy_shim_info *physhim, bool on);
  138. void wlapi_bmac_core_phypll_reset(struct phy_shim_info *physhim);
  139. void wlapi_bmac_ucode_wake_override_phyreg_set(struct phy_shim_info *physhim);
  140. void wlapi_bmac_ucode_wake_override_phyreg_clear(struct phy_shim_info *physhim);
  141. void wlapi_bmac_write_template_ram(struct phy_shim_info *physhim, int o,
  142. int len, void *buf);
  143. u16 wlapi_bmac_rate_shm_offset(struct phy_shim_info *physhim, u8 rate);
  144. void wlapi_ucode_sample_init(struct phy_shim_info *physhim);
  145. void wlapi_copyfrom_objmem(struct phy_shim_info *physhim, uint, void *buf,
  146. int, u32 sel);
  147. void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint, const void *buf,
  148. int, u32);
  149. void wlapi_high_update_phy_mode(struct phy_shim_info *physhim, u32 phy_mode);
  150. u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim);
  151. #endif /* _BRCM_PHY_SHIM_H_ */