targaddrs.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. /*
  2. * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifndef __TARGADDRS_H__
  27. #define __TARGADDRS_H__
  28. #if defined(ATH_TARGET)
  29. #include "soc_addrs.h"
  30. #endif
  31. #if !defined(ATH_TARGET)
  32. #include "athstartpack.h"
  33. #endif
  34. /*
  35. * SOC option bits, to enable/disable various features.
  36. * By default, all option bits are 0.
  37. * AR6004: These bits can be set in LOCAL_SCRATCH register 0.
  38. * AR9888: These bits can be set in soc_core register SCRATCH_0.
  39. */
  40. #define SOC_OPTION_BMI_DISABLE 0x01 /* Disable BMI comm with Host */
  41. #define SOC_OPTION_SERIAL_ENABLE 0x02 /* Enable serial port msgs */
  42. #define SOC_OPTION_WDT_DISABLE 0x04 /* WatchDog Timer override */
  43. #define SOC_OPTION_SLEEP_DISABLE 0x08 /* Disable system sleep */
  44. #define SOC_OPTION_STOP_BOOT 0x10 /* Stop boot processes (for ATE) */
  45. #define SOC_OPTION_ENABLE_NOANI 0x20 /* Operate without ANI */
  46. #define SOC_OPTION_DSET_DISABLE 0x40 /* Ignore DataSets */
  47. #define SOC_OPTION_IGNORE_FLASH 0x80 /* Ignore flash during bootup */
  48. /*
  49. * xxx_HOST_INTEREST_ADDRESS is the address in Target RAM of the
  50. * host_interest structure. It must match the address of the _host_interest
  51. * symbol (see linker script).
  52. *
  53. * Host Interest is shared between Host and Target in order to coordinate
  54. * between the two, and is intended to remain constant (with additions only
  55. * at the end) across software releases.
  56. *
  57. * All addresses are available here so that it's possible to
  58. * write a single binary that works with all Target Types.
  59. * May be used in assembler code as well as C.
  60. */
  61. #define AR6002_HOST_INTEREST_ADDRESS 0x00500400
  62. #define AR6003_HOST_INTEREST_ADDRESS 0x00540600
  63. #define AR6004_HOST_INTEREST_ADDRESS 0x00400800
  64. #define AR9888_HOST_INTEREST_ADDRESS 0x00400800
  65. #define AR900B_HOST_INTEREST_ADDRESS 0x00400800
  66. #define AR6320_HOST_INTEREST_ADDRESS 0x00400800
  67. #define QCA9377_HOST_INTEREST_ADDRESS 0x00400800
  68. #define AR6004_SOC_RESET_ADDRESS 0X00004000
  69. #define AR6004_SOC_RESET_CPU_INIT_RESET_MASK 0X00000800
  70. #if defined(AR6006_MEMORY_NEW_ARCH)
  71. #define AR6006_HOST_INTEREST_ADDRESS 0x00428800
  72. #else
  73. #define AR6006_HOST_INTEREST_ADDRESS 0x00400800
  74. #endif
  75. #define AR6006_SOC_RESET_ADDRESS 0X00004000
  76. #define AR6006_SOC_RESET_CPU_INIT_RESET_MASK 0X00000800
  77. #define HOST_INTEREST_MAX_SIZE 0x200
  78. #if !defined(__ASSEMBLER__)
  79. struct register_dump_s;
  80. struct dbglog_hdr_s;
  81. /*
  82. * These are items that the Host may need to access
  83. * via BMI or via the Diagnostic Window. The position
  84. * of items in this structure must remain constant
  85. * across firmware revisions!
  86. *
  87. * Types for each item must be fixed size across
  88. * target and host platforms.
  89. *
  90. * More items may be added at the end.
  91. */
  92. PREPACK64 struct host_interest_s {
  93. /*
  94. * Pointer to application-defined area, if any.
  95. * Set by Target application during startup.
  96. */
  97. A_UINT32 hi_app_host_interest; /* 0x00 */
  98. /* Pointer to register dump area, valid after Target crash. */
  99. A_UINT32 hi_failure_state; /* 0x04 */
  100. /* Pointer to debug logging header */
  101. A_UINT32 hi_dbglog_hdr; /* 0x08 */
  102. /* Save SW ROM version */
  103. A_UINT32 hi_sw_rom_version; /* 0x0c */
  104. /*
  105. * General-purpose flag bits, similar to SOC_OPTION_* flags.
  106. * Can be used by application rather than by OS.
  107. */
  108. volatile A_UINT32 hi_option_flag; /* 0x10 */
  109. /*
  110. * Boolean that determines whether or not to
  111. * display messages on the serial port.
  112. */
  113. A_UINT32 hi_serial_enable; /* 0x14 */
  114. /* Start address of DataSet index, if any */
  115. A_UINT32 hi_dset_list_head; /* 0x18 */
  116. /* Override Target application start address */
  117. A_UINT32 hi_app_start; /* 0x1c */
  118. /* Clock and voltage tuning */
  119. A_UINT32 hi_skip_clock_init; /* 0x20 */
  120. A_UINT32 hi_core_clock_setting; /* 0x24 */
  121. A_UINT32 hi_cpu_clock_setting; /* 0x28 */
  122. A_UINT32 hi_system_sleep_setting; /* 0x2c */
  123. A_UINT32 hi_xtal_control_setting; /* 0x30 */
  124. A_UINT32 hi_pll_ctrl_setting_24ghz; /* 0x34 */
  125. A_UINT32 hi_pll_ctrl_setting_5ghz; /* 0x38 */
  126. A_UINT32 hi_ref_voltage_trim_setting; /* 0x3c */
  127. A_UINT32 hi_clock_info; /* 0x40 */
  128. /* Host uses BE CPU or not */
  129. A_UINT32 hi_be; /* 0x44 */
  130. A_UINT32 hi_stack; /* normal stack *//* 0x48 */
  131. A_UINT32 hi_err_stack; /* error stack *//* 0x4c */
  132. A_UINT32 hi_desired_cpu_speed_hz; /* 0x50 */
  133. /* Pointer to Board Data */
  134. A_UINT32 hi_board_data; /* 0x54 */
  135. /*
  136. * Indication of Board Data state:
  137. * 0: board data is not yet initialized.
  138. * 1: board data is initialized; unknown size
  139. * >1: number of bytes of initialized board data (varies with board type)
  140. */
  141. A_UINT32 hi_board_data_initialized; /* 0x58 */
  142. A_UINT32 hi_dset_RAM_index_table; /* 0x5c */
  143. A_UINT32 hi_desired_baud_rate; /* 0x60 */
  144. A_UINT32 hi_dbglog_config; /* 0x64 */
  145. A_UINT32 hi_end_RAM_reserve_sz; /* 0x68 */
  146. A_UINT32 hi_mbox_io_block_sz; /* 0x6c */
  147. A_UINT32 hi_num_bpatch_streams; /* 0x70 -- unused */
  148. A_UINT32 hi_mbox_isr_yield_limit; /* 0x74 */
  149. A_UINT32 hi_refclk_hz; /* 0x78 */
  150. A_UINT32 hi_ext_clk_detected; /* 0x7c */
  151. A_UINT32 hi_dbg_uart_txpin; /* 0x80 */
  152. A_UINT32 hi_dbg_uart_rxpin; /* 0x84 */
  153. A_UINT32 hi_hci_uart_baud; /* 0x88 */
  154. A_UINT32 hi_hci_uart_pin_assignments; /* 0x8C */
  155. /* NOTE: byte [0] = tx pin, [1] = rx pin, [2] = rts pin, [3] = cts pin */
  156. A_UINT32 hi_hci_uart_baud_scale_val; /* 0x90 */
  157. A_UINT32 hi_hci_uart_baud_step_val; /* 0x94 */
  158. A_UINT32 hi_allocram_start; /* 0x98 */
  159. A_UINT32 hi_allocram_sz; /* 0x9c */
  160. A_UINT32 hi_hci_bridge_flags; /* 0xa0 */
  161. A_UINT32 hi_hci_uart_support_pins; /* 0xa4 */
  162. /* NOTE: byte [0] = RESET pin (bit 7 is polarity), bytes[1]..bytes[3] are for future use */
  163. A_UINT32 hi_hci_uart_pwr_mgmt_params; /* 0xa8 */
  164. /* 0xa8 - [1]: 0 = UART FC active low, 1 = UART FC active high
  165. * [31:16]: wakeup timeout in ms
  166. */
  167. /* Pointer to extended board Data */
  168. A_UINT32 hi_board_ext_data; /* 0xac */
  169. A_UINT32 hi_board_ext_data_config; /* 0xb0 */
  170. /*
  171. * Bit [0] : valid
  172. * Bit[31:16: size
  173. */
  174. /*
  175. * hi_reset_flag is used to do some stuff when target reset.
  176. * such as restore app_start after warm reset or
  177. * preserve host Interest area, or preserve ROM data, literals etc.
  178. */
  179. A_UINT32 hi_reset_flag; /* 0xb4 */
  180. /* indicate hi_reset_flag is valid */
  181. A_UINT32 hi_reset_flag_valid; /* 0xb8 */
  182. A_UINT32 hi_hci_uart_pwr_mgmt_params_ext; /* 0xbc */
  183. /* 0xbc - [31:0]: idle timeout in ms
  184. */
  185. /* ACS flags */
  186. A_UINT32 hi_acs_flags; /* 0xc0 */
  187. A_UINT32 hi_console_flags; /* 0xc4 */
  188. A_UINT32 hi_nvram_state; /* 0xc8 */
  189. volatile A_UINT32 hi_option_flag2; /* 0xcc */
  190. /* If non-zero, override values sent to Host in WMI_READY event. */
  191. A_UINT32 hi_sw_version_override; /* 0xd0 */
  192. A_UINT32 hi_abi_version_override; /* 0xd4 */
  193. /* Percentage of high priority RX traffic to total expected RX traffic -
  194. * applicable only to ar6004 */
  195. A_UINT32 hi_hp_rx_traffic_ratio; /* 0xd8 */
  196. /* test applications flags */
  197. A_UINT32 hi_test_apps_related; /* 0xdc */
  198. /* location of test script */
  199. A_UINT32 hi_ota_testscript; /* 0xe0 */
  200. /* location of CAL data */
  201. A_UINT32 hi_cal_data; /* 0xe4 */
  202. /* Number of packet log buffers */
  203. volatile A_UINT32 hi_pktlog_num_buffers; /* 0xe8 */
  204. /* wow extension configuration */
  205. A_UINT32 hi_wow_ext_config; /* 0xec */
  206. A_UINT32 hi_pwr_save_flags; /* 0xf0 */
  207. /* Spatial Multiplexing Power Save (SMPS) options */
  208. A_UINT32 hi_smps_options; /* 0xf4 */
  209. /* Interconnect-specific state */
  210. A_UINT32 hi_interconnect_state; /* 0xf8 */
  211. /* Coex configuration flags */
  212. A_UINT32 hi_coex_config; /* 0xfc */
  213. /* Early allocation support */
  214. A_UINT32 hi_early_alloc; /* 0x100 */
  215. /* FW swap field */
  216. /* Bits of this 32bit word will be used to pass specific swap
  217. instruction to FW */
  218. /* Bit 0 -- AP Nart descriptor no swap. When this bit is set
  219. FW will not swap TX descriptor. Meaning packets are formed
  220. on the target processor. */
  221. /* Bit 1 -- TBD */
  222. A_UINT32 hi_fw_swap; /* 0x104 */
  223. /* global arenas pointer address, used by host driver debug */
  224. A_UINT32 hi_dynamic_mem_arenas_addr; /* 0x108 */
  225. /* allocated bytes of DRAM use by allocated */
  226. A_UINT32 hi_dynamic_mem_allocated; /* 0x10C */
  227. /* remaining bytes of DRAM */
  228. A_UINT32 hi_dynamic_mem_remaining; /* 0x110 */
  229. /* memory track count, configured by host */
  230. A_UINT32 hi_dynamic_mem_track_max; /* 0x114 */
  231. /* minidump buffer */
  232. A_UINT32 hi_minidump; /* 0x118 */
  233. /* bdata's sig and key addr */
  234. A_UINT32 hi_bd_sig_key; /* 0x11c */
  235. } POSTPACK64;
  236. /* bitmap for hi_test_apps_related */
  237. #define HI_TEST_APPS_TESTSCRIPT_LOADED 0x00000001
  238. #define HI_TEST_APPS_CAL_DATA_AVAIL 0x00000002
  239. /* Bits defined in hi_option_flag */
  240. #define HI_OPTION_TIMER_WAR 0x01 /* Enable timer workaround */
  241. #define HI_OPTION_BMI_CRED_LIMIT 0x02 /* Limit BMI command credits */
  242. #define HI_OPTION_RELAY_DOT11_HDR 0x04 /* Relay Dot11 hdr to/from host */
  243. #define HI_OPTION_MAC_ADDR_METHOD 0x08 /* MAC addr method 0-locally administred 1-globally unique addrs */
  244. #define HI_OPTION_FW_BRIDGE 0x10 /* Firmware Bridging */
  245. #define HI_OPTION_ENABLE_PROFILE 0x20 /* Enable CPU profiling */
  246. #define HI_OPTION_DISABLE_DBGLOG 0x40 /* Disable debug logging */
  247. #define HI_OPTION_SKIP_ERA_TRACKING 0x80 /* Skip Era Tracking */
  248. #define HI_OPTION_PAPRD_DISABLE 0x100 /* Disable PAPRD (debug) */
  249. #define HI_OPTION_NUM_DEV_LSB 0x200
  250. #define HI_OPTION_NUM_DEV_MSB 0x800
  251. #define HI_OPTION_DEV_MODE_LSB 0x1000
  252. #define HI_OPTION_DEV_MODE_MSB 0x8000000
  253. #define HI_OPTION_NO_LFT_STBL 0x10000000 /* Disable LowFreq Timer Stabilization */
  254. #define HI_OPTION_SKIP_REG_SCAN 0x20000000 /* Skip regulatory scan */
  255. #define HI_OPTION_INIT_REG_SCAN 0x40000000 /* Do regulatory scan during init before
  256. * sending WMI ready event to host */
  257. #define HI_OPTION_SKIP_MEMMAP 0x80000000 /* REV6: Do not adjust memory map */
  258. #define HI_OPTION_MAC_ADDR_METHOD_SHIFT 3
  259. /* 2 bits of hi_option_flag are used to represent 3 modes */
  260. #define HI_OPTION_FW_MODE_IBSS 0x0 /* IBSS Mode */
  261. #define HI_OPTION_FW_MODE_BSS_STA 0x1 /* STA Mode */
  262. #define HI_OPTION_FW_MODE_AP 0x2 /* AP Mode */
  263. #define HI_OPTION_FW_MODE_BT30AMP 0x3 /* BT30 AMP Mode */
  264. /* 2 bits of hi_option flag are usedto represent 4 submodes */
  265. #define HI_OPTION_FW_SUBMODE_NONE 0x0 /* Normal mode */
  266. #define HI_OPTION_FW_SUBMODE_P2PDEV 0x1 /* p2p device mode */
  267. #define HI_OPTION_FW_SUBMODE_P2PCLIENT 0x2 /* p2p client mode */
  268. #define HI_OPTION_FW_SUBMODE_P2PGO 0x3 /* p2p go mode */
  269. /* Num dev Mask */
  270. #define HI_OPTION_NUM_DEV_MASK 0x7
  271. #define HI_OPTION_NUM_DEV_SHIFT 0x9
  272. /* firmware bridging */
  273. #define HI_OPTION_FW_BRIDGE_SHIFT 0x04
  274. /* Fw Mode/SubMode Mask
  275. |-------------------------------------------------------------------------------|
  276. | SUB | SUB | SUB | SUB | | | | |
  277. | MODE[3] | MODE[2] | MODE[1] | MODE[0] | MODE[3] | MODE[2] | MODE[1] | MODE[0] |
  278. | (2) | (2) | (2) | (2) | (2) | (2) | (2) | (2) |
  279. |||-------------------------------------------------------------------------------|
  280. */
  281. #define HI_OPTION_FW_MODE_BITS 0x2
  282. #define HI_OPTION_FW_MODE_MASK 0x3
  283. #define HI_OPTION_FW_MODE_SHIFT 0xC
  284. #define HI_OPTION_ALL_FW_MODE_MASK 0xFF
  285. #define HI_OPTION_FW_SUBMODE_BITS 0x2
  286. #define HI_OPTION_FW_SUBMODE_MASK 0x3
  287. #define HI_OPTION_FW_SUBMODE_SHIFT 0x14
  288. #define HI_OPTION_ALL_FW_SUBMODE_MASK 0xFF00
  289. #define HI_OPTION_ALL_FW_SUBMODE_SHIFT 0x8
  290. /* hi_option_flag2 options */
  291. #define HI_OPTION_OFFLOAD_AMSDU 0x01
  292. #define HI_OPTION_DFS_SUPPORT 0x02 /* Enable DFS support */
  293. #define HI_OPTION_ENABLE_RFKILL 0x04 /* RFKill Enable Feature */
  294. #define HI_OPTION_RADIO_RETENTION_DISABLE 0x08 /* Disable radio retention */
  295. #define HI_OPTION_EARLY_CFG_DONE 0x10 /* Early configuration is complete */
  296. #define HI_OPTION_RF_KILL_SHIFT 0x2
  297. #define HI_OPTION_RF_KILL_MASK 0x1
  298. #define HI_OPTION_HTT_TGT_DEBUG_TX_COMPL_IDX 0x20
  299. #define HTT_TGT_DEBUG_TX_COMPL_IDX_VALUE() \
  300. ((HOST_INTEREST->hi_option_flag2 & HI_OPTION_HTT_TGT_DEBUG_TX_COMPL_IDX))
  301. /* AR9888 1.0 only. Enable/disable CDC max perf support from host */
  302. #define HI_OPTION_DISABLE_CDC_MAX_PERF_WAR 0x20
  303. #define CDC_MAX_PERF_WAR_ENABLED() \
  304. (!(HOST_INTEREST->hi_option_flag2 & HI_OPTION_DISABLE_CDC_MAX_PERF_WAR))
  305. #define HI_OPTION_USE_EXT_LDO 0x40 /* use LDO27 for 1.1V instead of PMU. */
  306. #define HI_OPTION_DBUART_SUPPORT 0x80 /* Enable uart debug support */
  307. /* This bit is to enable BE low latency for some customers.
  308. * The side effect is TCP DL will be 8Mbps decreased (673Mbps -> 665Mbps).
  309. */
  310. #define HI_OPTION_BE_LATENCY_OPTIMIZE 0x100
  311. #define HT_OPTION_GPIO_WAKEUP_SUPPORT 0x200 /* GPIO wake up support */
  312. #define GPIO_WAKEUP_ENABLED() \
  313. (HOST_INTEREST->hi_option_flag2 & HT_OPTION_GPIO_WAKEUP_SUPPORT)
  314. /* hi_reset_flag */
  315. #define HI_RESET_FLAG_PRESERVE_APP_START 0x01 /* preserve App Start address */
  316. #define HI_RESET_FLAG_PRESERVE_HOST_INTEREST 0x02 /* preserve host interest */
  317. #define HI_RESET_FLAG_PRESERVE_ROMDATA 0x04 /* preserve ROM data */
  318. #define HI_RESET_FLAG_PRESERVE_NVRAM_STATE 0x08
  319. #define HI_RESET_FLAG_PRESERVE_BOOT_INFO 0x10
  320. #define HI_RESET_FLAG_WARM_RESET 0x20
  321. /* define hi_fw_swap bits */
  322. #define HI_DESC_IN_FW_BIT 0x01
  323. #define HI_RESET_FLAG_IS_VALID 0x12345678 /* indicate the reset flag is valid */
  324. #define ON_RESET_FLAGS_VALID() \
  325. (HOST_INTEREST->hi_reset_flag_valid == HI_RESET_FLAG_IS_VALID)
  326. #define RESET_FLAGS_VALIDATE() \
  327. (HOST_INTEREST->hi_reset_flag_valid = HI_RESET_FLAG_IS_VALID)
  328. #define RESET_FLAGS_INVALIDATE() \
  329. (HOST_INTEREST->hi_reset_flag_valid = 0)
  330. #define ON_RESET_PRESERVE_APP_START() \
  331. (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_PRESERVE_APP_START)
  332. #define ON_RESET_PRESERVE_NVRAM_STATE() \
  333. (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_PRESERVE_NVRAM_STATE)
  334. #define ON_RESET_PRESERVE_HOST_INTEREST() \
  335. (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_PRESERVE_HOST_INTEREST)
  336. #define ON_RESET_PRESERVE_ROMDATA() \
  337. (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_PRESERVE_ROMDATA)
  338. #define ON_RESET_PRESERVE_BOOT_INFO() \
  339. (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_PRESERVE_BOOT_INFO)
  340. #define ON_RESET_WARM_RESET() \
  341. (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_WARM_RESET)
  342. /* host CPU endianness */
  343. #define HOST_ON_BE_CPU() \
  344. (HOST_INTEREST->hi_be)
  345. /* AP nart no swap descriptor flag. Decsriptors are created
  346. * on the target processor.
  347. */
  348. #define DESC_IN_FW() \
  349. (HOST_INTEREST->hi_fw_swap & HI_DESC_IN_FW_BIT)
  350. /* redefine for hi_acs_flags since no product ever use it
  351. * NOTE:
  352. * This flag was only used in AR6004 for a customer project that has
  353. * been canceled, we are reusing it to avoid extending the Host interest
  354. * area.
  355. * BIT Range Meaning
  356. * --------- ----------------------------------
  357. * 0 HOST wants to swap MBOX usage
  358. * 1 HOST supports HTT reduced tx completion
  359. * 2 HOST supports HTT alternate credit size for data frames
  360. * 15..3 reserved for HOST
  361. * 16 FW set it before sending HTC_Ready to indicate MBOX swap is done
  362. * 17 same as above but to indicate HTT reduced tx completion capability
  363. * 31..18 reserved for FW
  364. */
  365. /* HOST require to swap MBOX */
  366. #define HI_ACS_FLAGS_HOST_SWAP_MBOX (1 << 0)
  367. /* HOST supports HTT reduced tx completion */
  368. #define HI_ACS_FLAGS_HOST_REDUCE_TX_COMPL (1 << 1)
  369. /* HOST supports alternate credit size for data frames */
  370. #define HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE (1 << 2)
  371. /* FW swapped MBOX */
  372. #define HI_ACS_FLAGS_FW_SWAPPED_MBOX (1 << 16)
  373. /* FW support HTT reduced tx completion */
  374. #define HI_ACS_FLAGS_FW_REDUCE_TX_COMPL (1 << 17)
  375. /* CONSOLE FLAGS
  376. *
  377. * Bit Range Meaning
  378. * --------- --------------------------------
  379. * 2..0 UART ID (0 = Default)
  380. * 3 Baud Select (0 = 9600, 1 = 115200)
  381. * 30..4 Reserved
  382. * 31 Enable Console
  383. *
  384. * */
  385. #define HI_CONSOLE_FLAGS_ENABLE (1 << 31)
  386. #define HI_CONSOLE_FLAGS_UART_MASK (0x7)
  387. #define HI_CONSOLE_FLAGS_UART_SHIFT 0
  388. #define HI_CONSOLE_FLAGS_BAUD_SELECT (1 << 3)
  389. /* SM power save options */
  390. #define HI_SMPS_ALLOW_MASK (0x00000001)
  391. #define HI_SMPS_MODE_MASK (0x00000002)
  392. #define HI_SMPS_MODE_STATIC (0x00000000)
  393. #define HI_SMPS_MODE_DYNAMIC (0x00000002)
  394. #define HI_SMPS_DISABLE_AUTO_MODE (0x00000004)
  395. #define HI_SMPS_DATA_THRESH_MASK (0x000007f8)
  396. #define HI_SMPS_DATA_THRESH_SHIFT (3)
  397. #define HI_SMPS_RSSI_THRESH_MASK (0x0007f800)
  398. #define HI_SMPS_RSSI_THRESH_SHIFT (11)
  399. #define HI_SMPS_LOWPWR_CM_MASK (0x00380000)
  400. #define HI_SMPS_LOWPWR_CM_SHIFT (15)
  401. #define HI_SMPS_HIPWR_CM_MASK (0x03c00000)
  402. #define HI_SMPS_HIPWR_CM_SHIFT (19)
  403. #define HOST_INTEREST_SMPS_GET_MODE() (HOST_INTEREST->hi_smps_options & HI_SMPS_MODE_MASK)
  404. #define HOST_INTEREST_SMPS_GET_DATA_THRESH() ((HOST_INTEREST->hi_smps_options & HI_SMPS_DATA_THRESH_MASK) >> HI_SMPS_DATA_THRESH_SHIFT)
  405. #define HOST_INTEREST_SMPS_SET_DATA_THRESH(x) (((x) << HI_SMPS_DATA_THRESH_SHIFT) & HI_SMPS_DATA_THRESH_MASK)
  406. #define HOST_INTEREST_SMPS_GET_RSSI_THRESH() ((HOST_INTEREST->hi_smps_options & HI_SMPS_RSSI_THRESH_MASK) >> HI_SMPS_RSSI_THRESH_SHIFT)
  407. #define HOST_INTEREST_SMPS_SET_RSSI_THRESH(x) (((x) << HI_SMPS_RSSI_THRESH_SHIFT) & HI_SMPS_RSSI_THRESH_MASK)
  408. #define HOST_INTEREST_SMPS_SET_LOWPWR_CM() ((HOST_INTEREST->hi_smps_options & HI_SMPS_LOWPWR_CM_MASK) >> HI_SMPS_LOWPWR_CM_SHIFT)
  409. #define HOST_INTEREST_SMPS_SET_HIPWR_CM() ((HOST_INTEREST->hi_smps_options << HI_SMPS_HIPWR_CM_MASK) & HI_SMPS_HIPWR_CM_SHIFT)
  410. #define HOST_INTEREST_SMPS_IS_AUTO_MODE_DISABLED() (HOST_INTEREST->hi_smps_options & HI_SMPS_DISABLE_AUTO_MODE)
  411. /* WOW Extension configuration
  412. *
  413. * Bit Range Meaning
  414. * --------- --------------------------------
  415. * 8..0 Size of each WOW pattern (max 511)
  416. * 15..9 Number of patterns per list (max 127)
  417. * 17..16 Number of lists (max 4)
  418. * 30..18 Reserved
  419. * 31 Enabled
  420. *
  421. * set values (except enable) to zeros for default settings
  422. *
  423. * */
  424. #define HI_WOW_EXT_ENABLED_MASK (1 << 31)
  425. #define HI_WOW_EXT_NUM_LIST_SHIFT 16
  426. #define HI_WOW_EXT_NUM_LIST_MASK (0x3 << HI_WOW_EXT_NUM_LIST_SHIFT)
  427. #define HI_WOW_EXT_NUM_PATTERNS_SHIFT 9
  428. #define HI_WOW_EXT_NUM_PATTERNS_MASK (0x7F << HI_WOW_EXT_NUM_PATTERNS_SHIFT)
  429. #define HI_WOW_EXT_PATTERN_SIZE_SHIFT 0
  430. #define HI_WOW_EXT_PATTERN_SIZE_MASK (0x1FF << HI_WOW_EXT_PATTERN_SIZE_SHIFT)
  431. #define HI_WOW_EXT_MAKE_CONFIG(num_lists,count,size) \
  432. ((((num_lists) << HI_WOW_EXT_NUM_LIST_SHIFT) & HI_WOW_EXT_NUM_LIST_MASK) | \
  433. (((count) << HI_WOW_EXT_NUM_PATTERNS_SHIFT) & HI_WOW_EXT_NUM_PATTERNS_MASK) | \
  434. (((size) << HI_WOW_EXT_PATTERN_SIZE_SHIFT) & HI_WOW_EXT_PATTERN_SIZE_MASK))
  435. #define HI_WOW_EXT_GET_NUM_LISTS(config) \
  436. (((config) & HI_WOW_EXT_NUM_LIST_MASK) >> HI_WOW_EXT_NUM_LIST_SHIFT)
  437. #define HI_WOW_EXT_GET_NUM_PATTERNS(config) \
  438. (((config) & HI_WOW_EXT_NUM_PATTERNS_MASK) >> HI_WOW_EXT_NUM_PATTERNS_SHIFT)
  439. #define HI_WOW_EXT_GET_PATTERN_SIZE(config) \
  440. (((config) & HI_WOW_EXT_PATTERN_SIZE_MASK) >> HI_WOW_EXT_PATTERN_SIZE_SHIFT)
  441. /*
  442. * Early allocation configuration
  443. * Support RAM bank configuration before BMI done and this eases the memory
  444. * allocation at very early stage
  445. * Bit Range Meaning
  446. * --------- ----------------------------------
  447. * [0:3] number of bank assigned to be IRAM
  448. * [4:15] reserved
  449. * [16:31] magic number
  450. *
  451. * Note:
  452. * 1. target firmware would check magic number and if it's a match, firmware
  453. * would consider the bits[0:15] are valid and base on that to calculate
  454. * the end of DRAM. Early allocation would be located at that area and
  455. * may be reclaimed when necesary
  456. * 2. if no magic number is found, early allocation would happen at "_end"
  457. * symbol of ROM which is located before the app-data and might NOT be
  458. * re-claimable. If this is adopted, link script should keep this in
  459. * mind to avoid data corruption.
  460. */
  461. #define HI_EARLY_ALLOC_MAGIC 0x6d8a
  462. #define HI_EARLY_ALLOC_MAGIC_MASK 0xffff0000
  463. #define HI_EARLY_ALLOC_MAGIC_SHIFT 16
  464. #define HI_EARLY_ALLOC_IRAM_BANKS_MASK 0x0000000f
  465. #define HI_EARLY_ALLOC_IRAM_BANKS_SHIFT 0
  466. #define HI_EARLY_ALLOC_VALID() \
  467. ((((HOST_INTEREST->hi_early_alloc) & HI_EARLY_ALLOC_MAGIC_MASK) >> HI_EARLY_ALLOC_MAGIC_SHIFT) \
  468. == (HI_EARLY_ALLOC_MAGIC))
  469. #define HI_EARLY_ALLOC_GET_IRAM_BANKS() \
  470. (((HOST_INTEREST->hi_early_alloc) & HI_EARLY_ALLOC_IRAM_BANKS_MASK) >> HI_EARLY_ALLOC_IRAM_BANKS_SHIFT)
  471. /*
  472. * Intended for use by Host software, this macro returns the Target RAM
  473. * address of any item in the host_interest structure.
  474. * Example: target_addr = AR6002_HOST_INTEREST_ITEM_ADDRESS(hi_board_data);
  475. */
  476. #define AR6002_HOST_INTEREST_ITEM_ADDRESS(item) \
  477. (A_UINT32)((size_t)&((((struct host_interest_s *)(AR6002_HOST_INTEREST_ADDRESS))->item)))
  478. #define AR6003_HOST_INTEREST_ITEM_ADDRESS(item) \
  479. (A_UINT32)((size_t)&((((struct host_interest_s *)(AR6003_HOST_INTEREST_ADDRESS))->item)))
  480. #define AR6004_HOST_INTEREST_ITEM_ADDRESS(item) \
  481. (A_UINT32)((size_t)&((((struct host_interest_s *)(AR6004_HOST_INTEREST_ADDRESS))->item)))
  482. #define AR6006_HOST_INTEREST_ITEM_ADDRESS(item) \
  483. (A_UINT32)((size_t)&((((struct host_interest_s *)(AR6006_HOST_INTEREST_ADDRESS))->item)))
  484. #define AR9888_HOST_INTEREST_ITEM_ADDRESS(item) \
  485. (A_UINT32)((size_t)&((((struct host_interest_s *)(AR9888_HOST_INTEREST_ADDRESS))->item)))
  486. #define AR6320_HOST_INTEREST_ITEM_ADDRESS(item) \
  487. (A_UINT32)((size_t)&((((struct host_interest_s *)(AR6320_HOST_INTEREST_ADDRESS))->item)))
  488. #define AR900B_HOST_INTEREST_ITEM_ADDRESS(item) \
  489. (A_UINT32)((size_t)&((((struct host_interest_s *)(AR900B_HOST_INTEREST_ADDRESS))->item)))
  490. #define HOST_INTEREST_DBGLOG_IS_ENABLED() \
  491. (!(HOST_INTEREST->hi_option_flag & HI_OPTION_DISABLE_DBGLOG))
  492. #define HOST_INTEREST_PKTLOG_IS_ENABLED() \
  493. ((HOST_INTEREST->hi_pktlog_num_buffers))
  494. #define HOST_INTEREST_PROFILE_IS_ENABLED() \
  495. (HOST_INTEREST->hi_option_flag & HI_OPTION_ENABLE_PROFILE)
  496. #define LF_TIMER_STABILIZATION_IS_ENABLED() \
  497. (!(HOST_INTEREST->hi_option_flag & HI_OPTION_NO_LFT_STBL))
  498. #define IS_AMSDU_OFFLAOD_ENABLED() \
  499. ((HOST_INTEREST->hi_option_flag2 & HI_OPTION_OFFLOAD_AMSDU))
  500. #define HOST_INTEREST_DFS_IS_ENABLED() \
  501. ((HOST_INTEREST->hi_option_flag2 & HI_OPTION_DFS_SUPPORT))
  502. #define HOST_INTEREST_EARLY_CFG_DONE() \
  503. ((HOST_INTEREST->hi_option_flag2 & HI_OPTION_EARLY_CFG_DONE))
  504. /*power save flag bit definitions*/
  505. #define HI_PWR_SAVE_LPL_ENABLED 0x1
  506. /*b1-b3 reserved*/
  507. /*b4-b5 : dev0 LPL type : 0 - none
  508. 1- Reduce Pwr Search
  509. 2- Reduce Pwr Listen*/
  510. /*b6-b7 : dev1 LPL type and so on for Max 8 devices*/
  511. #define HI_PWR_SAVE_LPL_DEV0_LSB 4
  512. #define HI_PWR_SAVE_LPL_DEV_MASK 0x3
  513. /*power save related utility macros*/
  514. #define HI_LPL_ENABLED() \
  515. ((HOST_INTEREST->hi_pwr_save_flags & HI_PWR_SAVE_LPL_ENABLED))
  516. #define HI_DEV_LPL_TYPE_GET(_devix) \
  517. (HOST_INTEREST->hi_pwr_save_flags & \
  518. ((HI_PWR_SAVE_LPL_DEV_MASK) << \
  519. (HI_PWR_SAVE_LPL_DEV0_LSB + \
  520. (_devix)*2)))
  521. #define HOST_INTEREST_SMPS_IS_ALLOWED() \
  522. ((HOST_INTEREST->hi_smps_options & HI_SMPS_ALLOW_MASK))
  523. /* Convert a Target virtual address into a Target physical address */
  524. #define AR6002_VTOP(vaddr) ((vaddr) & 0x001fffff)
  525. #define AR6003_VTOP(vaddr) ((vaddr) & 0x001fffff)
  526. #define AR6004_VTOP(vaddr) (vaddr)
  527. #define AR6006_VTOP(vaddr) (vaddr)
  528. #define AR9888_VTOP(vaddr) (vaddr)
  529. #define AR6320_VTOP(vaddr) (vaddr)
  530. #define AR900B_VTOP(vaddr) (vaddr)
  531. #define TARG_VTOP(TargetType, vaddr) \
  532. (((TargetType) == TARGET_TYPE_AR6002) ? AR6002_VTOP(vaddr) : \
  533. (((TargetType) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \
  534. (((TargetType) == TARGET_TYPE_AR6004) ? AR6004_VTOP(vaddr) : \
  535. (((TargetType) == TARGET_TYPE_AR6006) ? AR6006_VTOP(vaddr) : \
  536. (((TargetType) == TARGET_TYPE_AR9888) ? AR9888_VTOP(vaddr) : \
  537. (((TargetType) == TARGET_TYPE_AR6320) ? AR6320_VTOP(vaddr) : \
  538. (((TargetType) == TARGET_TYPE_AR900B) ? AR900B_VTOP(vaddr) : \
  539. 0)))))))
  540. #define HOST_INTEREST_ITEM_ADDRESS(TargetType, item) \
  541. (((TargetType) == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ADDRESS(item) : \
  542. (((TargetType) == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ADDRESS(item) : \
  543. (((TargetType) == TARGET_TYPE_AR6004) ? AR6004_HOST_INTEREST_ITEM_ADDRESS(item) : \
  544. (((TargetType) == TARGET_TYPE_AR6006) ? AR6006_HOST_INTEREST_ITEM_ADDRESS(item) : \
  545. (((TargetType) == TARGET_TYPE_AR9888) ? AR9888_HOST_INTEREST_ITEM_ADDRESS(item) : \
  546. (((TargetType) == TARGET_TYPE_AR6320) ? AR6320_HOST_INTEREST_ITEM_ADDRESS(item) : \
  547. (((TargetType) == TARGET_TYPE_AR900B) ? AR900B_HOST_INTEREST_ITEM_ADDRESS(item) : \
  548. 0)))))))
  549. #define AR6002_BOARD_DATA_SZ 768
  550. #define AR6002_BOARD_EXT_DATA_SZ 0
  551. #define AR6003_BOARD_DATA_SZ 1024
  552. /* Reserve 1024 bytes for extended board data */
  553. #if defined(AR6002_REV43)
  554. #define AR6003_BOARD_EXT_DATA_SZ 1024
  555. #else
  556. #define AR6003_BOARD_EXT_DATA_SZ 768
  557. #endif
  558. #define AR6004_BOARD_DATA_SZ 7168
  559. #define AR6004_BOARD_EXT_DATA_SZ 0
  560. #define AR9888_BOARD_DATA_SZ 7168
  561. #define AR9888_BOARD_EXT_DATA_SZ 0
  562. #define AR6320_BOARD_DATA_SZ 8192
  563. #define AR6320_BOARD_EXT_DATA_SZ 0
  564. #define QCA9377_BOARD_DATA_SZ 8192
  565. #define QCA9377_BOARD_EXT_DATA_SZ 0
  566. #define AR900B_BOARD_DATA_SZ 7168
  567. #define AR900B_BOARD_EXT_DATA_SZ 0
  568. #define AR6003_REV3_APP_START_OVERRIDE 0x946100
  569. #define AR6003_REV3_APP_LOAD_ADDRESS 0x545000
  570. #define AR6003_REV3_BOARD_EXT_DATA_ADDRESS 0x542330
  571. #define AR6003_REV3_DATASET_PATCH_ADDRESS 0x57FF74
  572. #define AR6003_REV3_RAM_RESERVE_SIZE 4096
  573. #define AR6004_REV1_BOARD_DATA_ADDRESS 0x423900
  574. #define AR6004_REV1_RAM_RESERVE_SIZE 19456
  575. #define AR6004_REV1_DATASET_PATCH_ADDRESS 0x425294
  576. #define AR6004_REV2_BOARD_DATA_ADDRESS 0x426400
  577. #define AR6004_REV2_RAM_RESERVE_SIZE 7168
  578. #define AR6004_REV2_DATASET_PATCH_ADDRESS 0x435294
  579. #define AR6004_REV5_BOARD_DATA_ADDRESS 0x436400
  580. #define AR6004_REV5_RAM_RESERVE_SIZE 7168
  581. #define AR6004_REV5_DATASET_PATCH_ADDRESS 0x437860
  582. /* Reserve 4K for OTA test script */
  583. #define AR6004_REV1_RAM_RESERVE_SIZE_FOR_TEST_SCRIPT 4096
  584. #define AR6004_REV1_TEST_SCRIPT_ADDRESS 0x422900
  585. /* # of A_UINT32 entries in targregs, used by DIAG_FETCH_TARG_REGS */
  586. #define AR6003_FETCH_TARG_REGS_COUNT 64
  587. #define AR6004_FETCH_TARG_REGS_COUNT 64
  588. #define AR9888_FETCH_TARG_REGS_COUNT 64
  589. #define AR6320_FETCH_TARG_REGS_COUNT 64
  590. #define AR900B_FETCH_TARG_REGS_COUNT 64
  591. #endif /* !__ASSEMBLER__ */
  592. #ifndef ATH_TARGET
  593. #include "athendpack.h"
  594. #endif
  595. #endif /* __TARGADDRS_H__ */