162306a36Sopenharmony_ci/* SPDX-License-Identifier: ISC */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2005-2011 Atheros Communications Inc.
462306a36Sopenharmony_ci * Copyright (c) 2011-2016 Qualcomm Atheros, Inc.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef __TARGADDRS_H__
862306a36Sopenharmony_ci#define __TARGADDRS_H__
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include "hw.h"
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci * xxx_HOST_INTEREST_ADDRESS is the address in Target RAM of the
1462306a36Sopenharmony_ci * host_interest structure.  It must match the address of the _host_interest
1562306a36Sopenharmony_ci * symbol (see linker script).
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci * Host Interest is shared between Host and Target in order to coordinate
1862306a36Sopenharmony_ci * between the two, and is intended to remain constant (with additions only
1962306a36Sopenharmony_ci * at the end) across software releases.
2062306a36Sopenharmony_ci *
2162306a36Sopenharmony_ci * All addresses are available here so that it's possible to
2262306a36Sopenharmony_ci * write a single binary that works with all Target Types.
2362306a36Sopenharmony_ci * May be used in assembler code as well as C.
2462306a36Sopenharmony_ci */
2562306a36Sopenharmony_ci#define QCA988X_HOST_INTEREST_ADDRESS    0x00400800
2662306a36Sopenharmony_ci#define HOST_INTEREST_MAX_SIZE          0x200
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/*
2962306a36Sopenharmony_ci * These are items that the Host may need to access via BMI or via the
3062306a36Sopenharmony_ci * Diagnostic Window. The position of items in this structure must remain
3162306a36Sopenharmony_ci * constant across firmware revisions! Types for each item must be fixed
3262306a36Sopenharmony_ci * size across target and host platforms. More items may be added at the end.
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_cistruct host_interest {
3562306a36Sopenharmony_ci	/*
3662306a36Sopenharmony_ci	 * Pointer to application-defined area, if any.
3762306a36Sopenharmony_ci	 * Set by Target application during startup.
3862306a36Sopenharmony_ci	 */
3962306a36Sopenharmony_ci	u32 hi_app_host_interest;			/* 0x00 */
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	/* Pointer to register dump area, valid after Target crash. */
4262306a36Sopenharmony_ci	u32 hi_failure_state;				/* 0x04 */
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci	/* Pointer to debug logging header */
4562306a36Sopenharmony_ci	u32 hi_dbglog_hdr;				/* 0x08 */
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci	u32 hi_unused0c;				/* 0x0c */
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci	/*
5062306a36Sopenharmony_ci	 * General-purpose flag bits, similar to SOC_OPTION_* flags.
5162306a36Sopenharmony_ci	 * Can be used by application rather than by OS.
5262306a36Sopenharmony_ci	 */
5362306a36Sopenharmony_ci	u32 hi_option_flag;				/* 0x10 */
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci	/*
5662306a36Sopenharmony_ci	 * Boolean that determines whether or not to
5762306a36Sopenharmony_ci	 * display messages on the serial port.
5862306a36Sopenharmony_ci	 */
5962306a36Sopenharmony_ci	u32 hi_serial_enable;				/* 0x14 */
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci	/* Start address of DataSet index, if any */
6262306a36Sopenharmony_ci	u32 hi_dset_list_head;				/* 0x18 */
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci	/* Override Target application start address */
6562306a36Sopenharmony_ci	u32 hi_app_start;				/* 0x1c */
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci	/* Clock and voltage tuning */
6862306a36Sopenharmony_ci	u32 hi_skip_clock_init;				/* 0x20 */
6962306a36Sopenharmony_ci	u32 hi_core_clock_setting;			/* 0x24 */
7062306a36Sopenharmony_ci	u32 hi_cpu_clock_setting;			/* 0x28 */
7162306a36Sopenharmony_ci	u32 hi_system_sleep_setting;			/* 0x2c */
7262306a36Sopenharmony_ci	u32 hi_xtal_control_setting;			/* 0x30 */
7362306a36Sopenharmony_ci	u32 hi_pll_ctrl_setting_24ghz;			/* 0x34 */
7462306a36Sopenharmony_ci	u32 hi_pll_ctrl_setting_5ghz;			/* 0x38 */
7562306a36Sopenharmony_ci	u32 hi_ref_voltage_trim_setting;		/* 0x3c */
7662306a36Sopenharmony_ci	u32 hi_clock_info;				/* 0x40 */
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci	/* Host uses BE CPU or not */
7962306a36Sopenharmony_ci	u32 hi_be;					/* 0x44 */
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci	u32 hi_stack;	/* normal stack */			/* 0x48 */
8262306a36Sopenharmony_ci	u32 hi_err_stack; /* error stack */		/* 0x4c */
8362306a36Sopenharmony_ci	u32 hi_desired_cpu_speed_hz;			/* 0x50 */
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci	/* Pointer to Board Data  */
8662306a36Sopenharmony_ci	u32 hi_board_data;				/* 0x54 */
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci	/*
8962306a36Sopenharmony_ci	 * Indication of Board Data state:
9062306a36Sopenharmony_ci	 *    0: board data is not yet initialized.
9162306a36Sopenharmony_ci	 *    1: board data is initialized; unknown size
9262306a36Sopenharmony_ci	 *   >1: number of bytes of initialized board data
9362306a36Sopenharmony_ci	 */
9462306a36Sopenharmony_ci	u32 hi_board_data_initialized;			/* 0x58 */
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci	u32 hi_dset_ram_index_table;			/* 0x5c */
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci	u32 hi_desired_baud_rate;			/* 0x60 */
9962306a36Sopenharmony_ci	u32 hi_dbglog_config;				/* 0x64 */
10062306a36Sopenharmony_ci	u32 hi_end_ram_reserve_sz;			/* 0x68 */
10162306a36Sopenharmony_ci	u32 hi_mbox_io_block_sz;			/* 0x6c */
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci	u32 hi_num_bpatch_streams;			/* 0x70 -- unused */
10462306a36Sopenharmony_ci	u32 hi_mbox_isr_yield_limit;			/* 0x74 */
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci	u32 hi_refclk_hz;				/* 0x78 */
10762306a36Sopenharmony_ci	u32 hi_ext_clk_detected;			/* 0x7c */
10862306a36Sopenharmony_ci	u32 hi_dbg_uart_txpin;				/* 0x80 */
10962306a36Sopenharmony_ci	u32 hi_dbg_uart_rxpin;				/* 0x84 */
11062306a36Sopenharmony_ci	u32 hi_hci_uart_baud;				/* 0x88 */
11162306a36Sopenharmony_ci	u32 hi_hci_uart_pin_assignments;		/* 0x8C */
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci	u32 hi_hci_uart_baud_scale_val;			/* 0x90 */
11462306a36Sopenharmony_ci	u32 hi_hci_uart_baud_step_val;			/* 0x94 */
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci	u32 hi_allocram_start;				/* 0x98 */
11762306a36Sopenharmony_ci	u32 hi_allocram_sz;				/* 0x9c */
11862306a36Sopenharmony_ci	u32 hi_hci_bridge_flags;			/* 0xa0 */
11962306a36Sopenharmony_ci	u32 hi_hci_uart_support_pins;			/* 0xa4 */
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci	u32 hi_hci_uart_pwr_mgmt_params;		/* 0xa8 */
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci	/*
12462306a36Sopenharmony_ci	 * 0xa8 - [1]: 0 = UART FC active low, 1 = UART FC active high
12562306a36Sopenharmony_ci	 *        [31:16]: wakeup timeout in ms
12662306a36Sopenharmony_ci	 */
12762306a36Sopenharmony_ci	/* Pointer to extended board Data  */
12862306a36Sopenharmony_ci	u32 hi_board_ext_data;				/* 0xac */
12962306a36Sopenharmony_ci	u32 hi_board_ext_data_config;			/* 0xb0 */
13062306a36Sopenharmony_ci	/*
13162306a36Sopenharmony_ci	 * Bit [0]  :   valid
13262306a36Sopenharmony_ci	 * Bit[31:16:   size
13362306a36Sopenharmony_ci	 */
13462306a36Sopenharmony_ci	/*
13562306a36Sopenharmony_ci	 * hi_reset_flag is used to do some stuff when target reset.
13662306a36Sopenharmony_ci	 * such as restore app_start after warm reset or
13762306a36Sopenharmony_ci	 * preserve host Interest area, or preserve ROM data, literals etc.
13862306a36Sopenharmony_ci	 */
13962306a36Sopenharmony_ci	u32  hi_reset_flag;				/* 0xb4 */
14062306a36Sopenharmony_ci	/* indicate hi_reset_flag is valid */
14162306a36Sopenharmony_ci	u32  hi_reset_flag_valid;			/* 0xb8 */
14262306a36Sopenharmony_ci	u32 hi_hci_uart_pwr_mgmt_params_ext;		/* 0xbc */
14362306a36Sopenharmony_ci	/* 0xbc - [31:0]: idle timeout in ms */
14462306a36Sopenharmony_ci	/* ACS flags */
14562306a36Sopenharmony_ci	u32 hi_acs_flags;				/* 0xc0 */
14662306a36Sopenharmony_ci	u32 hi_console_flags;				/* 0xc4 */
14762306a36Sopenharmony_ci	u32 hi_nvram_state;				/* 0xc8 */
14862306a36Sopenharmony_ci	u32 hi_option_flag2;				/* 0xcc */
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci	/* If non-zero, override values sent to Host in WMI_READY event. */
15162306a36Sopenharmony_ci	u32 hi_sw_version_override;			/* 0xd0 */
15262306a36Sopenharmony_ci	u32 hi_abi_version_override;			/* 0xd4 */
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci	/*
15562306a36Sopenharmony_ci	 * Percentage of high priority RX traffic to total expected RX traffic
15662306a36Sopenharmony_ci	 * applicable only to ar6004
15762306a36Sopenharmony_ci	 */
15862306a36Sopenharmony_ci	u32 hi_hp_rx_traffic_ratio;			/* 0xd8 */
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci	/* test applications flags */
16162306a36Sopenharmony_ci	u32 hi_test_apps_related;			/* 0xdc */
16262306a36Sopenharmony_ci	/* location of test script */
16362306a36Sopenharmony_ci	u32 hi_ota_testscript;				/* 0xe0 */
16462306a36Sopenharmony_ci	/* location of CAL data */
16562306a36Sopenharmony_ci	u32 hi_cal_data;				/* 0xe4 */
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci	/* Number of packet log buffers */
16862306a36Sopenharmony_ci	u32 hi_pktlog_num_buffers;			/* 0xe8 */
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci	/* wow extension configuration */
17162306a36Sopenharmony_ci	u32 hi_wow_ext_config;				/* 0xec */
17262306a36Sopenharmony_ci	u32 hi_pwr_save_flags;				/* 0xf0 */
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci	/* Spatial Multiplexing Power Save (SMPS) options */
17562306a36Sopenharmony_ci	u32 hi_smps_options;				/* 0xf4 */
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci	/* Interconnect-specific state */
17862306a36Sopenharmony_ci	u32 hi_interconnect_state;			/* 0xf8 */
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci	/* Coex configuration flags */
18162306a36Sopenharmony_ci	u32 hi_coex_config;				/* 0xfc */
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci	/* Early allocation support */
18462306a36Sopenharmony_ci	u32 hi_early_alloc;				/* 0x100 */
18562306a36Sopenharmony_ci	/* FW swap field */
18662306a36Sopenharmony_ci	/*
18762306a36Sopenharmony_ci	 * Bits of this 32bit word will be used to pass specific swap
18862306a36Sopenharmony_ci	 * instruction to FW
18962306a36Sopenharmony_ci	 */
19062306a36Sopenharmony_ci	/*
19162306a36Sopenharmony_ci	 * Bit 0 -- AP Nart descriptor no swap. When this bit is set
19262306a36Sopenharmony_ci	 * FW will not swap TX descriptor. Meaning packets are formed
19362306a36Sopenharmony_ci	 * on the target processor.
19462306a36Sopenharmony_ci	 */
19562306a36Sopenharmony_ci	/* Bit 1 - unused */
19662306a36Sopenharmony_ci	u32 hi_fw_swap;					/* 0x104 */
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci	/* global arenas pointer address, used by host driver debug */
19962306a36Sopenharmony_ci	u32 hi_dynamic_mem_arenas_addr;			/* 0x108 */
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci	/* allocated bytes of DRAM use by allocated */
20262306a36Sopenharmony_ci	u32 hi_dynamic_mem_allocated;			/* 0x10C */
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci	/* remaining bytes of DRAM */
20562306a36Sopenharmony_ci	u32 hi_dynamic_mem_remaining;			/* 0x110 */
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci	/* memory track count, configured by host */
20862306a36Sopenharmony_ci	u32 hi_dynamic_mem_track_max;			/* 0x114 */
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci	/* minidump buffer */
21162306a36Sopenharmony_ci	u32 hi_minidump;				/* 0x118 */
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci	/* bdata's sig and key addr */
21462306a36Sopenharmony_ci	u32 hi_bd_sig_key;				/* 0x11c */
21562306a36Sopenharmony_ci} __packed;
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci#define HI_ITEM(item)  offsetof(struct host_interest, item)
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci/* Bits defined in hi_option_flag */
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_ci/* Enable timer workaround */
22262306a36Sopenharmony_ci#define HI_OPTION_TIMER_WAR         0x01
22362306a36Sopenharmony_ci/* Limit BMI command credits */
22462306a36Sopenharmony_ci#define HI_OPTION_BMI_CRED_LIMIT    0x02
22562306a36Sopenharmony_ci/* Relay Dot11 hdr to/from host */
22662306a36Sopenharmony_ci#define HI_OPTION_RELAY_DOT11_HDR   0x04
22762306a36Sopenharmony_ci/* MAC addr method 0-locally administred 1-globally unique addrs */
22862306a36Sopenharmony_ci#define HI_OPTION_MAC_ADDR_METHOD   0x08
22962306a36Sopenharmony_ci/* Firmware Bridging */
23062306a36Sopenharmony_ci#define HI_OPTION_FW_BRIDGE         0x10
23162306a36Sopenharmony_ci/* Enable CPU profiling */
23262306a36Sopenharmony_ci#define HI_OPTION_ENABLE_PROFILE    0x20
23362306a36Sopenharmony_ci/* Disable debug logging */
23462306a36Sopenharmony_ci#define HI_OPTION_DISABLE_DBGLOG    0x40
23562306a36Sopenharmony_ci/* Skip Era Tracking */
23662306a36Sopenharmony_ci#define HI_OPTION_SKIP_ERA_TRACKING 0x80
23762306a36Sopenharmony_ci/* Disable PAPRD (debug) */
23862306a36Sopenharmony_ci#define HI_OPTION_PAPRD_DISABLE     0x100
23962306a36Sopenharmony_ci#define HI_OPTION_NUM_DEV_LSB       0x200
24062306a36Sopenharmony_ci#define HI_OPTION_NUM_DEV_MSB       0x800
24162306a36Sopenharmony_ci#define HI_OPTION_DEV_MODE_LSB      0x1000
24262306a36Sopenharmony_ci#define HI_OPTION_DEV_MODE_MSB      0x8000000
24362306a36Sopenharmony_ci/* Disable LowFreq Timer Stabilization */
24462306a36Sopenharmony_ci#define HI_OPTION_NO_LFT_STBL       0x10000000
24562306a36Sopenharmony_ci/* Skip regulatory scan */
24662306a36Sopenharmony_ci#define HI_OPTION_SKIP_REG_SCAN     0x20000000
24762306a36Sopenharmony_ci/*
24862306a36Sopenharmony_ci * Do regulatory scan during init before
24962306a36Sopenharmony_ci * sending WMI ready event to host
25062306a36Sopenharmony_ci */
25162306a36Sopenharmony_ci#define HI_OPTION_INIT_REG_SCAN     0x40000000
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci/* REV6: Do not adjust memory map */
25462306a36Sopenharmony_ci#define HI_OPTION_SKIP_MEMMAP       0x80000000
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ci#define HI_OPTION_MAC_ADDR_METHOD_SHIFT 3
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci/* 2 bits of hi_option_flag are used to represent 3 modes */
25962306a36Sopenharmony_ci#define HI_OPTION_FW_MODE_IBSS    0x0 /* IBSS Mode */
26062306a36Sopenharmony_ci#define HI_OPTION_FW_MODE_BSS_STA 0x1 /* STA Mode */
26162306a36Sopenharmony_ci#define HI_OPTION_FW_MODE_AP      0x2 /* AP Mode */
26262306a36Sopenharmony_ci#define HI_OPTION_FW_MODE_BT30AMP 0x3 /* BT30 AMP Mode */
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci/* 2 bits of hi_option flag are usedto represent 4 submodes */
26562306a36Sopenharmony_ci#define HI_OPTION_FW_SUBMODE_NONE    0x0  /* Normal mode */
26662306a36Sopenharmony_ci#define HI_OPTION_FW_SUBMODE_P2PDEV  0x1  /* p2p device mode */
26762306a36Sopenharmony_ci#define HI_OPTION_FW_SUBMODE_P2PCLIENT 0x2 /* p2p client mode */
26862306a36Sopenharmony_ci#define HI_OPTION_FW_SUBMODE_P2PGO   0x3 /* p2p go mode */
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci/* Num dev Mask */
27162306a36Sopenharmony_ci#define HI_OPTION_NUM_DEV_MASK    0x7
27262306a36Sopenharmony_ci#define HI_OPTION_NUM_DEV_SHIFT   0x9
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci/* firmware bridging */
27562306a36Sopenharmony_ci#define HI_OPTION_FW_BRIDGE_SHIFT 0x04
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci/*
27862306a36Sopenharmony_ci * Fw Mode/SubMode Mask
27962306a36Sopenharmony_ci *-----------------------------------------------------------------------------
28062306a36Sopenharmony_ci *  SUB   |   SUB   |   SUB   |  SUB    |         |         |         |
28162306a36Sopenharmony_ci *MODE[3] | MODE[2] | MODE[1] | MODE[0] | MODE[3] | MODE[2] | MODE[1] | MODE[0]
28262306a36Sopenharmony_ci *  (2)   |   (2)   |   (2)   |   (2)   |   (2)   |   (2)   |   (2)   |   (2)
28362306a36Sopenharmony_ci *-----------------------------------------------------------------------------
28462306a36Sopenharmony_ci */
28562306a36Sopenharmony_ci#define HI_OPTION_FW_MODE_BITS         0x2
28662306a36Sopenharmony_ci#define HI_OPTION_FW_MODE_MASK         0x3
28762306a36Sopenharmony_ci#define HI_OPTION_FW_MODE_SHIFT        0xC
28862306a36Sopenharmony_ci#define HI_OPTION_ALL_FW_MODE_MASK     0xFF
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci#define HI_OPTION_FW_SUBMODE_BITS      0x2
29162306a36Sopenharmony_ci#define HI_OPTION_FW_SUBMODE_MASK      0x3
29262306a36Sopenharmony_ci#define HI_OPTION_FW_SUBMODE_SHIFT     0x14
29362306a36Sopenharmony_ci#define HI_OPTION_ALL_FW_SUBMODE_MASK  0xFF00
29462306a36Sopenharmony_ci#define HI_OPTION_ALL_FW_SUBMODE_SHIFT 0x8
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci/* hi_option_flag2 options */
29762306a36Sopenharmony_ci#define HI_OPTION_OFFLOAD_AMSDU     0x01
29862306a36Sopenharmony_ci#define HI_OPTION_DFS_SUPPORT       0x02 /* Enable DFS support */
29962306a36Sopenharmony_ci#define HI_OPTION_ENABLE_RFKILL     0x04 /* RFKill Enable Feature*/
30062306a36Sopenharmony_ci#define HI_OPTION_RADIO_RETENTION_DISABLE 0x08 /* Disable radio retention */
30162306a36Sopenharmony_ci#define HI_OPTION_EARLY_CFG_DONE    0x10 /* Early configuration is complete */
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci#define HI_OPTION_RF_KILL_SHIFT     0x2
30462306a36Sopenharmony_ci#define HI_OPTION_RF_KILL_MASK      0x1
30562306a36Sopenharmony_ci
30662306a36Sopenharmony_ci/* hi_reset_flag */
30762306a36Sopenharmony_ci/* preserve App Start address */
30862306a36Sopenharmony_ci#define HI_RESET_FLAG_PRESERVE_APP_START         0x01
30962306a36Sopenharmony_ci/* preserve host interest */
31062306a36Sopenharmony_ci#define HI_RESET_FLAG_PRESERVE_HOST_INTEREST     0x02
31162306a36Sopenharmony_ci/* preserve ROM data */
31262306a36Sopenharmony_ci#define HI_RESET_FLAG_PRESERVE_ROMDATA           0x04
31362306a36Sopenharmony_ci#define HI_RESET_FLAG_PRESERVE_NVRAM_STATE       0x08
31462306a36Sopenharmony_ci#define HI_RESET_FLAG_PRESERVE_BOOT_INFO         0x10
31562306a36Sopenharmony_ci#define HI_RESET_FLAG_WARM_RESET	0x20
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci/* define hi_fw_swap bits */
31862306a36Sopenharmony_ci#define HI_DESC_IN_FW_BIT	0x01
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci/* indicate the reset flag is valid */
32162306a36Sopenharmony_ci#define HI_RESET_FLAG_IS_VALID  0x12345678
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ci/* ACS is enabled */
32462306a36Sopenharmony_ci#define HI_ACS_FLAGS_ENABLED        (1 << 0)
32562306a36Sopenharmony_ci/* Use physical WWAN device */
32662306a36Sopenharmony_ci#define HI_ACS_FLAGS_USE_WWAN       (1 << 1)
32762306a36Sopenharmony_ci/* Use test VAP */
32862306a36Sopenharmony_ci#define HI_ACS_FLAGS_TEST_VAP       (1 << 2)
32962306a36Sopenharmony_ci/* SDIO/mailbox ACS flag definitions */
33062306a36Sopenharmony_ci#define HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET       (1 << 0)
33162306a36Sopenharmony_ci#define HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET    (1 << 1)
33262306a36Sopenharmony_ci#define HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE        (1 << 2)
33362306a36Sopenharmony_ci#define HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_FW_ACK    (1 << 16)
33462306a36Sopenharmony_ci#define HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_FW_ACK (1 << 17)
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci/*
33762306a36Sopenharmony_ci * If both SDIO_CRASH_DUMP_ENHANCEMENT_HOST and SDIO_CRASH_DUMP_ENHANCEMENT_FW
33862306a36Sopenharmony_ci * flags are set, then crashdump upload will be done using the BMI host/target
33962306a36Sopenharmony_ci * communication channel.
34062306a36Sopenharmony_ci */
34162306a36Sopenharmony_ci/* HOST to support using BMI dump FW memory when hit assert */
34262306a36Sopenharmony_ci#define HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_HOST 0x400
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ci/* FW to support using BMI dump FW memory when hit assert */
34562306a36Sopenharmony_ci#define HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW   0x800
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci/*
34862306a36Sopenharmony_ci * CONSOLE FLAGS
34962306a36Sopenharmony_ci *
35062306a36Sopenharmony_ci * Bit Range  Meaning
35162306a36Sopenharmony_ci * ---------  --------------------------------
35262306a36Sopenharmony_ci *   2..0     UART ID (0 = Default)
35362306a36Sopenharmony_ci *    3       Baud Select (0 = 9600, 1 = 115200)
35462306a36Sopenharmony_ci *   30..4    Reserved
35562306a36Sopenharmony_ci *    31      Enable Console
35662306a36Sopenharmony_ci *
35762306a36Sopenharmony_ci */
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci#define HI_CONSOLE_FLAGS_ENABLE       (1 << 31)
36062306a36Sopenharmony_ci#define HI_CONSOLE_FLAGS_UART_MASK    (0x7)
36162306a36Sopenharmony_ci#define HI_CONSOLE_FLAGS_UART_SHIFT   0
36262306a36Sopenharmony_ci#define HI_CONSOLE_FLAGS_BAUD_SELECT  (1 << 3)
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ci/* SM power save options */
36562306a36Sopenharmony_ci#define HI_SMPS_ALLOW_MASK            (0x00000001)
36662306a36Sopenharmony_ci#define HI_SMPS_MODE_MASK             (0x00000002)
36762306a36Sopenharmony_ci#define HI_SMPS_MODE_STATIC           (0x00000000)
36862306a36Sopenharmony_ci#define HI_SMPS_MODE_DYNAMIC          (0x00000002)
36962306a36Sopenharmony_ci#define HI_SMPS_DISABLE_AUTO_MODE     (0x00000004)
37062306a36Sopenharmony_ci#define HI_SMPS_DATA_THRESH_MASK      (0x000007f8)
37162306a36Sopenharmony_ci#define HI_SMPS_DATA_THRESH_SHIFT     (3)
37262306a36Sopenharmony_ci#define HI_SMPS_RSSI_THRESH_MASK      (0x0007f800)
37362306a36Sopenharmony_ci#define HI_SMPS_RSSI_THRESH_SHIFT     (11)
37462306a36Sopenharmony_ci#define HI_SMPS_LOWPWR_CM_MASK        (0x00380000)
37562306a36Sopenharmony_ci#define HI_SMPS_LOWPWR_CM_SHIFT       (15)
37662306a36Sopenharmony_ci#define HI_SMPS_HIPWR_CM_MASK         (0x03c00000)
37762306a36Sopenharmony_ci#define HI_SMPS_HIPWR_CM_SHIFT        (19)
37862306a36Sopenharmony_ci
37962306a36Sopenharmony_ci/*
38062306a36Sopenharmony_ci * WOW Extension configuration
38162306a36Sopenharmony_ci *
38262306a36Sopenharmony_ci * Bit Range  Meaning
38362306a36Sopenharmony_ci * ---------  --------------------------------
38462306a36Sopenharmony_ci *   8..0     Size of each WOW pattern (max 511)
38562306a36Sopenharmony_ci *   15..9    Number of patterns per list (max 127)
38662306a36Sopenharmony_ci *   17..16   Number of lists (max 4)
38762306a36Sopenharmony_ci *   30..18   Reserved
38862306a36Sopenharmony_ci *   31       Enabled
38962306a36Sopenharmony_ci *
39062306a36Sopenharmony_ci *  set values (except enable) to zeros for default settings
39162306a36Sopenharmony_ci */
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci#define HI_WOW_EXT_ENABLED_MASK        (1 << 31)
39462306a36Sopenharmony_ci#define HI_WOW_EXT_NUM_LIST_SHIFT      16
39562306a36Sopenharmony_ci#define HI_WOW_EXT_NUM_LIST_MASK       (0x3 << HI_WOW_EXT_NUM_LIST_SHIFT)
39662306a36Sopenharmony_ci#define HI_WOW_EXT_NUM_PATTERNS_SHIFT  9
39762306a36Sopenharmony_ci#define HI_WOW_EXT_NUM_PATTERNS_MASK   (0x7F << HI_WOW_EXT_NUM_PATTERNS_SHIFT)
39862306a36Sopenharmony_ci#define HI_WOW_EXT_PATTERN_SIZE_SHIFT  0
39962306a36Sopenharmony_ci#define HI_WOW_EXT_PATTERN_SIZE_MASK   (0x1FF << HI_WOW_EXT_PATTERN_SIZE_SHIFT)
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_ci#define HI_WOW_EXT_MAKE_CONFIG(num_lists, count, size) \
40262306a36Sopenharmony_ci	((((num_lists) << HI_WOW_EXT_NUM_LIST_SHIFT) & \
40362306a36Sopenharmony_ci		HI_WOW_EXT_NUM_LIST_MASK) | \
40462306a36Sopenharmony_ci	(((count) << HI_WOW_EXT_NUM_PATTERNS_SHIFT) & \
40562306a36Sopenharmony_ci		HI_WOW_EXT_NUM_PATTERNS_MASK) | \
40662306a36Sopenharmony_ci	(((size) << HI_WOW_EXT_PATTERN_SIZE_SHIFT) & \
40762306a36Sopenharmony_ci		HI_WOW_EXT_PATTERN_SIZE_MASK))
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci#define HI_WOW_EXT_GET_NUM_LISTS(config) \
41062306a36Sopenharmony_ci	(((config) & HI_WOW_EXT_NUM_LIST_MASK) >> HI_WOW_EXT_NUM_LIST_SHIFT)
41162306a36Sopenharmony_ci#define HI_WOW_EXT_GET_NUM_PATTERNS(config) \
41262306a36Sopenharmony_ci	(((config) & HI_WOW_EXT_NUM_PATTERNS_MASK) >> \
41362306a36Sopenharmony_ci		HI_WOW_EXT_NUM_PATTERNS_SHIFT)
41462306a36Sopenharmony_ci#define HI_WOW_EXT_GET_PATTERN_SIZE(config) \
41562306a36Sopenharmony_ci	(((config) & HI_WOW_EXT_PATTERN_SIZE_MASK) >> \
41662306a36Sopenharmony_ci		HI_WOW_EXT_PATTERN_SIZE_SHIFT)
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_ci/*
41962306a36Sopenharmony_ci * Early allocation configuration
42062306a36Sopenharmony_ci * Support RAM bank configuration before BMI done and this eases the memory
42162306a36Sopenharmony_ci * allocation at very early stage
42262306a36Sopenharmony_ci * Bit Range  Meaning
42362306a36Sopenharmony_ci * ---------  ----------------------------------
42462306a36Sopenharmony_ci * [0:3]      number of bank assigned to be IRAM
42562306a36Sopenharmony_ci * [4:15]     reserved
42662306a36Sopenharmony_ci * [16:31]    magic number
42762306a36Sopenharmony_ci *
42862306a36Sopenharmony_ci * Note:
42962306a36Sopenharmony_ci * 1. target firmware would check magic number and if it's a match, firmware
43062306a36Sopenharmony_ci *    would consider the bits[0:15] are valid and base on that to calculate
43162306a36Sopenharmony_ci *    the end of DRAM. Early allocation would be located at that area and
43262306a36Sopenharmony_ci *    may be reclaimed when necessary
43362306a36Sopenharmony_ci * 2. if no magic number is found, early allocation would happen at "_end"
43462306a36Sopenharmony_ci *    symbol of ROM which is located before the app-data and might NOT be
43562306a36Sopenharmony_ci *    re-claimable. If this is adopted, link script should keep this in
43662306a36Sopenharmony_ci *    mind to avoid data corruption.
43762306a36Sopenharmony_ci */
43862306a36Sopenharmony_ci#define HI_EARLY_ALLOC_MAGIC		0x6d8a
43962306a36Sopenharmony_ci#define HI_EARLY_ALLOC_MAGIC_MASK	0xffff0000
44062306a36Sopenharmony_ci#define HI_EARLY_ALLOC_MAGIC_SHIFT	16
44162306a36Sopenharmony_ci#define HI_EARLY_ALLOC_IRAM_BANKS_MASK	0x0000000f
44262306a36Sopenharmony_ci#define HI_EARLY_ALLOC_IRAM_BANKS_SHIFT	0
44362306a36Sopenharmony_ci
44462306a36Sopenharmony_ci#define HI_EARLY_ALLOC_VALID() \
44562306a36Sopenharmony_ci	((((HOST_INTEREST->hi_early_alloc) & HI_EARLY_ALLOC_MAGIC_MASK) >> \
44662306a36Sopenharmony_ci	HI_EARLY_ALLOC_MAGIC_SHIFT) == (HI_EARLY_ALLOC_MAGIC))
44762306a36Sopenharmony_ci#define HI_EARLY_ALLOC_GET_IRAM_BANKS() \
44862306a36Sopenharmony_ci	(((HOST_INTEREST->hi_early_alloc) & HI_EARLY_ALLOC_IRAM_BANKS_MASK) \
44962306a36Sopenharmony_ci	>> HI_EARLY_ALLOC_IRAM_BANKS_SHIFT)
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci/*power save flag bit definitions*/
45262306a36Sopenharmony_ci#define HI_PWR_SAVE_LPL_ENABLED   0x1
45362306a36Sopenharmony_ci/*b1-b3 reserved*/
45462306a36Sopenharmony_ci/*b4-b5 : dev0 LPL type : 0 - none
45562306a36Sopenharmony_ci *			  1- Reduce Pwr Search
45662306a36Sopenharmony_ci *			  2- Reduce Pwr Listen
45762306a36Sopenharmony_ci */
45862306a36Sopenharmony_ci/*b6-b7 : dev1 LPL type and so on for Max 8 devices*/
45962306a36Sopenharmony_ci#define HI_PWR_SAVE_LPL_DEV0_LSB   4
46062306a36Sopenharmony_ci#define HI_PWR_SAVE_LPL_DEV_MASK   0x3
46162306a36Sopenharmony_ci/*power save related utility macros*/
46262306a36Sopenharmony_ci#define HI_LPL_ENABLED() \
46362306a36Sopenharmony_ci	((HOST_INTEREST->hi_pwr_save_flags & HI_PWR_SAVE_LPL_ENABLED))
46462306a36Sopenharmony_ci#define HI_DEV_LPL_TYPE_GET(_devix) \
46562306a36Sopenharmony_ci	(HOST_INTEREST->hi_pwr_save_flags & ((HI_PWR_SAVE_LPL_DEV_MASK) << \
46662306a36Sopenharmony_ci	 (HI_PWR_SAVE_LPL_DEV0_LSB + (_devix) * 2)))
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_ci#define HOST_INTEREST_SMPS_IS_ALLOWED() \
46962306a36Sopenharmony_ci	((HOST_INTEREST->hi_smps_options & HI_SMPS_ALLOW_MASK))
47062306a36Sopenharmony_ci
47162306a36Sopenharmony_ci/* Reserve 1024 bytes for extended board data */
47262306a36Sopenharmony_ci#define QCA988X_BOARD_DATA_SZ     7168
47362306a36Sopenharmony_ci#define QCA988X_BOARD_EXT_DATA_SZ 0
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ci#define QCA9887_BOARD_DATA_SZ     7168
47662306a36Sopenharmony_ci#define QCA9887_BOARD_EXT_DATA_SZ 0
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_ci#define QCA6174_BOARD_DATA_SZ     8192
47962306a36Sopenharmony_ci#define QCA6174_BOARD_EXT_DATA_SZ 0
48062306a36Sopenharmony_ci
48162306a36Sopenharmony_ci#define QCA9377_BOARD_DATA_SZ     QCA6174_BOARD_DATA_SZ
48262306a36Sopenharmony_ci#define QCA9377_BOARD_EXT_DATA_SZ 0
48362306a36Sopenharmony_ci
48462306a36Sopenharmony_ci#define QCA99X0_BOARD_DATA_SZ	  12288
48562306a36Sopenharmony_ci#define QCA99X0_BOARD_EXT_DATA_SZ 0
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci/* Dual band extended board data */
48862306a36Sopenharmony_ci#define QCA99X0_EXT_BOARD_DATA_SZ 2048
48962306a36Sopenharmony_ci#define EXT_BOARD_ADDRESS_OFFSET 0x3000
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_ci#define QCA4019_BOARD_DATA_SZ	  12064
49262306a36Sopenharmony_ci#define QCA4019_BOARD_EXT_DATA_SZ 0
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ci#endif /* __TARGADDRS_H__ */
495