targaddrs.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. /*
  2. * Copyright (c) 2005-2011 Atheros Communications Inc.
  3. * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef __TARGADDRS_H__
  18. #define __TARGADDRS_H__
  19. /*
  20. * xxx_HOST_INTEREST_ADDRESS is the address in Target RAM of the
  21. * host_interest structure. It must match the address of the _host_interest
  22. * symbol (see linker script).
  23. *
  24. * Host Interest is shared between Host and Target in order to coordinate
  25. * between the two, and is intended to remain constant (with additions only
  26. * at the end) across software releases.
  27. *
  28. * All addresses are available here so that it's possible to
  29. * write a single binary that works with all Target Types.
  30. * May be used in assembler code as well as C.
  31. */
  32. #define QCA988X_HOST_INTEREST_ADDRESS 0x00400800
  33. #define HOST_INTEREST_MAX_SIZE 0x200
  34. /*
  35. * These are items that the Host may need to access via BMI or via the
  36. * Diagnostic Window. The position of items in this structure must remain
  37. * constant across firmware revisions! Types for each item must be fixed
  38. * size across target and host platforms. More items may be added at the end.
  39. */
  40. struct host_interest {
  41. /*
  42. * Pointer to application-defined area, if any.
  43. * Set by Target application during startup.
  44. */
  45. u32 hi_app_host_interest; /* 0x00 */
  46. /* Pointer to register dump area, valid after Target crash. */
  47. u32 hi_failure_state; /* 0x04 */
  48. /* Pointer to debug logging header */
  49. u32 hi_dbglog_hdr; /* 0x08 */
  50. u32 hi_unused0c; /* 0x0c */
  51. /*
  52. * General-purpose flag bits, similar to SOC_OPTION_* flags.
  53. * Can be used by application rather than by OS.
  54. */
  55. u32 hi_option_flag; /* 0x10 */
  56. /*
  57. * Boolean that determines whether or not to
  58. * display messages on the serial port.
  59. */
  60. u32 hi_serial_enable; /* 0x14 */
  61. /* Start address of DataSet index, if any */
  62. u32 hi_dset_list_head; /* 0x18 */
  63. /* Override Target application start address */
  64. u32 hi_app_start; /* 0x1c */
  65. /* Clock and voltage tuning */
  66. u32 hi_skip_clock_init; /* 0x20 */
  67. u32 hi_core_clock_setting; /* 0x24 */
  68. u32 hi_cpu_clock_setting; /* 0x28 */
  69. u32 hi_system_sleep_setting; /* 0x2c */
  70. u32 hi_xtal_control_setting; /* 0x30 */
  71. u32 hi_pll_ctrl_setting_24ghz; /* 0x34 */
  72. u32 hi_pll_ctrl_setting_5ghz; /* 0x38 */
  73. u32 hi_ref_voltage_trim_setting; /* 0x3c */
  74. u32 hi_clock_info; /* 0x40 */
  75. /* Host uses BE CPU or not */
  76. u32 hi_be; /* 0x44 */
  77. u32 hi_stack; /* normal stack */ /* 0x48 */
  78. u32 hi_err_stack; /* error stack */ /* 0x4c */
  79. u32 hi_desired_cpu_speed_hz; /* 0x50 */
  80. /* Pointer to Board Data */
  81. u32 hi_board_data; /* 0x54 */
  82. /*
  83. * Indication of Board Data state:
  84. * 0: board data is not yet initialized.
  85. * 1: board data is initialized; unknown size
  86. * >1: number of bytes of initialized board data
  87. */
  88. u32 hi_board_data_initialized; /* 0x58 */
  89. u32 hi_dset_ram_index_table; /* 0x5c */
  90. u32 hi_desired_baud_rate; /* 0x60 */
  91. u32 hi_dbglog_config; /* 0x64 */
  92. u32 hi_end_ram_reserve_sz; /* 0x68 */
  93. u32 hi_mbox_io_block_sz; /* 0x6c */
  94. u32 hi_num_bpatch_streams; /* 0x70 -- unused */
  95. u32 hi_mbox_isr_yield_limit; /* 0x74 */
  96. u32 hi_refclk_hz; /* 0x78 */
  97. u32 hi_ext_clk_detected; /* 0x7c */
  98. u32 hi_dbg_uart_txpin; /* 0x80 */
  99. u32 hi_dbg_uart_rxpin; /* 0x84 */
  100. u32 hi_hci_uart_baud; /* 0x88 */
  101. u32 hi_hci_uart_pin_assignments; /* 0x8C */
  102. u32 hi_hci_uart_baud_scale_val; /* 0x90 */
  103. u32 hi_hci_uart_baud_step_val; /* 0x94 */
  104. u32 hi_allocram_start; /* 0x98 */
  105. u32 hi_allocram_sz; /* 0x9c */
  106. u32 hi_hci_bridge_flags; /* 0xa0 */
  107. u32 hi_hci_uart_support_pins; /* 0xa4 */
  108. u32 hi_hci_uart_pwr_mgmt_params; /* 0xa8 */
  109. /*
  110. * 0xa8 - [1]: 0 = UART FC active low, 1 = UART FC active high
  111. * [31:16]: wakeup timeout in ms
  112. */
  113. /* Pointer to extended board Data */
  114. u32 hi_board_ext_data; /* 0xac */
  115. u32 hi_board_ext_data_config; /* 0xb0 */
  116. /*
  117. * Bit [0] : valid
  118. * Bit[31:16: size
  119. */
  120. /*
  121. * hi_reset_flag is used to do some stuff when target reset.
  122. * such as restore app_start after warm reset or
  123. * preserve host Interest area, or preserve ROM data, literals etc.
  124. */
  125. u32 hi_reset_flag; /* 0xb4 */
  126. /* indicate hi_reset_flag is valid */
  127. u32 hi_reset_flag_valid; /* 0xb8 */
  128. u32 hi_hci_uart_pwr_mgmt_params_ext; /* 0xbc */
  129. /* 0xbc - [31:0]: idle timeout in ms */
  130. /* ACS flags */
  131. u32 hi_acs_flags; /* 0xc0 */
  132. u32 hi_console_flags; /* 0xc4 */
  133. u32 hi_nvram_state; /* 0xc8 */
  134. u32 hi_option_flag2; /* 0xcc */
  135. /* If non-zero, override values sent to Host in WMI_READY event. */
  136. u32 hi_sw_version_override; /* 0xd0 */
  137. u32 hi_abi_version_override; /* 0xd4 */
  138. /*
  139. * Percentage of high priority RX traffic to total expected RX traffic
  140. * applicable only to ar6004
  141. */
  142. u32 hi_hp_rx_traffic_ratio; /* 0xd8 */
  143. /* test applications flags */
  144. u32 hi_test_apps_related; /* 0xdc */
  145. /* location of test script */
  146. u32 hi_ota_testscript; /* 0xe0 */
  147. /* location of CAL data */
  148. u32 hi_cal_data; /* 0xe4 */
  149. /* Number of packet log buffers */
  150. u32 hi_pktlog_num_buffers; /* 0xe8 */
  151. /* wow extension configuration */
  152. u32 hi_wow_ext_config; /* 0xec */
  153. u32 hi_pwr_save_flags; /* 0xf0 */
  154. /* Spatial Multiplexing Power Save (SMPS) options */
  155. u32 hi_smps_options; /* 0xf4 */
  156. /* Interconnect-specific state */
  157. u32 hi_interconnect_state; /* 0xf8 */
  158. /* Coex configuration flags */
  159. u32 hi_coex_config; /* 0xfc */
  160. /* Early allocation support */
  161. u32 hi_early_alloc; /* 0x100 */
  162. /* FW swap field */
  163. /*
  164. * Bits of this 32bit word will be used to pass specific swap
  165. * instruction to FW
  166. */
  167. /*
  168. * Bit 0 -- AP Nart descriptor no swap. When this bit is set
  169. * FW will not swap TX descriptor. Meaning packets are formed
  170. * on the target processor.
  171. */
  172. /* Bit 1 - unused */
  173. u32 hi_fw_swap; /* 0x104 */
  174. } __packed;
  175. #define HI_ITEM(item) offsetof(struct host_interest, item)
  176. /* Bits defined in hi_option_flag */
  177. /* Enable timer workaround */
  178. #define HI_OPTION_TIMER_WAR 0x01
  179. /* Limit BMI command credits */
  180. #define HI_OPTION_BMI_CRED_LIMIT 0x02
  181. /* Relay Dot11 hdr to/from host */
  182. #define HI_OPTION_RELAY_DOT11_HDR 0x04
  183. /* MAC addr method 0-locally administred 1-globally unique addrs */
  184. #define HI_OPTION_MAC_ADDR_METHOD 0x08
  185. /* Firmware Bridging */
  186. #define HI_OPTION_FW_BRIDGE 0x10
  187. /* Enable CPU profiling */
  188. #define HI_OPTION_ENABLE_PROFILE 0x20
  189. /* Disable debug logging */
  190. #define HI_OPTION_DISABLE_DBGLOG 0x40
  191. /* Skip Era Tracking */
  192. #define HI_OPTION_SKIP_ERA_TRACKING 0x80
  193. /* Disable PAPRD (debug) */
  194. #define HI_OPTION_PAPRD_DISABLE 0x100
  195. #define HI_OPTION_NUM_DEV_LSB 0x200
  196. #define HI_OPTION_NUM_DEV_MSB 0x800
  197. #define HI_OPTION_DEV_MODE_LSB 0x1000
  198. #define HI_OPTION_DEV_MODE_MSB 0x8000000
  199. /* Disable LowFreq Timer Stabilization */
  200. #define HI_OPTION_NO_LFT_STBL 0x10000000
  201. /* Skip regulatory scan */
  202. #define HI_OPTION_SKIP_REG_SCAN 0x20000000
  203. /*
  204. * Do regulatory scan during init before
  205. * sending WMI ready event to host
  206. */
  207. #define HI_OPTION_INIT_REG_SCAN 0x40000000
  208. /* REV6: Do not adjust memory map */
  209. #define HI_OPTION_SKIP_MEMMAP 0x80000000
  210. #define HI_OPTION_MAC_ADDR_METHOD_SHIFT 3
  211. /* 2 bits of hi_option_flag are used to represent 3 modes */
  212. #define HI_OPTION_FW_MODE_IBSS 0x0 /* IBSS Mode */
  213. #define HI_OPTION_FW_MODE_BSS_STA 0x1 /* STA Mode */
  214. #define HI_OPTION_FW_MODE_AP 0x2 /* AP Mode */
  215. #define HI_OPTION_FW_MODE_BT30AMP 0x3 /* BT30 AMP Mode */
  216. /* 2 bits of hi_option flag are usedto represent 4 submodes */
  217. #define HI_OPTION_FW_SUBMODE_NONE 0x0 /* Normal mode */
  218. #define HI_OPTION_FW_SUBMODE_P2PDEV 0x1 /* p2p device mode */
  219. #define HI_OPTION_FW_SUBMODE_P2PCLIENT 0x2 /* p2p client mode */
  220. #define HI_OPTION_FW_SUBMODE_P2PGO 0x3 /* p2p go mode */
  221. /* Num dev Mask */
  222. #define HI_OPTION_NUM_DEV_MASK 0x7
  223. #define HI_OPTION_NUM_DEV_SHIFT 0x9
  224. /* firmware bridging */
  225. #define HI_OPTION_FW_BRIDGE_SHIFT 0x04
  226. /*
  227. Fw Mode/SubMode Mask
  228. |-----------------------------------------------------------------------------|
  229. | SUB | SUB | SUB | SUB | | | | |
  230. |MODE[3] | MODE[2] | MODE[1] | MODE[0] | MODE[3] | MODE[2] | MODE[1] | MODE[0]|
  231. | (2) | (2) | (2) | (2) | (2) | (2) | (2) | (2) |
  232. |-----------------------------------------------------------------------------|
  233. */
  234. #define HI_OPTION_FW_MODE_BITS 0x2
  235. #define HI_OPTION_FW_MODE_MASK 0x3
  236. #define HI_OPTION_FW_MODE_SHIFT 0xC
  237. #define HI_OPTION_ALL_FW_MODE_MASK 0xFF
  238. #define HI_OPTION_FW_SUBMODE_BITS 0x2
  239. #define HI_OPTION_FW_SUBMODE_MASK 0x3
  240. #define HI_OPTION_FW_SUBMODE_SHIFT 0x14
  241. #define HI_OPTION_ALL_FW_SUBMODE_MASK 0xFF00
  242. #define HI_OPTION_ALL_FW_SUBMODE_SHIFT 0x8
  243. /* hi_option_flag2 options */
  244. #define HI_OPTION_OFFLOAD_AMSDU 0x01
  245. #define HI_OPTION_DFS_SUPPORT 0x02 /* Enable DFS support */
  246. #define HI_OPTION_ENABLE_RFKILL 0x04 /* RFKill Enable Feature*/
  247. #define HI_OPTION_RADIO_RETENTION_DISABLE 0x08 /* Disable radio retention */
  248. #define HI_OPTION_EARLY_CFG_DONE 0x10 /* Early configuration is complete */
  249. #define HI_OPTION_RF_KILL_SHIFT 0x2
  250. #define HI_OPTION_RF_KILL_MASK 0x1
  251. /* hi_reset_flag */
  252. /* preserve App Start address */
  253. #define HI_RESET_FLAG_PRESERVE_APP_START 0x01
  254. /* preserve host interest */
  255. #define HI_RESET_FLAG_PRESERVE_HOST_INTEREST 0x02
  256. /* preserve ROM data */
  257. #define HI_RESET_FLAG_PRESERVE_ROMDATA 0x04
  258. #define HI_RESET_FLAG_PRESERVE_NVRAM_STATE 0x08
  259. #define HI_RESET_FLAG_PRESERVE_BOOT_INFO 0x10
  260. #define HI_RESET_FLAG_WARM_RESET 0x20
  261. /* define hi_fw_swap bits */
  262. #define HI_DESC_IN_FW_BIT 0x01
  263. /* indicate the reset flag is valid */
  264. #define HI_RESET_FLAG_IS_VALID 0x12345678
  265. /* ACS is enabled */
  266. #define HI_ACS_FLAGS_ENABLED (1 << 0)
  267. /* Use physical WWAN device */
  268. #define HI_ACS_FLAGS_USE_WWAN (1 << 1)
  269. /* Use test VAP */
  270. #define HI_ACS_FLAGS_TEST_VAP (1 << 2)
  271. /*
  272. * CONSOLE FLAGS
  273. *
  274. * Bit Range Meaning
  275. * --------- --------------------------------
  276. * 2..0 UART ID (0 = Default)
  277. * 3 Baud Select (0 = 9600, 1 = 115200)
  278. * 30..4 Reserved
  279. * 31 Enable Console
  280. *
  281. */
  282. #define HI_CONSOLE_FLAGS_ENABLE (1 << 31)
  283. #define HI_CONSOLE_FLAGS_UART_MASK (0x7)
  284. #define HI_CONSOLE_FLAGS_UART_SHIFT 0
  285. #define HI_CONSOLE_FLAGS_BAUD_SELECT (1 << 3)
  286. /* SM power save options */
  287. #define HI_SMPS_ALLOW_MASK (0x00000001)
  288. #define HI_SMPS_MODE_MASK (0x00000002)
  289. #define HI_SMPS_MODE_STATIC (0x00000000)
  290. #define HI_SMPS_MODE_DYNAMIC (0x00000002)
  291. #define HI_SMPS_DISABLE_AUTO_MODE (0x00000004)
  292. #define HI_SMPS_DATA_THRESH_MASK (0x000007f8)
  293. #define HI_SMPS_DATA_THRESH_SHIFT (3)
  294. #define HI_SMPS_RSSI_THRESH_MASK (0x0007f800)
  295. #define HI_SMPS_RSSI_THRESH_SHIFT (11)
  296. #define HI_SMPS_LOWPWR_CM_MASK (0x00380000)
  297. #define HI_SMPS_LOWPWR_CM_SHIFT (15)
  298. #define HI_SMPS_HIPWR_CM_MASK (0x03c00000)
  299. #define HI_SMPS_HIPWR_CM_SHIFT (19)
  300. /*
  301. * WOW Extension configuration
  302. *
  303. * Bit Range Meaning
  304. * --------- --------------------------------
  305. * 8..0 Size of each WOW pattern (max 511)
  306. * 15..9 Number of patterns per list (max 127)
  307. * 17..16 Number of lists (max 4)
  308. * 30..18 Reserved
  309. * 31 Enabled
  310. *
  311. * set values (except enable) to zeros for default settings
  312. */
  313. #define HI_WOW_EXT_ENABLED_MASK (1 << 31)
  314. #define HI_WOW_EXT_NUM_LIST_SHIFT 16
  315. #define HI_WOW_EXT_NUM_LIST_MASK (0x3 << HI_WOW_EXT_NUM_LIST_SHIFT)
  316. #define HI_WOW_EXT_NUM_PATTERNS_SHIFT 9
  317. #define HI_WOW_EXT_NUM_PATTERNS_MASK (0x7F << HI_WOW_EXT_NUM_PATTERNS_SHIFT)
  318. #define HI_WOW_EXT_PATTERN_SIZE_SHIFT 0
  319. #define HI_WOW_EXT_PATTERN_SIZE_MASK (0x1FF << HI_WOW_EXT_PATTERN_SIZE_SHIFT)
  320. #define HI_WOW_EXT_MAKE_CONFIG(num_lists, count, size) \
  321. ((((num_lists) << HI_WOW_EXT_NUM_LIST_SHIFT) & \
  322. HI_WOW_EXT_NUM_LIST_MASK) | \
  323. (((count) << HI_WOW_EXT_NUM_PATTERNS_SHIFT) & \
  324. HI_WOW_EXT_NUM_PATTERNS_MASK) | \
  325. (((size) << HI_WOW_EXT_PATTERN_SIZE_SHIFT) & \
  326. HI_WOW_EXT_PATTERN_SIZE_MASK))
  327. #define HI_WOW_EXT_GET_NUM_LISTS(config) \
  328. (((config) & HI_WOW_EXT_NUM_LIST_MASK) >> HI_WOW_EXT_NUM_LIST_SHIFT)
  329. #define HI_WOW_EXT_GET_NUM_PATTERNS(config) \
  330. (((config) & HI_WOW_EXT_NUM_PATTERNS_MASK) >> \
  331. HI_WOW_EXT_NUM_PATTERNS_SHIFT)
  332. #define HI_WOW_EXT_GET_PATTERN_SIZE(config) \
  333. (((config) & HI_WOW_EXT_PATTERN_SIZE_MASK) >> \
  334. HI_WOW_EXT_PATTERN_SIZE_SHIFT)
  335. /*
  336. * Early allocation configuration
  337. * Support RAM bank configuration before BMI done and this eases the memory
  338. * allocation at very early stage
  339. * Bit Range Meaning
  340. * --------- ----------------------------------
  341. * [0:3] number of bank assigned to be IRAM
  342. * [4:15] reserved
  343. * [16:31] magic number
  344. *
  345. * Note:
  346. * 1. target firmware would check magic number and if it's a match, firmware
  347. * would consider the bits[0:15] are valid and base on that to calculate
  348. * the end of DRAM. Early allocation would be located at that area and
  349. * may be reclaimed when necesary
  350. * 2. if no magic number is found, early allocation would happen at "_end"
  351. * symbol of ROM which is located before the app-data and might NOT be
  352. * re-claimable. If this is adopted, link script should keep this in
  353. * mind to avoid data corruption.
  354. */
  355. #define HI_EARLY_ALLOC_MAGIC 0x6d8a
  356. #define HI_EARLY_ALLOC_MAGIC_MASK 0xffff0000
  357. #define HI_EARLY_ALLOC_MAGIC_SHIFT 16
  358. #define HI_EARLY_ALLOC_IRAM_BANKS_MASK 0x0000000f
  359. #define HI_EARLY_ALLOC_IRAM_BANKS_SHIFT 0
  360. #define HI_EARLY_ALLOC_VALID() \
  361. ((((HOST_INTEREST->hi_early_alloc) & HI_EARLY_ALLOC_MAGIC_MASK) >> \
  362. HI_EARLY_ALLOC_MAGIC_SHIFT) == (HI_EARLY_ALLOC_MAGIC))
  363. #define HI_EARLY_ALLOC_GET_IRAM_BANKS() \
  364. (((HOST_INTEREST->hi_early_alloc) & HI_EARLY_ALLOC_IRAM_BANKS_MASK) \
  365. >> HI_EARLY_ALLOC_IRAM_BANKS_SHIFT)
  366. /*power save flag bit definitions*/
  367. #define HI_PWR_SAVE_LPL_ENABLED 0x1
  368. /*b1-b3 reserved*/
  369. /*b4-b5 : dev0 LPL type : 0 - none
  370. 1- Reduce Pwr Search
  371. 2- Reduce Pwr Listen*/
  372. /*b6-b7 : dev1 LPL type and so on for Max 8 devices*/
  373. #define HI_PWR_SAVE_LPL_DEV0_LSB 4
  374. #define HI_PWR_SAVE_LPL_DEV_MASK 0x3
  375. /*power save related utility macros*/
  376. #define HI_LPL_ENABLED() \
  377. ((HOST_INTEREST->hi_pwr_save_flags & HI_PWR_SAVE_LPL_ENABLED))
  378. #define HI_DEV_LPL_TYPE_GET(_devix) \
  379. (HOST_INTEREST->hi_pwr_save_flags & ((HI_PWR_SAVE_LPL_DEV_MASK) << \
  380. (HI_PWR_SAVE_LPL_DEV0_LSB + (_devix)*2)))
  381. #define HOST_INTEREST_SMPS_IS_ALLOWED() \
  382. ((HOST_INTEREST->hi_smps_options & HI_SMPS_ALLOW_MASK))
  383. /* Reserve 1024 bytes for extended board data */
  384. #define QCA988X_BOARD_DATA_SZ 7168
  385. #define QCA988X_BOARD_EXT_DATA_SZ 0
  386. #endif /* __TARGADDRS_H__ */