162306a36Sopenharmony_ci/* SPDX-License-Identifier: ISC */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2005-2011 Atheros Communications Inc.
462306a36Sopenharmony_ci * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
562306a36Sopenharmony_ci * Copyright (c) 2018 The Linux Foundation. All rights reserved.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _HW_H_
962306a36Sopenharmony_ci#define _HW_H_
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include "targaddrs.h"
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cienum ath10k_bus {
1462306a36Sopenharmony_ci	ATH10K_BUS_PCI,
1562306a36Sopenharmony_ci	ATH10K_BUS_AHB,
1662306a36Sopenharmony_ci	ATH10K_BUS_SDIO,
1762306a36Sopenharmony_ci	ATH10K_BUS_USB,
1862306a36Sopenharmony_ci	ATH10K_BUS_SNOC,
1962306a36Sopenharmony_ci};
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define ATH10K_FW_DIR			"ath10k"
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#define QCA988X_2_0_DEVICE_ID_UBNT   (0x11ac)
2462306a36Sopenharmony_ci#define QCA988X_2_0_DEVICE_ID   (0x003c)
2562306a36Sopenharmony_ci#define QCA6164_2_1_DEVICE_ID   (0x0041)
2662306a36Sopenharmony_ci#define QCA6174_2_1_DEVICE_ID   (0x003e)
2762306a36Sopenharmony_ci#define QCA6174_3_2_DEVICE_ID   (0x0042)
2862306a36Sopenharmony_ci#define QCA99X0_2_0_DEVICE_ID   (0x0040)
2962306a36Sopenharmony_ci#define QCA9888_2_0_DEVICE_ID	(0x0056)
3062306a36Sopenharmony_ci#define QCA9984_1_0_DEVICE_ID	(0x0046)
3162306a36Sopenharmony_ci#define QCA9377_1_0_DEVICE_ID   (0x0042)
3262306a36Sopenharmony_ci#define QCA9887_1_0_DEVICE_ID   (0x0050)
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/* QCA988X 1.0 definitions (unsupported) */
3562306a36Sopenharmony_ci#define QCA988X_HW_1_0_CHIP_ID_REV	0x0
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* QCA988X 2.0 definitions */
3862306a36Sopenharmony_ci#define QCA988X_HW_2_0_VERSION		0x4100016c
3962306a36Sopenharmony_ci#define QCA988X_HW_2_0_CHIP_ID_REV	0x2
4062306a36Sopenharmony_ci#define QCA988X_HW_2_0_FW_DIR		ATH10K_FW_DIR "/QCA988X/hw2.0"
4162306a36Sopenharmony_ci#define QCA988X_HW_2_0_BOARD_DATA_FILE	"board.bin"
4262306a36Sopenharmony_ci#define QCA988X_HW_2_0_PATCH_LOAD_ADDR	0x1234
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/* QCA9887 1.0 definitions */
4562306a36Sopenharmony_ci#define QCA9887_HW_1_0_VERSION		0x4100016d
4662306a36Sopenharmony_ci#define QCA9887_HW_1_0_CHIP_ID_REV	0
4762306a36Sopenharmony_ci#define QCA9887_HW_1_0_FW_DIR		ATH10K_FW_DIR "/QCA9887/hw1.0"
4862306a36Sopenharmony_ci#define QCA9887_HW_1_0_BOARD_DATA_FILE	"board.bin"
4962306a36Sopenharmony_ci#define QCA9887_HW_1_0_PATCH_LOAD_ADDR	0x1234
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/* QCA6174 target BMI version signatures */
5262306a36Sopenharmony_ci#define QCA6174_HW_1_0_VERSION		0x05000000
5362306a36Sopenharmony_ci#define QCA6174_HW_1_1_VERSION		0x05000001
5462306a36Sopenharmony_ci#define QCA6174_HW_1_3_VERSION		0x05000003
5562306a36Sopenharmony_ci#define QCA6174_HW_2_1_VERSION		0x05010000
5662306a36Sopenharmony_ci#define QCA6174_HW_3_0_VERSION		0x05020000
5762306a36Sopenharmony_ci#define QCA6174_HW_3_2_VERSION		0x05030000
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/* QCA9377 target BMI version signatures */
6062306a36Sopenharmony_ci#define QCA9377_HW_1_0_DEV_VERSION	0x05020000
6162306a36Sopenharmony_ci#define QCA9377_HW_1_1_DEV_VERSION	0x05020001
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_cienum qca6174_pci_rev {
6462306a36Sopenharmony_ci	QCA6174_PCI_REV_1_1 = 0x11,
6562306a36Sopenharmony_ci	QCA6174_PCI_REV_1_3 = 0x13,
6662306a36Sopenharmony_ci	QCA6174_PCI_REV_2_0 = 0x20,
6762306a36Sopenharmony_ci	QCA6174_PCI_REV_3_0 = 0x30,
6862306a36Sopenharmony_ci};
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_cienum qca6174_chip_id_rev {
7162306a36Sopenharmony_ci	QCA6174_HW_1_0_CHIP_ID_REV = 0,
7262306a36Sopenharmony_ci	QCA6174_HW_1_1_CHIP_ID_REV = 1,
7362306a36Sopenharmony_ci	QCA6174_HW_1_3_CHIP_ID_REV = 2,
7462306a36Sopenharmony_ci	QCA6174_HW_2_1_CHIP_ID_REV = 4,
7562306a36Sopenharmony_ci	QCA6174_HW_2_2_CHIP_ID_REV = 5,
7662306a36Sopenharmony_ci	QCA6174_HW_3_0_CHIP_ID_REV = 8,
7762306a36Sopenharmony_ci	QCA6174_HW_3_1_CHIP_ID_REV = 9,
7862306a36Sopenharmony_ci	QCA6174_HW_3_2_CHIP_ID_REV = 10,
7962306a36Sopenharmony_ci};
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_cienum qca9377_chip_id_rev {
8262306a36Sopenharmony_ci	QCA9377_HW_1_0_CHIP_ID_REV = 0x0,
8362306a36Sopenharmony_ci	QCA9377_HW_1_1_CHIP_ID_REV = 0x1,
8462306a36Sopenharmony_ci};
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci#define QCA6174_HW_2_1_FW_DIR		ATH10K_FW_DIR "/QCA6174/hw2.1"
8762306a36Sopenharmony_ci#define QCA6174_HW_2_1_BOARD_DATA_FILE	"board.bin"
8862306a36Sopenharmony_ci#define QCA6174_HW_2_1_PATCH_LOAD_ADDR	0x1234
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci#define QCA6174_HW_3_0_FW_DIR		ATH10K_FW_DIR "/QCA6174/hw3.0"
9162306a36Sopenharmony_ci#define QCA6174_HW_3_0_BOARD_DATA_FILE	"board.bin"
9262306a36Sopenharmony_ci#define QCA6174_HW_3_0_PATCH_LOAD_ADDR	0x1234
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci/* QCA99X0 1.0 definitions (unsupported) */
9562306a36Sopenharmony_ci#define QCA99X0_HW_1_0_CHIP_ID_REV     0x0
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/* QCA99X0 2.0 definitions */
9862306a36Sopenharmony_ci#define QCA99X0_HW_2_0_DEV_VERSION     0x01000000
9962306a36Sopenharmony_ci#define QCA99X0_HW_2_0_CHIP_ID_REV     0x1
10062306a36Sopenharmony_ci#define QCA99X0_HW_2_0_FW_DIR          ATH10K_FW_DIR "/QCA99X0/hw2.0"
10162306a36Sopenharmony_ci#define QCA99X0_HW_2_0_BOARD_DATA_FILE "board.bin"
10262306a36Sopenharmony_ci#define QCA99X0_HW_2_0_PATCH_LOAD_ADDR	0x1234
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci/* QCA9984 1.0 defines */
10562306a36Sopenharmony_ci#define QCA9984_HW_1_0_DEV_VERSION	0x1000000
10662306a36Sopenharmony_ci#define QCA9984_HW_DEV_TYPE		0xa
10762306a36Sopenharmony_ci#define QCA9984_HW_1_0_CHIP_ID_REV	0x0
10862306a36Sopenharmony_ci#define QCA9984_HW_1_0_FW_DIR		ATH10K_FW_DIR "/QCA9984/hw1.0"
10962306a36Sopenharmony_ci#define QCA9984_HW_1_0_BOARD_DATA_FILE "board.bin"
11062306a36Sopenharmony_ci#define QCA9984_HW_1_0_EBOARD_DATA_FILE "eboard.bin"
11162306a36Sopenharmony_ci#define QCA9984_HW_1_0_PATCH_LOAD_ADDR	0x1234
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci/* QCA9888 2.0 defines */
11462306a36Sopenharmony_ci#define QCA9888_HW_2_0_DEV_VERSION	0x1000000
11562306a36Sopenharmony_ci#define QCA9888_HW_DEV_TYPE		0xc
11662306a36Sopenharmony_ci#define QCA9888_HW_2_0_CHIP_ID_REV	0x0
11762306a36Sopenharmony_ci#define QCA9888_HW_2_0_FW_DIR		ATH10K_FW_DIR "/QCA9888/hw2.0"
11862306a36Sopenharmony_ci#define QCA9888_HW_2_0_BOARD_DATA_FILE "board.bin"
11962306a36Sopenharmony_ci#define QCA9888_HW_2_0_PATCH_LOAD_ADDR	0x1234
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci/* QCA9377 1.0 definitions */
12262306a36Sopenharmony_ci#define QCA9377_HW_1_0_FW_DIR          ATH10K_FW_DIR "/QCA9377/hw1.0"
12362306a36Sopenharmony_ci#define QCA9377_HW_1_0_BOARD_DATA_FILE "board.bin"
12462306a36Sopenharmony_ci#define QCA9377_HW_1_0_PATCH_LOAD_ADDR	0x1234
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci/* QCA4019 1.0 definitions */
12762306a36Sopenharmony_ci#define QCA4019_HW_1_0_DEV_VERSION     0x01000000
12862306a36Sopenharmony_ci#define QCA4019_HW_1_0_FW_DIR          ATH10K_FW_DIR "/QCA4019/hw1.0"
12962306a36Sopenharmony_ci#define QCA4019_HW_1_0_BOARD_DATA_FILE "board.bin"
13062306a36Sopenharmony_ci#define QCA4019_HW_1_0_PATCH_LOAD_ADDR  0x1234
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci/* WCN3990 1.0 definitions */
13362306a36Sopenharmony_ci#define WCN3990_HW_1_0_DEV_VERSION	ATH10K_HW_WCN3990
13462306a36Sopenharmony_ci#define WCN3990_HW_1_0_FW_DIR		ATH10K_FW_DIR "/WCN3990/hw1.0"
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci#define ATH10K_FW_FILE_BASE		"firmware"
13762306a36Sopenharmony_ci#define ATH10K_FW_API_MAX		6
13862306a36Sopenharmony_ci#define ATH10K_FW_API_MIN		2
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#define ATH10K_FW_API2_FILE		"firmware-2.bin"
14162306a36Sopenharmony_ci#define ATH10K_FW_API3_FILE		"firmware-3.bin"
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci/* added support for ATH10K_FW_IE_WMI_OP_VERSION */
14462306a36Sopenharmony_ci#define ATH10K_FW_API4_FILE		"firmware-4.bin"
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci/* HTT id conflict fix for management frames over HTT */
14762306a36Sopenharmony_ci#define ATH10K_FW_API5_FILE		"firmware-5.bin"
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci/* the firmware-6.bin blob */
15062306a36Sopenharmony_ci#define ATH10K_FW_API6_FILE		"firmware-6.bin"
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci#define ATH10K_FW_UTF_FILE		"utf.bin"
15362306a36Sopenharmony_ci#define ATH10K_FW_UTF_API2_FILE		"utf-2.bin"
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci#define ATH10K_FW_UTF_FILE_BASE		"utf"
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci/* includes also the null byte */
15862306a36Sopenharmony_ci#define ATH10K_FIRMWARE_MAGIC               "QCA-ATH10K"
15962306a36Sopenharmony_ci#define ATH10K_BOARD_MAGIC                  "QCA-ATH10K-BOARD"
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci#define ATH10K_BOARD_API2_FILE         "board-2.bin"
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci#define REG_DUMP_COUNT_QCA988X 60
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_cistruct ath10k_fw_ie {
16662306a36Sopenharmony_ci	__le32 id;
16762306a36Sopenharmony_ci	__le32 len;
16862306a36Sopenharmony_ci	u8 data[];
16962306a36Sopenharmony_ci};
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_cienum ath10k_fw_ie_type {
17262306a36Sopenharmony_ci	ATH10K_FW_IE_FW_VERSION = 0,
17362306a36Sopenharmony_ci	ATH10K_FW_IE_TIMESTAMP = 1,
17462306a36Sopenharmony_ci	ATH10K_FW_IE_FEATURES = 2,
17562306a36Sopenharmony_ci	ATH10K_FW_IE_FW_IMAGE = 3,
17662306a36Sopenharmony_ci	ATH10K_FW_IE_OTP_IMAGE = 4,
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci	/* WMI "operations" interface version, 32 bit value. Supported from
17962306a36Sopenharmony_ci	 * FW API 4 and above.
18062306a36Sopenharmony_ci	 */
18162306a36Sopenharmony_ci	ATH10K_FW_IE_WMI_OP_VERSION = 5,
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci	/* HTT "operations" interface version, 32 bit value. Supported from
18462306a36Sopenharmony_ci	 * FW API 5 and above.
18562306a36Sopenharmony_ci	 */
18662306a36Sopenharmony_ci	ATH10K_FW_IE_HTT_OP_VERSION = 6,
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci	/* Code swap image for firmware binary */
18962306a36Sopenharmony_ci	ATH10K_FW_IE_FW_CODE_SWAP_IMAGE = 7,
19062306a36Sopenharmony_ci};
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_cienum ath10k_fw_wmi_op_version {
19362306a36Sopenharmony_ci	ATH10K_FW_WMI_OP_VERSION_UNSET = 0,
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ci	ATH10K_FW_WMI_OP_VERSION_MAIN = 1,
19662306a36Sopenharmony_ci	ATH10K_FW_WMI_OP_VERSION_10_1 = 2,
19762306a36Sopenharmony_ci	ATH10K_FW_WMI_OP_VERSION_10_2 = 3,
19862306a36Sopenharmony_ci	ATH10K_FW_WMI_OP_VERSION_TLV = 4,
19962306a36Sopenharmony_ci	ATH10K_FW_WMI_OP_VERSION_10_2_4 = 5,
20062306a36Sopenharmony_ci	ATH10K_FW_WMI_OP_VERSION_10_4 = 6,
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci	/* keep last */
20362306a36Sopenharmony_ci	ATH10K_FW_WMI_OP_VERSION_MAX,
20462306a36Sopenharmony_ci};
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_cienum ath10k_fw_htt_op_version {
20762306a36Sopenharmony_ci	ATH10K_FW_HTT_OP_VERSION_UNSET = 0,
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci	ATH10K_FW_HTT_OP_VERSION_MAIN = 1,
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci	/* also used in 10.2 and 10.2.4 branches */
21262306a36Sopenharmony_ci	ATH10K_FW_HTT_OP_VERSION_10_1 = 2,
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci	ATH10K_FW_HTT_OP_VERSION_TLV = 3,
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci	ATH10K_FW_HTT_OP_VERSION_10_4 = 4,
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci	/* keep last */
21962306a36Sopenharmony_ci	ATH10K_FW_HTT_OP_VERSION_MAX,
22062306a36Sopenharmony_ci};
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_cienum ath10k_bd_ie_type {
22362306a36Sopenharmony_ci	/* contains sub IEs of enum ath10k_bd_ie_board_type */
22462306a36Sopenharmony_ci	ATH10K_BD_IE_BOARD = 0,
22562306a36Sopenharmony_ci	ATH10K_BD_IE_BOARD_EXT = 1,
22662306a36Sopenharmony_ci};
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_cienum ath10k_bd_ie_board_type {
22962306a36Sopenharmony_ci	ATH10K_BD_IE_BOARD_NAME = 0,
23062306a36Sopenharmony_ci	ATH10K_BD_IE_BOARD_DATA = 1,
23162306a36Sopenharmony_ci};
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_cienum ath10k_hw_rev {
23462306a36Sopenharmony_ci	ATH10K_HW_QCA988X,
23562306a36Sopenharmony_ci	ATH10K_HW_QCA6174,
23662306a36Sopenharmony_ci	ATH10K_HW_QCA99X0,
23762306a36Sopenharmony_ci	ATH10K_HW_QCA9888,
23862306a36Sopenharmony_ci	ATH10K_HW_QCA9984,
23962306a36Sopenharmony_ci	ATH10K_HW_QCA9377,
24062306a36Sopenharmony_ci	ATH10K_HW_QCA4019,
24162306a36Sopenharmony_ci	ATH10K_HW_QCA9887,
24262306a36Sopenharmony_ci	ATH10K_HW_WCN3990,
24362306a36Sopenharmony_ci};
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_cistruct ath10k_hw_regs {
24662306a36Sopenharmony_ci	u32 rtc_soc_base_address;
24762306a36Sopenharmony_ci	u32 rtc_wmac_base_address;
24862306a36Sopenharmony_ci	u32 soc_core_base_address;
24962306a36Sopenharmony_ci	u32 wlan_mac_base_address;
25062306a36Sopenharmony_ci	u32 ce_wrapper_base_address;
25162306a36Sopenharmony_ci	u32 ce0_base_address;
25262306a36Sopenharmony_ci	u32 ce1_base_address;
25362306a36Sopenharmony_ci	u32 ce2_base_address;
25462306a36Sopenharmony_ci	u32 ce3_base_address;
25562306a36Sopenharmony_ci	u32 ce4_base_address;
25662306a36Sopenharmony_ci	u32 ce5_base_address;
25762306a36Sopenharmony_ci	u32 ce6_base_address;
25862306a36Sopenharmony_ci	u32 ce7_base_address;
25962306a36Sopenharmony_ci	u32 ce8_base_address;
26062306a36Sopenharmony_ci	u32 ce9_base_address;
26162306a36Sopenharmony_ci	u32 ce10_base_address;
26262306a36Sopenharmony_ci	u32 ce11_base_address;
26362306a36Sopenharmony_ci	u32 soc_reset_control_si0_rst_mask;
26462306a36Sopenharmony_ci	u32 soc_reset_control_ce_rst_mask;
26562306a36Sopenharmony_ci	u32 soc_chip_id_address;
26662306a36Sopenharmony_ci	u32 scratch_3_address;
26762306a36Sopenharmony_ci	u32 fw_indicator_address;
26862306a36Sopenharmony_ci	u32 pcie_local_base_address;
26962306a36Sopenharmony_ci	u32 ce_wrap_intr_sum_host_msi_lsb;
27062306a36Sopenharmony_ci	u32 ce_wrap_intr_sum_host_msi_mask;
27162306a36Sopenharmony_ci	u32 pcie_intr_fw_mask;
27262306a36Sopenharmony_ci	u32 pcie_intr_ce_mask_all;
27362306a36Sopenharmony_ci	u32 pcie_intr_clr_address;
27462306a36Sopenharmony_ci	u32 cpu_pll_init_address;
27562306a36Sopenharmony_ci	u32 cpu_speed_address;
27662306a36Sopenharmony_ci	u32 core_clk_div_address;
27762306a36Sopenharmony_ci};
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ciextern const struct ath10k_hw_regs qca988x_regs;
28062306a36Sopenharmony_ciextern const struct ath10k_hw_regs qca6174_regs;
28162306a36Sopenharmony_ciextern const struct ath10k_hw_regs qca99x0_regs;
28262306a36Sopenharmony_ciextern const struct ath10k_hw_regs qca4019_regs;
28362306a36Sopenharmony_ciextern const struct ath10k_hw_regs wcn3990_regs;
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_cistruct ath10k_hw_ce_regs_addr_map {
28662306a36Sopenharmony_ci	u32 msb;
28762306a36Sopenharmony_ci	u32 lsb;
28862306a36Sopenharmony_ci	u32 mask;
28962306a36Sopenharmony_ci};
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_cistruct ath10k_hw_ce_ctrl1 {
29262306a36Sopenharmony_ci	u32 addr;
29362306a36Sopenharmony_ci	u32 hw_mask;
29462306a36Sopenharmony_ci	u32 sw_mask;
29562306a36Sopenharmony_ci	u32 hw_wr_mask;
29662306a36Sopenharmony_ci	u32 sw_wr_mask;
29762306a36Sopenharmony_ci	u32 reset_mask;
29862306a36Sopenharmony_ci	u32 reset;
29962306a36Sopenharmony_ci	struct ath10k_hw_ce_regs_addr_map *src_ring;
30062306a36Sopenharmony_ci	struct ath10k_hw_ce_regs_addr_map *dst_ring;
30162306a36Sopenharmony_ci	struct ath10k_hw_ce_regs_addr_map *dmax; };
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_cistruct ath10k_hw_ce_cmd_halt {
30462306a36Sopenharmony_ci	u32 status_reset;
30562306a36Sopenharmony_ci	u32 msb;
30662306a36Sopenharmony_ci	u32 mask;
30762306a36Sopenharmony_ci	struct ath10k_hw_ce_regs_addr_map *status; };
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_cistruct ath10k_hw_ce_host_ie {
31062306a36Sopenharmony_ci	u32 copy_complete_reset;
31162306a36Sopenharmony_ci	struct ath10k_hw_ce_regs_addr_map *copy_complete; };
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_cistruct ath10k_hw_ce_host_wm_regs {
31462306a36Sopenharmony_ci	u32 dstr_lmask;
31562306a36Sopenharmony_ci	u32 dstr_hmask;
31662306a36Sopenharmony_ci	u32 srcr_lmask;
31762306a36Sopenharmony_ci	u32 srcr_hmask;
31862306a36Sopenharmony_ci	u32 cc_mask;
31962306a36Sopenharmony_ci	u32 wm_mask;
32062306a36Sopenharmony_ci	u32 addr;
32162306a36Sopenharmony_ci};
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_cistruct ath10k_hw_ce_misc_regs {
32462306a36Sopenharmony_ci	u32 axi_err;
32562306a36Sopenharmony_ci	u32 dstr_add_err;
32662306a36Sopenharmony_ci	u32 srcr_len_err;
32762306a36Sopenharmony_ci	u32 dstr_mlen_vio;
32862306a36Sopenharmony_ci	u32 dstr_overflow;
32962306a36Sopenharmony_ci	u32 srcr_overflow;
33062306a36Sopenharmony_ci	u32 err_mask;
33162306a36Sopenharmony_ci	u32 addr;
33262306a36Sopenharmony_ci};
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_cistruct ath10k_hw_ce_dst_src_wm_regs {
33562306a36Sopenharmony_ci	u32 addr;
33662306a36Sopenharmony_ci	u32 low_rst;
33762306a36Sopenharmony_ci	u32 high_rst;
33862306a36Sopenharmony_ci	struct ath10k_hw_ce_regs_addr_map *wm_low;
33962306a36Sopenharmony_ci	struct ath10k_hw_ce_regs_addr_map *wm_high; };
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_cistruct ath10k_hw_ce_ctrl1_upd {
34262306a36Sopenharmony_ci	u32 shift;
34362306a36Sopenharmony_ci	u32 mask;
34462306a36Sopenharmony_ci	u32 enable;
34562306a36Sopenharmony_ci};
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_cistruct ath10k_hw_ce_regs {
34862306a36Sopenharmony_ci	u32 sr_base_addr_lo;
34962306a36Sopenharmony_ci	u32 sr_base_addr_hi;
35062306a36Sopenharmony_ci	u32 sr_size_addr;
35162306a36Sopenharmony_ci	u32 dr_base_addr_lo;
35262306a36Sopenharmony_ci	u32 dr_base_addr_hi;
35362306a36Sopenharmony_ci	u32 dr_size_addr;
35462306a36Sopenharmony_ci	u32 ce_cmd_addr;
35562306a36Sopenharmony_ci	u32 misc_ie_addr;
35662306a36Sopenharmony_ci	u32 sr_wr_index_addr;
35762306a36Sopenharmony_ci	u32 dst_wr_index_addr;
35862306a36Sopenharmony_ci	u32 current_srri_addr;
35962306a36Sopenharmony_ci	u32 current_drri_addr;
36062306a36Sopenharmony_ci	u32 ddr_addr_for_rri_low;
36162306a36Sopenharmony_ci	u32 ddr_addr_for_rri_high;
36262306a36Sopenharmony_ci	u32 ce_rri_low;
36362306a36Sopenharmony_ci	u32 ce_rri_high;
36462306a36Sopenharmony_ci	u32 host_ie_addr;
36562306a36Sopenharmony_ci	struct ath10k_hw_ce_host_wm_regs *wm_regs;
36662306a36Sopenharmony_ci	struct ath10k_hw_ce_misc_regs *misc_regs;
36762306a36Sopenharmony_ci	struct ath10k_hw_ce_ctrl1 *ctrl1_regs;
36862306a36Sopenharmony_ci	struct ath10k_hw_ce_cmd_halt *cmd_halt;
36962306a36Sopenharmony_ci	struct ath10k_hw_ce_host_ie *host_ie;
37062306a36Sopenharmony_ci	struct ath10k_hw_ce_dst_src_wm_regs *wm_srcr;
37162306a36Sopenharmony_ci	struct ath10k_hw_ce_dst_src_wm_regs *wm_dstr;
37262306a36Sopenharmony_ci	struct ath10k_hw_ce_ctrl1_upd *upd;
37362306a36Sopenharmony_ci};
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_cistruct ath10k_hw_values {
37662306a36Sopenharmony_ci	u32 rtc_state_val_on;
37762306a36Sopenharmony_ci	u8 ce_count;
37862306a36Sopenharmony_ci	u8 msi_assign_ce_max;
37962306a36Sopenharmony_ci	u8 num_target_ce_config_wlan;
38062306a36Sopenharmony_ci	u16 ce_desc_meta_data_mask;
38162306a36Sopenharmony_ci	u8 ce_desc_meta_data_lsb;
38262306a36Sopenharmony_ci	u32 rfkill_pin;
38362306a36Sopenharmony_ci	u32 rfkill_cfg;
38462306a36Sopenharmony_ci	bool rfkill_on_level;
38562306a36Sopenharmony_ci};
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_ciextern const struct ath10k_hw_values qca988x_values;
38862306a36Sopenharmony_ciextern const struct ath10k_hw_values qca6174_values;
38962306a36Sopenharmony_ciextern const struct ath10k_hw_values qca99x0_values;
39062306a36Sopenharmony_ciextern const struct ath10k_hw_values qca9888_values;
39162306a36Sopenharmony_ciextern const struct ath10k_hw_values qca4019_values;
39262306a36Sopenharmony_ciextern const struct ath10k_hw_values wcn3990_values;
39362306a36Sopenharmony_ciextern const struct ath10k_hw_ce_regs wcn3990_ce_regs;
39462306a36Sopenharmony_ciextern const struct ath10k_hw_ce_regs qcax_ce_regs;
39562306a36Sopenharmony_ci
39662306a36Sopenharmony_civoid ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
39762306a36Sopenharmony_ci				u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev);
39862306a36Sopenharmony_ci
39962306a36Sopenharmony_ciint ath10k_hw_diag_fast_download(struct ath10k *ar,
40062306a36Sopenharmony_ci				 u32 address,
40162306a36Sopenharmony_ci				 const void *buffer,
40262306a36Sopenharmony_ci				 u32 length);
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ci#define QCA_REV_988X(ar) ((ar)->hw_rev == ATH10K_HW_QCA988X)
40562306a36Sopenharmony_ci#define QCA_REV_9887(ar) ((ar)->hw_rev == ATH10K_HW_QCA9887)
40662306a36Sopenharmony_ci#define QCA_REV_6174(ar) ((ar)->hw_rev == ATH10K_HW_QCA6174)
40762306a36Sopenharmony_ci#define QCA_REV_99X0(ar) ((ar)->hw_rev == ATH10K_HW_QCA99X0)
40862306a36Sopenharmony_ci#define QCA_REV_9888(ar) ((ar)->hw_rev == ATH10K_HW_QCA9888)
40962306a36Sopenharmony_ci#define QCA_REV_9984(ar) ((ar)->hw_rev == ATH10K_HW_QCA9984)
41062306a36Sopenharmony_ci#define QCA_REV_9377(ar) ((ar)->hw_rev == ATH10K_HW_QCA9377)
41162306a36Sopenharmony_ci#define QCA_REV_40XX(ar) ((ar)->hw_rev == ATH10K_HW_QCA4019)
41262306a36Sopenharmony_ci#define QCA_REV_WCN3990(ar) ((ar)->hw_rev == ATH10K_HW_WCN3990)
41362306a36Sopenharmony_ci
41462306a36Sopenharmony_ci/* Known peculiarities:
41562306a36Sopenharmony_ci *  - raw appears in nwifi decap, raw and nwifi appear in ethernet decap
41662306a36Sopenharmony_ci *  - raw have FCS, nwifi doesn't
41762306a36Sopenharmony_ci *  - ethernet frames have 802.11 header decapped and parts (base hdr, cipher
41862306a36Sopenharmony_ci *    param, llc/snap) are aligned to 4byte boundaries each
41962306a36Sopenharmony_ci */
42062306a36Sopenharmony_cienum ath10k_hw_txrx_mode {
42162306a36Sopenharmony_ci	ATH10K_HW_TXRX_RAW = 0,
42262306a36Sopenharmony_ci
42362306a36Sopenharmony_ci	/* Native Wifi decap mode is used to align IP frames to 4-byte
42462306a36Sopenharmony_ci	 * boundaries and avoid a very expensive re-alignment in mac80211.
42562306a36Sopenharmony_ci	 */
42662306a36Sopenharmony_ci	ATH10K_HW_TXRX_NATIVE_WIFI = 1,
42762306a36Sopenharmony_ci	ATH10K_HW_TXRX_ETHERNET = 2,
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_ci	/* Valid for HTT >= 3.0. Used for management frames in TX_FRM. */
43062306a36Sopenharmony_ci	ATH10K_HW_TXRX_MGMT = 3,
43162306a36Sopenharmony_ci};
43262306a36Sopenharmony_ci
43362306a36Sopenharmony_cienum ath10k_mcast2ucast_mode {
43462306a36Sopenharmony_ci	ATH10K_MCAST2UCAST_DISABLED = 0,
43562306a36Sopenharmony_ci	ATH10K_MCAST2UCAST_ENABLED = 1,
43662306a36Sopenharmony_ci};
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_cienum ath10k_hw_rate_ofdm {
43962306a36Sopenharmony_ci	ATH10K_HW_RATE_OFDM_48M = 0,
44062306a36Sopenharmony_ci	ATH10K_HW_RATE_OFDM_24M,
44162306a36Sopenharmony_ci	ATH10K_HW_RATE_OFDM_12M,
44262306a36Sopenharmony_ci	ATH10K_HW_RATE_OFDM_6M,
44362306a36Sopenharmony_ci	ATH10K_HW_RATE_OFDM_54M,
44462306a36Sopenharmony_ci	ATH10K_HW_RATE_OFDM_36M,
44562306a36Sopenharmony_ci	ATH10K_HW_RATE_OFDM_18M,
44662306a36Sopenharmony_ci	ATH10K_HW_RATE_OFDM_9M,
44762306a36Sopenharmony_ci};
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_cienum ath10k_hw_rate_cck {
45062306a36Sopenharmony_ci	ATH10K_HW_RATE_CCK_LP_11M = 0,
45162306a36Sopenharmony_ci	ATH10K_HW_RATE_CCK_LP_5_5M,
45262306a36Sopenharmony_ci	ATH10K_HW_RATE_CCK_LP_2M,
45362306a36Sopenharmony_ci	ATH10K_HW_RATE_CCK_LP_1M,
45462306a36Sopenharmony_ci	ATH10K_HW_RATE_CCK_SP_11M,
45562306a36Sopenharmony_ci	ATH10K_HW_RATE_CCK_SP_5_5M,
45662306a36Sopenharmony_ci	ATH10K_HW_RATE_CCK_SP_2M,
45762306a36Sopenharmony_ci};
45862306a36Sopenharmony_ci
45962306a36Sopenharmony_cienum ath10k_hw_rate_rev2_cck {
46062306a36Sopenharmony_ci	ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
46162306a36Sopenharmony_ci	ATH10K_HW_RATE_REV2_CCK_LP_2M,
46262306a36Sopenharmony_ci	ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
46362306a36Sopenharmony_ci	ATH10K_HW_RATE_REV2_CCK_LP_11M,
46462306a36Sopenharmony_ci	ATH10K_HW_RATE_REV2_CCK_SP_2M,
46562306a36Sopenharmony_ci	ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
46662306a36Sopenharmony_ci	ATH10K_HW_RATE_REV2_CCK_SP_11M,
46762306a36Sopenharmony_ci};
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_cienum ath10k_hw_cc_wraparound_type {
47062306a36Sopenharmony_ci	ATH10K_HW_CC_WRAP_DISABLED = 0,
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_ci	/* This type is when the HW chip has a quirky Cycle Counter
47362306a36Sopenharmony_ci	 * wraparound which resets to 0x7fffffff instead of 0. All
47462306a36Sopenharmony_ci	 * other CC related counters (e.g. Rx Clear Count) are divided
47562306a36Sopenharmony_ci	 * by 2 so they never wraparound themselves.
47662306a36Sopenharmony_ci	 */
47762306a36Sopenharmony_ci	ATH10K_HW_CC_WRAP_SHIFTED_ALL = 1,
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_ci	/* Each hw counter wrapsaround independently. When the
48062306a36Sopenharmony_ci	 * counter overflows the repestive counter is right shifted
48162306a36Sopenharmony_ci	 * by 1, i.e reset to 0x7fffffff, and other counters will be
48262306a36Sopenharmony_ci	 * running unaffected. In this type of wraparound, it should
48362306a36Sopenharmony_ci	 * be possible to report accurate Rx busy time unlike the
48462306a36Sopenharmony_ci	 * first type.
48562306a36Sopenharmony_ci	 */
48662306a36Sopenharmony_ci	ATH10K_HW_CC_WRAP_SHIFTED_EACH = 2,
48762306a36Sopenharmony_ci};
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_cienum ath10k_hw_refclk_speed {
49062306a36Sopenharmony_ci	ATH10K_HW_REFCLK_UNKNOWN = -1,
49162306a36Sopenharmony_ci	ATH10K_HW_REFCLK_48_MHZ = 0,
49262306a36Sopenharmony_ci	ATH10K_HW_REFCLK_19_2_MHZ = 1,
49362306a36Sopenharmony_ci	ATH10K_HW_REFCLK_24_MHZ = 2,
49462306a36Sopenharmony_ci	ATH10K_HW_REFCLK_26_MHZ = 3,
49562306a36Sopenharmony_ci	ATH10K_HW_REFCLK_37_4_MHZ = 4,
49662306a36Sopenharmony_ci	ATH10K_HW_REFCLK_38_4_MHZ = 5,
49762306a36Sopenharmony_ci	ATH10K_HW_REFCLK_40_MHZ = 6,
49862306a36Sopenharmony_ci	ATH10K_HW_REFCLK_52_MHZ = 7,
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_ci	/* must be the last one */
50162306a36Sopenharmony_ci	ATH10K_HW_REFCLK_COUNT,
50262306a36Sopenharmony_ci};
50362306a36Sopenharmony_ci
50462306a36Sopenharmony_cistruct ath10k_hw_clk_params {
50562306a36Sopenharmony_ci	u32 refclk;
50662306a36Sopenharmony_ci	u32 div;
50762306a36Sopenharmony_ci	u32 rnfrac;
50862306a36Sopenharmony_ci	u32 settle_time;
50962306a36Sopenharmony_ci	u32 refdiv;
51062306a36Sopenharmony_ci	u32 outdiv;
51162306a36Sopenharmony_ci};
51262306a36Sopenharmony_ci
51362306a36Sopenharmony_cistruct htt_rx_desc_ops;
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_cistruct ath10k_hw_params {
51662306a36Sopenharmony_ci	u32 id;
51762306a36Sopenharmony_ci	u16 dev_id;
51862306a36Sopenharmony_ci	enum ath10k_bus bus;
51962306a36Sopenharmony_ci	const char *name;
52062306a36Sopenharmony_ci	u32 patch_load_addr;
52162306a36Sopenharmony_ci	int uart_pin;
52262306a36Sopenharmony_ci	u32 otp_exe_param;
52362306a36Sopenharmony_ci
52462306a36Sopenharmony_ci	/* Type of hw cycle counter wraparound logic, for more info
52562306a36Sopenharmony_ci	 * refer enum ath10k_hw_cc_wraparound_type.
52662306a36Sopenharmony_ci	 */
52762306a36Sopenharmony_ci	enum ath10k_hw_cc_wraparound_type cc_wraparound_type;
52862306a36Sopenharmony_ci
52962306a36Sopenharmony_ci	/* Some of chip expects fragment descriptor to be continuous
53062306a36Sopenharmony_ci	 * memory for any TX operation. Set continuous_frag_desc flag
53162306a36Sopenharmony_ci	 * for the hardware which have such requirement.
53262306a36Sopenharmony_ci	 */
53362306a36Sopenharmony_ci	bool continuous_frag_desc;
53462306a36Sopenharmony_ci
53562306a36Sopenharmony_ci	/* CCK hardware rate table mapping for the newer chipsets
53662306a36Sopenharmony_ci	 * like QCA99X0, QCA4019 got revised. The CCK h/w rate values
53762306a36Sopenharmony_ci	 * are in a proper order with respect to the rate/preamble
53862306a36Sopenharmony_ci	 */
53962306a36Sopenharmony_ci	bool cck_rate_map_rev2;
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_ci	u32 channel_counters_freq_hz;
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_ci	/* Mgmt tx descriptors threshold for limiting probe response
54462306a36Sopenharmony_ci	 * frames.
54562306a36Sopenharmony_ci	 */
54662306a36Sopenharmony_ci	u32 max_probe_resp_desc_thres;
54762306a36Sopenharmony_ci
54862306a36Sopenharmony_ci	u32 tx_chain_mask;
54962306a36Sopenharmony_ci	u32 rx_chain_mask;
55062306a36Sopenharmony_ci	u32 max_spatial_stream;
55162306a36Sopenharmony_ci	u32 cal_data_len;
55262306a36Sopenharmony_ci
55362306a36Sopenharmony_ci	struct ath10k_hw_params_fw {
55462306a36Sopenharmony_ci		const char *dir;
55562306a36Sopenharmony_ci		const char *board;
55662306a36Sopenharmony_ci		size_t board_size;
55762306a36Sopenharmony_ci		const char *eboard;
55862306a36Sopenharmony_ci		size_t ext_board_size;
55962306a36Sopenharmony_ci		size_t board_ext_size;
56062306a36Sopenharmony_ci	} fw;
56162306a36Sopenharmony_ci
56262306a36Sopenharmony_ci	/* qca99x0 family chips deliver broadcast/multicast management
56362306a36Sopenharmony_ci	 * frames encrypted and expect software do decryption.
56462306a36Sopenharmony_ci	 */
56562306a36Sopenharmony_ci	bool sw_decrypt_mcast_mgmt;
56662306a36Sopenharmony_ci
56762306a36Sopenharmony_ci	/* Rx descriptor abstraction */
56862306a36Sopenharmony_ci	const struct ath10k_htt_rx_desc_ops *rx_desc_ops;
56962306a36Sopenharmony_ci
57062306a36Sopenharmony_ci	const struct ath10k_hw_ops *hw_ops;
57162306a36Sopenharmony_ci
57262306a36Sopenharmony_ci	/* Number of bytes used for alignment in rx_hdr_status of rx desc. */
57362306a36Sopenharmony_ci	int decap_align_bytes;
57462306a36Sopenharmony_ci
57562306a36Sopenharmony_ci	/* hw specific clock control parameters */
57662306a36Sopenharmony_ci	const struct ath10k_hw_clk_params *hw_clk;
57762306a36Sopenharmony_ci	int target_cpu_freq;
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ci	/* Number of bytes to be discarded for each FFT sample */
58062306a36Sopenharmony_ci	int spectral_bin_discard;
58162306a36Sopenharmony_ci
58262306a36Sopenharmony_ci	/* The board may have a restricted NSS for 160 or 80+80 vs what it
58362306a36Sopenharmony_ci	 * can do for 80Mhz.
58462306a36Sopenharmony_ci	 */
58562306a36Sopenharmony_ci	int vht160_mcs_rx_highest;
58662306a36Sopenharmony_ci	int vht160_mcs_tx_highest;
58762306a36Sopenharmony_ci
58862306a36Sopenharmony_ci	/* Number of ciphers supported (i.e First N) in cipher_suites array */
58962306a36Sopenharmony_ci	int n_cipher_suites;
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci	u32 num_peers;
59262306a36Sopenharmony_ci	u32 ast_skid_limit;
59362306a36Sopenharmony_ci	u32 num_wds_entries;
59462306a36Sopenharmony_ci
59562306a36Sopenharmony_ci	/* Targets supporting physical addressing capability above 32-bits */
59662306a36Sopenharmony_ci	bool target_64bit;
59762306a36Sopenharmony_ci
59862306a36Sopenharmony_ci	/* Target rx ring fill level */
59962306a36Sopenharmony_ci	u32 rx_ring_fill_level;
60062306a36Sopenharmony_ci
60162306a36Sopenharmony_ci	/* target supporting shadow register for ce write */
60262306a36Sopenharmony_ci	bool shadow_reg_support;
60362306a36Sopenharmony_ci
60462306a36Sopenharmony_ci	/* target supporting retention restore on ddr */
60562306a36Sopenharmony_ci	bool rri_on_ddr;
60662306a36Sopenharmony_ci
60762306a36Sopenharmony_ci	/* Number of bytes to be the offset for each FFT sample */
60862306a36Sopenharmony_ci	int spectral_bin_offset;
60962306a36Sopenharmony_ci
61062306a36Sopenharmony_ci	/* targets which require hw filter reset during boot up,
61162306a36Sopenharmony_ci	 * to avoid it sending spurious acks.
61262306a36Sopenharmony_ci	 */
61362306a36Sopenharmony_ci	bool hw_filter_reset_required;
61462306a36Sopenharmony_ci
61562306a36Sopenharmony_ci	/* target supporting fw download via diag ce */
61662306a36Sopenharmony_ci	bool fw_diag_ce_download;
61762306a36Sopenharmony_ci
61862306a36Sopenharmony_ci	/* target supporting fw download via large size BMI */
61962306a36Sopenharmony_ci	bool bmi_large_size_download;
62062306a36Sopenharmony_ci
62162306a36Sopenharmony_ci	/* need to set uart pin if disable uart print, workaround for a
62262306a36Sopenharmony_ci	 * firmware bug
62362306a36Sopenharmony_ci	 */
62462306a36Sopenharmony_ci	bool uart_pin_workaround;
62562306a36Sopenharmony_ci
62662306a36Sopenharmony_ci	/* Workaround for the credit size calculation */
62762306a36Sopenharmony_ci	bool credit_size_workaround;
62862306a36Sopenharmony_ci
62962306a36Sopenharmony_ci	/* tx stats support over pktlog */
63062306a36Sopenharmony_ci	bool tx_stats_over_pktlog;
63162306a36Sopenharmony_ci
63262306a36Sopenharmony_ci	/* provides bitrates for sta_statistics using WMI_TLV_PEER_STATS_INFO_EVENTID */
63362306a36Sopenharmony_ci	bool supports_peer_stats_info;
63462306a36Sopenharmony_ci
63562306a36Sopenharmony_ci	bool dynamic_sar_support;
63662306a36Sopenharmony_ci
63762306a36Sopenharmony_ci	bool hw_restart_disconnect;
63862306a36Sopenharmony_ci
63962306a36Sopenharmony_ci	bool use_fw_tx_credits;
64062306a36Sopenharmony_ci
64162306a36Sopenharmony_ci	bool delay_unmap_buffer;
64262306a36Sopenharmony_ci};
64362306a36Sopenharmony_ci
64462306a36Sopenharmony_cistruct htt_resp;
64562306a36Sopenharmony_cistruct htt_data_tx_completion_ext;
64662306a36Sopenharmony_cistruct htt_rx_ring_rx_desc_offsets;
64762306a36Sopenharmony_ci
64862306a36Sopenharmony_ci/* Defines needed for Rx descriptor abstraction */
64962306a36Sopenharmony_cistruct ath10k_hw_ops {
65062306a36Sopenharmony_ci	void (*set_coverage_class)(struct ath10k *ar, s16 value);
65162306a36Sopenharmony_ci	int (*enable_pll_clk)(struct ath10k *ar);
65262306a36Sopenharmony_ci	int (*tx_data_rssi_pad_bytes)(struct htt_resp *htt);
65362306a36Sopenharmony_ci	int (*is_rssi_enable)(struct htt_resp *resp);
65462306a36Sopenharmony_ci};
65562306a36Sopenharmony_ci
65662306a36Sopenharmony_ciextern const struct ath10k_hw_ops qca988x_ops;
65762306a36Sopenharmony_ciextern const struct ath10k_hw_ops qca99x0_ops;
65862306a36Sopenharmony_ciextern const struct ath10k_hw_ops qca6174_ops;
65962306a36Sopenharmony_ciextern const struct ath10k_hw_ops qca6174_sdio_ops;
66062306a36Sopenharmony_ciextern const struct ath10k_hw_ops wcn3990_ops;
66162306a36Sopenharmony_ci
66262306a36Sopenharmony_ciextern const struct ath10k_hw_clk_params qca6174_clk[];
66362306a36Sopenharmony_ci
66462306a36Sopenharmony_cistatic inline int
66562306a36Sopenharmony_ciath10k_tx_data_rssi_get_pad_bytes(struct ath10k_hw_params *hw,
66662306a36Sopenharmony_ci				  struct htt_resp *htt)
66762306a36Sopenharmony_ci{
66862306a36Sopenharmony_ci	if (hw->hw_ops->tx_data_rssi_pad_bytes)
66962306a36Sopenharmony_ci		return hw->hw_ops->tx_data_rssi_pad_bytes(htt);
67062306a36Sopenharmony_ci	return 0;
67162306a36Sopenharmony_ci}
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_cistatic inline int
67462306a36Sopenharmony_ciath10k_is_rssi_enable(struct ath10k_hw_params *hw,
67562306a36Sopenharmony_ci		      struct htt_resp *resp)
67662306a36Sopenharmony_ci{
67762306a36Sopenharmony_ci	if (hw->hw_ops->is_rssi_enable)
67862306a36Sopenharmony_ci		return hw->hw_ops->is_rssi_enable(resp);
67962306a36Sopenharmony_ci	return 0;
68062306a36Sopenharmony_ci}
68162306a36Sopenharmony_ci
68262306a36Sopenharmony_ci/* Target specific defines for MAIN firmware */
68362306a36Sopenharmony_ci#define TARGET_NUM_VDEVS			8
68462306a36Sopenharmony_ci#define TARGET_NUM_PEER_AST			2
68562306a36Sopenharmony_ci#define TARGET_NUM_WDS_ENTRIES			32
68662306a36Sopenharmony_ci#define TARGET_DMA_BURST_SIZE			0
68762306a36Sopenharmony_ci#define TARGET_MAC_AGGR_DELIM			0
68862306a36Sopenharmony_ci#define TARGET_AST_SKID_LIMIT			16
68962306a36Sopenharmony_ci#define TARGET_NUM_STATIONS			16
69062306a36Sopenharmony_ci#define TARGET_NUM_PEERS			((TARGET_NUM_STATIONS) + \
69162306a36Sopenharmony_ci						 (TARGET_NUM_VDEVS))
69262306a36Sopenharmony_ci#define TARGET_NUM_OFFLOAD_PEERS		0
69362306a36Sopenharmony_ci#define TARGET_NUM_OFFLOAD_REORDER_BUFS         0
69462306a36Sopenharmony_ci#define TARGET_NUM_PEER_KEYS			2
69562306a36Sopenharmony_ci#define TARGET_NUM_TIDS				((TARGET_NUM_PEERS) * 2)
69662306a36Sopenharmony_ci#define TARGET_TX_CHAIN_MASK			(BIT(0) | BIT(1) | BIT(2))
69762306a36Sopenharmony_ci#define TARGET_RX_CHAIN_MASK			(BIT(0) | BIT(1) | BIT(2))
69862306a36Sopenharmony_ci#define TARGET_RX_TIMEOUT_LO_PRI		100
69962306a36Sopenharmony_ci#define TARGET_RX_TIMEOUT_HI_PRI		40
70062306a36Sopenharmony_ci
70162306a36Sopenharmony_ci#define TARGET_SCAN_MAX_PENDING_REQS		4
70262306a36Sopenharmony_ci#define TARGET_BMISS_OFFLOAD_MAX_VDEV		3
70362306a36Sopenharmony_ci#define TARGET_ROAM_OFFLOAD_MAX_VDEV		3
70462306a36Sopenharmony_ci#define TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES	8
70562306a36Sopenharmony_ci#define TARGET_GTK_OFFLOAD_MAX_VDEV		3
70662306a36Sopenharmony_ci#define TARGET_NUM_MCAST_GROUPS			0
70762306a36Sopenharmony_ci#define TARGET_NUM_MCAST_TABLE_ELEMS		0
70862306a36Sopenharmony_ci#define TARGET_MCAST2UCAST_MODE			ATH10K_MCAST2UCAST_DISABLED
70962306a36Sopenharmony_ci#define TARGET_TX_DBG_LOG_SIZE			1024
71062306a36Sopenharmony_ci#define TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 0
71162306a36Sopenharmony_ci#define TARGET_VOW_CONFIG			0
71262306a36Sopenharmony_ci#define TARGET_NUM_MSDU_DESC			(1024 + 400)
71362306a36Sopenharmony_ci#define TARGET_MAX_FRAG_ENTRIES			0
71462306a36Sopenharmony_ci
71562306a36Sopenharmony_ci/* Target specific defines for 10.X firmware */
71662306a36Sopenharmony_ci#define TARGET_10X_NUM_VDEVS			16
71762306a36Sopenharmony_ci#define TARGET_10X_NUM_PEER_AST			2
71862306a36Sopenharmony_ci#define TARGET_10X_NUM_WDS_ENTRIES		32
71962306a36Sopenharmony_ci#define TARGET_10X_DMA_BURST_SIZE		0
72062306a36Sopenharmony_ci#define TARGET_10X_MAC_AGGR_DELIM		0
72162306a36Sopenharmony_ci#define TARGET_10X_AST_SKID_LIMIT		128
72262306a36Sopenharmony_ci#define TARGET_10X_NUM_STATIONS			128
72362306a36Sopenharmony_ci#define TARGET_10X_TX_STATS_NUM_STATIONS	118
72462306a36Sopenharmony_ci#define TARGET_10X_NUM_PEERS			((TARGET_10X_NUM_STATIONS) + \
72562306a36Sopenharmony_ci						 (TARGET_10X_NUM_VDEVS))
72662306a36Sopenharmony_ci#define TARGET_10X_TX_STATS_NUM_PEERS		((TARGET_10X_TX_STATS_NUM_STATIONS) + \
72762306a36Sopenharmony_ci						 (TARGET_10X_NUM_VDEVS))
72862306a36Sopenharmony_ci#define TARGET_10X_NUM_OFFLOAD_PEERS		0
72962306a36Sopenharmony_ci#define TARGET_10X_NUM_OFFLOAD_REORDER_BUFS	0
73062306a36Sopenharmony_ci#define TARGET_10X_NUM_PEER_KEYS		2
73162306a36Sopenharmony_ci#define TARGET_10X_NUM_TIDS_MAX			256
73262306a36Sopenharmony_ci#define TARGET_10X_NUM_TIDS			min((TARGET_10X_NUM_TIDS_MAX), \
73362306a36Sopenharmony_ci						    (TARGET_10X_NUM_PEERS) * 2)
73462306a36Sopenharmony_ci#define TARGET_10X_TX_STATS_NUM_TIDS		min((TARGET_10X_NUM_TIDS_MAX), \
73562306a36Sopenharmony_ci						    (TARGET_10X_TX_STATS_NUM_PEERS) * 2)
73662306a36Sopenharmony_ci#define TARGET_10X_TX_CHAIN_MASK		(BIT(0) | BIT(1) | BIT(2))
73762306a36Sopenharmony_ci#define TARGET_10X_RX_CHAIN_MASK		(BIT(0) | BIT(1) | BIT(2))
73862306a36Sopenharmony_ci#define TARGET_10X_RX_TIMEOUT_LO_PRI		100
73962306a36Sopenharmony_ci#define TARGET_10X_RX_TIMEOUT_HI_PRI		40
74062306a36Sopenharmony_ci#define TARGET_10X_SCAN_MAX_PENDING_REQS	4
74162306a36Sopenharmony_ci#define TARGET_10X_BMISS_OFFLOAD_MAX_VDEV	2
74262306a36Sopenharmony_ci#define TARGET_10X_ROAM_OFFLOAD_MAX_VDEV	2
74362306a36Sopenharmony_ci#define TARGET_10X_ROAM_OFFLOAD_MAX_AP_PROFILES	8
74462306a36Sopenharmony_ci#define TARGET_10X_GTK_OFFLOAD_MAX_VDEV		3
74562306a36Sopenharmony_ci#define TARGET_10X_NUM_MCAST_GROUPS		0
74662306a36Sopenharmony_ci#define TARGET_10X_NUM_MCAST_TABLE_ELEMS	0
74762306a36Sopenharmony_ci#define TARGET_10X_MCAST2UCAST_MODE		ATH10K_MCAST2UCAST_DISABLED
74862306a36Sopenharmony_ci#define TARGET_10X_TX_DBG_LOG_SIZE		1024
74962306a36Sopenharmony_ci#define TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
75062306a36Sopenharmony_ci#define TARGET_10X_VOW_CONFIG			0
75162306a36Sopenharmony_ci#define TARGET_10X_NUM_MSDU_DESC		(1024 + 400)
75262306a36Sopenharmony_ci#define TARGET_10X_MAX_FRAG_ENTRIES		0
75362306a36Sopenharmony_ci
75462306a36Sopenharmony_ci/* 10.2 parameters */
75562306a36Sopenharmony_ci#define TARGET_10_2_DMA_BURST_SIZE		0
75662306a36Sopenharmony_ci
75762306a36Sopenharmony_ci/* Target specific defines for WMI-TLV firmware */
75862306a36Sopenharmony_ci#define TARGET_TLV_NUM_VDEVS			4
75962306a36Sopenharmony_ci#define TARGET_TLV_NUM_STATIONS			32
76062306a36Sopenharmony_ci#define TARGET_TLV_NUM_PEERS			33
76162306a36Sopenharmony_ci#define TARGET_TLV_NUM_TDLS_VDEVS		1
76262306a36Sopenharmony_ci#define TARGET_TLV_NUM_TIDS			((TARGET_TLV_NUM_PEERS) * 2)
76362306a36Sopenharmony_ci#define TARGET_TLV_NUM_MSDU_DESC		(1024 + 32)
76462306a36Sopenharmony_ci#define TARGET_TLV_NUM_MSDU_DESC_HL		1024
76562306a36Sopenharmony_ci#define TARGET_TLV_NUM_WOW_PATTERNS		22
76662306a36Sopenharmony_ci#define TARGET_TLV_MGMT_NUM_MSDU_DESC		(50)
76762306a36Sopenharmony_ci
76862306a36Sopenharmony_ci/* Target specific defines for WMI-HL-1.0 firmware */
76962306a36Sopenharmony_ci#define TARGET_HL_TLV_NUM_PEERS			33
77062306a36Sopenharmony_ci#define TARGET_HL_TLV_AST_SKID_LIMIT		16
77162306a36Sopenharmony_ci#define TARGET_HL_TLV_NUM_WDS_ENTRIES		2
77262306a36Sopenharmony_ci
77362306a36Sopenharmony_ci/* Target specific defines for QCA9377 high latency firmware */
77462306a36Sopenharmony_ci#define TARGET_QCA9377_HL_NUM_PEERS		15
77562306a36Sopenharmony_ci
77662306a36Sopenharmony_ci/* Diagnostic Window */
77762306a36Sopenharmony_ci#define CE_DIAG_PIPE	7
77862306a36Sopenharmony_ci
77962306a36Sopenharmony_ci#define NUM_TARGET_CE_CONFIG_WLAN ar->hw_values->num_target_ce_config_wlan
78062306a36Sopenharmony_ci
78162306a36Sopenharmony_ci/* Target specific defines for 10.4 firmware */
78262306a36Sopenharmony_ci#define TARGET_10_4_NUM_VDEVS			16
78362306a36Sopenharmony_ci#define TARGET_10_4_NUM_STATIONS		32
78462306a36Sopenharmony_ci#define TARGET_10_4_NUM_PEERS			((TARGET_10_4_NUM_STATIONS) + \
78562306a36Sopenharmony_ci						 (TARGET_10_4_NUM_VDEVS))
78662306a36Sopenharmony_ci#define TARGET_10_4_ACTIVE_PEERS		0
78762306a36Sopenharmony_ci
78862306a36Sopenharmony_ci#define TARGET_10_4_NUM_QCACHE_PEERS_MAX	512
78962306a36Sopenharmony_ci#define TARGET_10_4_QCACHE_ACTIVE_PEERS		50
79062306a36Sopenharmony_ci#define TARGET_10_4_QCACHE_ACTIVE_PEERS_PFC	35
79162306a36Sopenharmony_ci#define TARGET_10_4_NUM_OFFLOAD_PEERS		0
79262306a36Sopenharmony_ci#define TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS	0
79362306a36Sopenharmony_ci#define TARGET_10_4_NUM_PEER_KEYS		2
79462306a36Sopenharmony_ci#define TARGET_10_4_TGT_NUM_TIDS		((TARGET_10_4_NUM_PEERS) * 2)
79562306a36Sopenharmony_ci#define TARGET_10_4_NUM_MSDU_DESC		(1024 + 400)
79662306a36Sopenharmony_ci#define TARGET_10_4_NUM_MSDU_DESC_PFC		2500
79762306a36Sopenharmony_ci#define TARGET_10_4_AST_SKID_LIMIT		32
79862306a36Sopenharmony_ci
79962306a36Sopenharmony_ci/* 100 ms for video, best-effort, and background */
80062306a36Sopenharmony_ci#define TARGET_10_4_RX_TIMEOUT_LO_PRI		100
80162306a36Sopenharmony_ci
80262306a36Sopenharmony_ci/* 40 ms for voice */
80362306a36Sopenharmony_ci#define TARGET_10_4_RX_TIMEOUT_HI_PRI		40
80462306a36Sopenharmony_ci
80562306a36Sopenharmony_ci#define TARGET_10_4_RX_DECAP_MODE		ATH10K_HW_TXRX_NATIVE_WIFI
80662306a36Sopenharmony_ci#define TARGET_10_4_SCAN_MAX_REQS		4
80762306a36Sopenharmony_ci#define TARGET_10_4_BMISS_OFFLOAD_MAX_VDEV	3
80862306a36Sopenharmony_ci#define TARGET_10_4_ROAM_OFFLOAD_MAX_VDEV	3
80962306a36Sopenharmony_ci#define TARGET_10_4_ROAM_OFFLOAD_MAX_PROFILES   8
81062306a36Sopenharmony_ci
81162306a36Sopenharmony_ci/* Note: mcast to ucast is disabled by default */
81262306a36Sopenharmony_ci#define TARGET_10_4_NUM_MCAST_GROUPS		0
81362306a36Sopenharmony_ci#define TARGET_10_4_NUM_MCAST_TABLE_ELEMS	0
81462306a36Sopenharmony_ci#define TARGET_10_4_MCAST2UCAST_MODE		0
81562306a36Sopenharmony_ci
81662306a36Sopenharmony_ci#define TARGET_10_4_TX_DBG_LOG_SIZE		1024
81762306a36Sopenharmony_ci#define TARGET_10_4_NUM_WDS_ENTRIES		32
81862306a36Sopenharmony_ci#define TARGET_10_4_DMA_BURST_SIZE		1
81962306a36Sopenharmony_ci#define TARGET_10_4_MAC_AGGR_DELIM		0
82062306a36Sopenharmony_ci#define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
82162306a36Sopenharmony_ci#define TARGET_10_4_VOW_CONFIG			0
82262306a36Sopenharmony_ci#define TARGET_10_4_GTK_OFFLOAD_MAX_VDEV	3
82362306a36Sopenharmony_ci#define TARGET_10_4_11AC_TX_MAX_FRAGS		2
82462306a36Sopenharmony_ci#define TARGET_10_4_MAX_PEER_EXT_STATS		16
82562306a36Sopenharmony_ci#define TARGET_10_4_SMART_ANT_CAP		0
82662306a36Sopenharmony_ci#define TARGET_10_4_BK_MIN_FREE			0
82762306a36Sopenharmony_ci#define TARGET_10_4_BE_MIN_FREE			0
82862306a36Sopenharmony_ci#define TARGET_10_4_VI_MIN_FREE			0
82962306a36Sopenharmony_ci#define TARGET_10_4_VO_MIN_FREE			0
83062306a36Sopenharmony_ci#define TARGET_10_4_RX_BATCH_MODE		1
83162306a36Sopenharmony_ci#define TARGET_10_4_THERMAL_THROTTLING_CONFIG	0
83262306a36Sopenharmony_ci#define TARGET_10_4_ATF_CONFIG			0
83362306a36Sopenharmony_ci#define TARGET_10_4_IPHDR_PAD_CONFIG		1
83462306a36Sopenharmony_ci#define TARGET_10_4_QWRAP_CONFIG		0
83562306a36Sopenharmony_ci
83662306a36Sopenharmony_ci/* TDLS config */
83762306a36Sopenharmony_ci#define TARGET_10_4_NUM_TDLS_VDEVS		1
83862306a36Sopenharmony_ci#define TARGET_10_4_NUM_TDLS_BUFFER_STA		1
83962306a36Sopenharmony_ci#define TARGET_10_4_NUM_TDLS_SLEEP_STA		1
84062306a36Sopenharmony_ci
84162306a36Sopenharmony_ci/* Maximum number of Copy Engine's supported */
84262306a36Sopenharmony_ci#define CE_COUNT_MAX 12
84362306a36Sopenharmony_ci
84462306a36Sopenharmony_ci/* Number of Copy Engines supported */
84562306a36Sopenharmony_ci#define CE_COUNT ar->hw_values->ce_count
84662306a36Sopenharmony_ci
84762306a36Sopenharmony_ci/*
84862306a36Sopenharmony_ci * Granted MSIs are assigned as follows:
84962306a36Sopenharmony_ci * Firmware uses the first
85062306a36Sopenharmony_ci * Remaining MSIs, if any, are used by Copy Engines
85162306a36Sopenharmony_ci * This mapping is known to both Target firmware and Host software.
85262306a36Sopenharmony_ci * It may be changed as long as Host and Target are kept in sync.
85362306a36Sopenharmony_ci */
85462306a36Sopenharmony_ci/* MSI for firmware (errors, etc.) */
85562306a36Sopenharmony_ci#define MSI_ASSIGN_FW		0
85662306a36Sopenharmony_ci
85762306a36Sopenharmony_ci/* MSIs for Copy Engines */
85862306a36Sopenharmony_ci#define MSI_ASSIGN_CE_INITIAL	1
85962306a36Sopenharmony_ci#define MSI_ASSIGN_CE_MAX	ar->hw_values->msi_assign_ce_max
86062306a36Sopenharmony_ci
86162306a36Sopenharmony_ci/* as of IP3.7.1 */
86262306a36Sopenharmony_ci#define RTC_STATE_V_ON				ar->hw_values->rtc_state_val_on
86362306a36Sopenharmony_ci
86462306a36Sopenharmony_ci#define RTC_STATE_V_LSB				0
86562306a36Sopenharmony_ci#define RTC_STATE_V_MASK			0x00000007
86662306a36Sopenharmony_ci#define RTC_STATE_ADDRESS			0x0000
86762306a36Sopenharmony_ci#define PCIE_SOC_WAKE_V_MASK			0x00000001
86862306a36Sopenharmony_ci#define PCIE_SOC_WAKE_ADDRESS			0x0004
86962306a36Sopenharmony_ci#define PCIE_SOC_WAKE_RESET			0x00000000
87062306a36Sopenharmony_ci#define SOC_GLOBAL_RESET_ADDRESS		0x0008
87162306a36Sopenharmony_ci
87262306a36Sopenharmony_ci#define RTC_SOC_BASE_ADDRESS			ar->regs->rtc_soc_base_address
87362306a36Sopenharmony_ci#define RTC_WMAC_BASE_ADDRESS			ar->regs->rtc_wmac_base_address
87462306a36Sopenharmony_ci#define MAC_COEX_BASE_ADDRESS			0x00006000
87562306a36Sopenharmony_ci#define BT_COEX_BASE_ADDRESS			0x00007000
87662306a36Sopenharmony_ci#define SOC_PCIE_BASE_ADDRESS			0x00008000
87762306a36Sopenharmony_ci#define SOC_CORE_BASE_ADDRESS			ar->regs->soc_core_base_address
87862306a36Sopenharmony_ci#define WLAN_UART_BASE_ADDRESS			0x0000c000
87962306a36Sopenharmony_ci#define WLAN_SI_BASE_ADDRESS			0x00010000
88062306a36Sopenharmony_ci#define WLAN_GPIO_BASE_ADDRESS			0x00014000
88162306a36Sopenharmony_ci#define WLAN_ANALOG_INTF_BASE_ADDRESS		0x0001c000
88262306a36Sopenharmony_ci#define WLAN_MAC_BASE_ADDRESS			ar->regs->wlan_mac_base_address
88362306a36Sopenharmony_ci#define EFUSE_BASE_ADDRESS			0x00030000
88462306a36Sopenharmony_ci#define FPGA_REG_BASE_ADDRESS			0x00039000
88562306a36Sopenharmony_ci#define WLAN_UART2_BASE_ADDRESS			0x00054c00
88662306a36Sopenharmony_ci#define CE_WRAPPER_BASE_ADDRESS			ar->regs->ce_wrapper_base_address
88762306a36Sopenharmony_ci#define CE0_BASE_ADDRESS			ar->regs->ce0_base_address
88862306a36Sopenharmony_ci#define CE1_BASE_ADDRESS			ar->regs->ce1_base_address
88962306a36Sopenharmony_ci#define CE2_BASE_ADDRESS			ar->regs->ce2_base_address
89062306a36Sopenharmony_ci#define CE3_BASE_ADDRESS			ar->regs->ce3_base_address
89162306a36Sopenharmony_ci#define CE4_BASE_ADDRESS			ar->regs->ce4_base_address
89262306a36Sopenharmony_ci#define CE5_BASE_ADDRESS			ar->regs->ce5_base_address
89362306a36Sopenharmony_ci#define CE6_BASE_ADDRESS			ar->regs->ce6_base_address
89462306a36Sopenharmony_ci#define CE7_BASE_ADDRESS			ar->regs->ce7_base_address
89562306a36Sopenharmony_ci#define DBI_BASE_ADDRESS			0x00060000
89662306a36Sopenharmony_ci#define WLAN_ANALOG_INTF_PCIE_BASE_ADDRESS	0x0006c000
89762306a36Sopenharmony_ci#define PCIE_LOCAL_BASE_ADDRESS		ar->regs->pcie_local_base_address
89862306a36Sopenharmony_ci
89962306a36Sopenharmony_ci#define SOC_RESET_CONTROL_ADDRESS		0x00000000
90062306a36Sopenharmony_ci#define SOC_RESET_CONTROL_OFFSET		0x00000000
90162306a36Sopenharmony_ci#define SOC_RESET_CONTROL_SI0_RST_MASK		ar->regs->soc_reset_control_si0_rst_mask
90262306a36Sopenharmony_ci#define SOC_RESET_CONTROL_CE_RST_MASK		ar->regs->soc_reset_control_ce_rst_mask
90362306a36Sopenharmony_ci#define SOC_RESET_CONTROL_CPU_WARM_RST_MASK	0x00000040
90462306a36Sopenharmony_ci#define SOC_CPU_CLOCK_OFFSET			0x00000020
90562306a36Sopenharmony_ci#define SOC_CPU_CLOCK_STANDARD_LSB		0
90662306a36Sopenharmony_ci#define SOC_CPU_CLOCK_STANDARD_MASK		0x00000003
90762306a36Sopenharmony_ci#define SOC_CLOCK_CONTROL_OFFSET		0x00000028
90862306a36Sopenharmony_ci#define SOC_CLOCK_CONTROL_SI0_CLK_MASK		0x00000001
90962306a36Sopenharmony_ci#define SOC_SYSTEM_SLEEP_OFFSET			0x000000c4
91062306a36Sopenharmony_ci#define SOC_LPO_CAL_OFFSET			0x000000e0
91162306a36Sopenharmony_ci#define SOC_LPO_CAL_ENABLE_LSB			20
91262306a36Sopenharmony_ci#define SOC_LPO_CAL_ENABLE_MASK			0x00100000
91362306a36Sopenharmony_ci#define SOC_LF_TIMER_CONTROL0_ADDRESS		0x00000050
91462306a36Sopenharmony_ci#define SOC_LF_TIMER_CONTROL0_ENABLE_MASK	0x00000004
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci#define SOC_CHIP_ID_ADDRESS			ar->regs->soc_chip_id_address
91762306a36Sopenharmony_ci#define SOC_CHIP_ID_REV_LSB			8
91862306a36Sopenharmony_ci#define SOC_CHIP_ID_REV_MASK			0x00000f00
91962306a36Sopenharmony_ci
92062306a36Sopenharmony_ci#define WLAN_RESET_CONTROL_COLD_RST_MASK	0x00000008
92162306a36Sopenharmony_ci#define WLAN_RESET_CONTROL_WARM_RST_MASK	0x00000004
92262306a36Sopenharmony_ci#define WLAN_SYSTEM_SLEEP_DISABLE_LSB		0
92362306a36Sopenharmony_ci#define WLAN_SYSTEM_SLEEP_DISABLE_MASK		0x00000001
92462306a36Sopenharmony_ci
92562306a36Sopenharmony_ci#define WLAN_GPIO_PIN0_ADDRESS			0x00000028
92662306a36Sopenharmony_ci#define WLAN_GPIO_PIN0_CONFIG_LSB		11
92762306a36Sopenharmony_ci#define WLAN_GPIO_PIN0_CONFIG_MASK		0x00007800
92862306a36Sopenharmony_ci#define WLAN_GPIO_PIN0_PAD_PULL_LSB		5
92962306a36Sopenharmony_ci#define WLAN_GPIO_PIN0_PAD_PULL_MASK		0x00000060
93062306a36Sopenharmony_ci#define WLAN_GPIO_PIN1_ADDRESS			0x0000002c
93162306a36Sopenharmony_ci#define WLAN_GPIO_PIN1_CONFIG_MASK		0x00007800
93262306a36Sopenharmony_ci#define WLAN_GPIO_PIN10_ADDRESS			0x00000050
93362306a36Sopenharmony_ci#define WLAN_GPIO_PIN11_ADDRESS			0x00000054
93462306a36Sopenharmony_ci#define WLAN_GPIO_PIN12_ADDRESS			0x00000058
93562306a36Sopenharmony_ci#define WLAN_GPIO_PIN13_ADDRESS			0x0000005c
93662306a36Sopenharmony_ci
93762306a36Sopenharmony_ci#define CLOCK_GPIO_OFFSET			0xffffffff
93862306a36Sopenharmony_ci#define CLOCK_GPIO_BT_CLK_OUT_EN_LSB		0
93962306a36Sopenharmony_ci#define CLOCK_GPIO_BT_CLK_OUT_EN_MASK		0
94062306a36Sopenharmony_ci
94162306a36Sopenharmony_ci#define SI_CONFIG_OFFSET			0x00000000
94262306a36Sopenharmony_ci#define SI_CONFIG_ERR_INT_LSB			19
94362306a36Sopenharmony_ci#define SI_CONFIG_ERR_INT_MASK			0x00080000
94462306a36Sopenharmony_ci#define SI_CONFIG_BIDIR_OD_DATA_LSB		18
94562306a36Sopenharmony_ci#define SI_CONFIG_BIDIR_OD_DATA_MASK		0x00040000
94662306a36Sopenharmony_ci#define SI_CONFIG_I2C_LSB			16
94762306a36Sopenharmony_ci#define SI_CONFIG_I2C_MASK			0x00010000
94862306a36Sopenharmony_ci#define SI_CONFIG_POS_SAMPLE_LSB		7
94962306a36Sopenharmony_ci#define SI_CONFIG_POS_SAMPLE_MASK		0x00000080
95062306a36Sopenharmony_ci#define SI_CONFIG_INACTIVE_DATA_LSB		5
95162306a36Sopenharmony_ci#define SI_CONFIG_INACTIVE_DATA_MASK		0x00000020
95262306a36Sopenharmony_ci#define SI_CONFIG_INACTIVE_CLK_LSB		4
95362306a36Sopenharmony_ci#define SI_CONFIG_INACTIVE_CLK_MASK		0x00000010
95462306a36Sopenharmony_ci#define SI_CONFIG_DIVIDER_LSB			0
95562306a36Sopenharmony_ci#define SI_CONFIG_DIVIDER_MASK			0x0000000f
95662306a36Sopenharmony_ci#define SI_CS_OFFSET				0x00000004
95762306a36Sopenharmony_ci#define SI_CS_DONE_ERR_LSB			10
95862306a36Sopenharmony_ci#define SI_CS_DONE_ERR_MASK			0x00000400
95962306a36Sopenharmony_ci#define SI_CS_DONE_INT_LSB			9
96062306a36Sopenharmony_ci#define SI_CS_DONE_INT_MASK			0x00000200
96162306a36Sopenharmony_ci#define SI_CS_START_LSB				8
96262306a36Sopenharmony_ci#define SI_CS_START_MASK			0x00000100
96362306a36Sopenharmony_ci#define SI_CS_RX_CNT_LSB			4
96462306a36Sopenharmony_ci#define SI_CS_RX_CNT_MASK			0x000000f0
96562306a36Sopenharmony_ci#define SI_CS_TX_CNT_LSB			0
96662306a36Sopenharmony_ci#define SI_CS_TX_CNT_MASK			0x0000000f
96762306a36Sopenharmony_ci
96862306a36Sopenharmony_ci#define SI_TX_DATA0_OFFSET			0x00000008
96962306a36Sopenharmony_ci#define SI_TX_DATA1_OFFSET			0x0000000c
97062306a36Sopenharmony_ci#define SI_RX_DATA0_OFFSET			0x00000010
97162306a36Sopenharmony_ci#define SI_RX_DATA1_OFFSET			0x00000014
97262306a36Sopenharmony_ci
97362306a36Sopenharmony_ci#define CORE_CTRL_CPU_INTR_MASK			0x00002000
97462306a36Sopenharmony_ci#define CORE_CTRL_PCIE_REG_31_MASK		0x00000800
97562306a36Sopenharmony_ci#define CORE_CTRL_ADDRESS			0x0000
97662306a36Sopenharmony_ci#define PCIE_INTR_ENABLE_ADDRESS		0x0008
97762306a36Sopenharmony_ci#define PCIE_INTR_CAUSE_ADDRESS			0x000c
97862306a36Sopenharmony_ci#define PCIE_INTR_CLR_ADDRESS			ar->regs->pcie_intr_clr_address
97962306a36Sopenharmony_ci#define SCRATCH_3_ADDRESS			ar->regs->scratch_3_address
98062306a36Sopenharmony_ci#define CPU_INTR_ADDRESS			0x0010
98162306a36Sopenharmony_ci#define FW_RAM_CONFIG_ADDRESS			0x0018
98262306a36Sopenharmony_ci
98362306a36Sopenharmony_ci#define CCNT_TO_MSEC(ar, x) ((x) / ar->hw_params.channel_counters_freq_hz)
98462306a36Sopenharmony_ci
98562306a36Sopenharmony_ci/* Firmware indications to the Host via SCRATCH_3 register. */
98662306a36Sopenharmony_ci#define FW_INDICATOR_ADDRESS			ar->regs->fw_indicator_address
98762306a36Sopenharmony_ci#define FW_IND_EVENT_PENDING			1
98862306a36Sopenharmony_ci#define FW_IND_INITIALIZED			2
98962306a36Sopenharmony_ci#define FW_IND_HOST_READY			0x80000000
99062306a36Sopenharmony_ci
99162306a36Sopenharmony_ci/* HOST_REG interrupt from firmware */
99262306a36Sopenharmony_ci#define PCIE_INTR_FIRMWARE_MASK			ar->regs->pcie_intr_fw_mask
99362306a36Sopenharmony_ci#define PCIE_INTR_CE_MASK_ALL			ar->regs->pcie_intr_ce_mask_all
99462306a36Sopenharmony_ci
99562306a36Sopenharmony_ci#define DRAM_BASE_ADDRESS			0x00400000
99662306a36Sopenharmony_ci
99762306a36Sopenharmony_ci#define PCIE_BAR_REG_ADDRESS			0x40030
99862306a36Sopenharmony_ci
99962306a36Sopenharmony_ci#define MISSING 0
100062306a36Sopenharmony_ci
100162306a36Sopenharmony_ci#define SYSTEM_SLEEP_OFFSET			SOC_SYSTEM_SLEEP_OFFSET
100262306a36Sopenharmony_ci#define WLAN_SYSTEM_SLEEP_OFFSET		SOC_SYSTEM_SLEEP_OFFSET
100362306a36Sopenharmony_ci#define WLAN_RESET_CONTROL_OFFSET		SOC_RESET_CONTROL_OFFSET
100462306a36Sopenharmony_ci#define CLOCK_CONTROL_OFFSET			SOC_CLOCK_CONTROL_OFFSET
100562306a36Sopenharmony_ci#define CLOCK_CONTROL_SI0_CLK_MASK		SOC_CLOCK_CONTROL_SI0_CLK_MASK
100662306a36Sopenharmony_ci#define RESET_CONTROL_MBOX_RST_MASK		MISSING
100762306a36Sopenharmony_ci#define RESET_CONTROL_SI0_RST_MASK		SOC_RESET_CONTROL_SI0_RST_MASK
100862306a36Sopenharmony_ci#define GPIO_BASE_ADDRESS			WLAN_GPIO_BASE_ADDRESS
100962306a36Sopenharmony_ci#define GPIO_PIN0_OFFSET			WLAN_GPIO_PIN0_ADDRESS
101062306a36Sopenharmony_ci#define GPIO_PIN1_OFFSET			WLAN_GPIO_PIN1_ADDRESS
101162306a36Sopenharmony_ci#define GPIO_PIN0_CONFIG_LSB			WLAN_GPIO_PIN0_CONFIG_LSB
101262306a36Sopenharmony_ci#define GPIO_PIN0_CONFIG_MASK			WLAN_GPIO_PIN0_CONFIG_MASK
101362306a36Sopenharmony_ci#define GPIO_PIN0_PAD_PULL_LSB			WLAN_GPIO_PIN0_PAD_PULL_LSB
101462306a36Sopenharmony_ci#define GPIO_PIN0_PAD_PULL_MASK			WLAN_GPIO_PIN0_PAD_PULL_MASK
101562306a36Sopenharmony_ci#define GPIO_PIN1_CONFIG_MASK			WLAN_GPIO_PIN1_CONFIG_MASK
101662306a36Sopenharmony_ci#define SI_BASE_ADDRESS				WLAN_SI_BASE_ADDRESS
101762306a36Sopenharmony_ci#define SCRATCH_BASE_ADDRESS			SOC_CORE_BASE_ADDRESS
101862306a36Sopenharmony_ci#define LOCAL_SCRATCH_OFFSET			0x18
101962306a36Sopenharmony_ci#define CPU_CLOCK_OFFSET			SOC_CPU_CLOCK_OFFSET
102062306a36Sopenharmony_ci#define LPO_CAL_OFFSET				SOC_LPO_CAL_OFFSET
102162306a36Sopenharmony_ci#define GPIO_PIN10_OFFSET			WLAN_GPIO_PIN10_ADDRESS
102262306a36Sopenharmony_ci#define GPIO_PIN11_OFFSET			WLAN_GPIO_PIN11_ADDRESS
102362306a36Sopenharmony_ci#define GPIO_PIN12_OFFSET			WLAN_GPIO_PIN12_ADDRESS
102462306a36Sopenharmony_ci#define GPIO_PIN13_OFFSET			WLAN_GPIO_PIN13_ADDRESS
102562306a36Sopenharmony_ci#define CPU_CLOCK_STANDARD_LSB			SOC_CPU_CLOCK_STANDARD_LSB
102662306a36Sopenharmony_ci#define CPU_CLOCK_STANDARD_MASK			SOC_CPU_CLOCK_STANDARD_MASK
102762306a36Sopenharmony_ci#define LPO_CAL_ENABLE_LSB			SOC_LPO_CAL_ENABLE_LSB
102862306a36Sopenharmony_ci#define LPO_CAL_ENABLE_MASK			SOC_LPO_CAL_ENABLE_MASK
102962306a36Sopenharmony_ci#define ANALOG_INTF_BASE_ADDRESS		WLAN_ANALOG_INTF_BASE_ADDRESS
103062306a36Sopenharmony_ci#define MBOX_BASE_ADDRESS			MISSING
103162306a36Sopenharmony_ci#define INT_STATUS_ENABLE_ERROR_LSB		MISSING
103262306a36Sopenharmony_ci#define INT_STATUS_ENABLE_ERROR_MASK		MISSING
103362306a36Sopenharmony_ci#define INT_STATUS_ENABLE_CPU_LSB		MISSING
103462306a36Sopenharmony_ci#define INT_STATUS_ENABLE_CPU_MASK		MISSING
103562306a36Sopenharmony_ci#define INT_STATUS_ENABLE_COUNTER_LSB		MISSING
103662306a36Sopenharmony_ci#define INT_STATUS_ENABLE_COUNTER_MASK		MISSING
103762306a36Sopenharmony_ci#define INT_STATUS_ENABLE_MBOX_DATA_LSB		MISSING
103862306a36Sopenharmony_ci#define INT_STATUS_ENABLE_MBOX_DATA_MASK	MISSING
103962306a36Sopenharmony_ci#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB	MISSING
104062306a36Sopenharmony_ci#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK	MISSING
104162306a36Sopenharmony_ci#define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB	MISSING
104262306a36Sopenharmony_ci#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK	MISSING
104362306a36Sopenharmony_ci#define COUNTER_INT_STATUS_ENABLE_BIT_LSB	MISSING
104462306a36Sopenharmony_ci#define COUNTER_INT_STATUS_ENABLE_BIT_MASK	MISSING
104562306a36Sopenharmony_ci#define INT_STATUS_ENABLE_ADDRESS		MISSING
104662306a36Sopenharmony_ci#define CPU_INT_STATUS_ENABLE_BIT_LSB		MISSING
104762306a36Sopenharmony_ci#define CPU_INT_STATUS_ENABLE_BIT_MASK		MISSING
104862306a36Sopenharmony_ci#define HOST_INT_STATUS_ADDRESS			MISSING
104962306a36Sopenharmony_ci#define CPU_INT_STATUS_ADDRESS			MISSING
105062306a36Sopenharmony_ci#define ERROR_INT_STATUS_ADDRESS		MISSING
105162306a36Sopenharmony_ci#define ERROR_INT_STATUS_WAKEUP_MASK		MISSING
105262306a36Sopenharmony_ci#define ERROR_INT_STATUS_WAKEUP_LSB		MISSING
105362306a36Sopenharmony_ci#define ERROR_INT_STATUS_RX_UNDERFLOW_MASK	MISSING
105462306a36Sopenharmony_ci#define ERROR_INT_STATUS_RX_UNDERFLOW_LSB	MISSING
105562306a36Sopenharmony_ci#define ERROR_INT_STATUS_TX_OVERFLOW_MASK	MISSING
105662306a36Sopenharmony_ci#define ERROR_INT_STATUS_TX_OVERFLOW_LSB	MISSING
105762306a36Sopenharmony_ci#define COUNT_DEC_ADDRESS			MISSING
105862306a36Sopenharmony_ci#define HOST_INT_STATUS_CPU_MASK		MISSING
105962306a36Sopenharmony_ci#define HOST_INT_STATUS_CPU_LSB			MISSING
106062306a36Sopenharmony_ci#define HOST_INT_STATUS_ERROR_MASK		MISSING
106162306a36Sopenharmony_ci#define HOST_INT_STATUS_ERROR_LSB		MISSING
106262306a36Sopenharmony_ci#define HOST_INT_STATUS_COUNTER_MASK		MISSING
106362306a36Sopenharmony_ci#define HOST_INT_STATUS_COUNTER_LSB		MISSING
106462306a36Sopenharmony_ci#define RX_LOOKAHEAD_VALID_ADDRESS		MISSING
106562306a36Sopenharmony_ci#define WINDOW_DATA_ADDRESS			MISSING
106662306a36Sopenharmony_ci#define WINDOW_READ_ADDR_ADDRESS		MISSING
106762306a36Sopenharmony_ci#define WINDOW_WRITE_ADDR_ADDRESS		MISSING
106862306a36Sopenharmony_ci
106962306a36Sopenharmony_ci#define QCA9887_1_0_I2C_SDA_GPIO_PIN		5
107062306a36Sopenharmony_ci#define QCA9887_1_0_I2C_SDA_PIN_CONFIG		3
107162306a36Sopenharmony_ci#define QCA9887_1_0_SI_CLK_GPIO_PIN		17
107262306a36Sopenharmony_ci#define QCA9887_1_0_SI_CLK_PIN_CONFIG		3
107362306a36Sopenharmony_ci#define QCA9887_1_0_GPIO_ENABLE_W1TS_LOW_ADDRESS 0x00000010
107462306a36Sopenharmony_ci
107562306a36Sopenharmony_ci#define QCA9887_EEPROM_SELECT_READ		0xa10000a0
107662306a36Sopenharmony_ci#define QCA9887_EEPROM_ADDR_HI_MASK		0x0000ff00
107762306a36Sopenharmony_ci#define QCA9887_EEPROM_ADDR_HI_LSB		8
107862306a36Sopenharmony_ci#define QCA9887_EEPROM_ADDR_LO_MASK		0x00ff0000
107962306a36Sopenharmony_ci#define QCA9887_EEPROM_ADDR_LO_LSB		16
108062306a36Sopenharmony_ci
108162306a36Sopenharmony_ci#define MBOX_RESET_CONTROL_ADDRESS		0x00000000
108262306a36Sopenharmony_ci#define MBOX_HOST_INT_STATUS_ADDRESS		0x00000800
108362306a36Sopenharmony_ci#define MBOX_HOST_INT_STATUS_ERROR_LSB		7
108462306a36Sopenharmony_ci#define MBOX_HOST_INT_STATUS_ERROR_MASK		0x00000080
108562306a36Sopenharmony_ci#define MBOX_HOST_INT_STATUS_CPU_LSB		6
108662306a36Sopenharmony_ci#define MBOX_HOST_INT_STATUS_CPU_MASK		0x00000040
108762306a36Sopenharmony_ci#define MBOX_HOST_INT_STATUS_COUNTER_LSB	4
108862306a36Sopenharmony_ci#define MBOX_HOST_INT_STATUS_COUNTER_MASK	0x00000010
108962306a36Sopenharmony_ci#define MBOX_CPU_INT_STATUS_ADDRESS		0x00000801
109062306a36Sopenharmony_ci#define MBOX_ERROR_INT_STATUS_ADDRESS		0x00000802
109162306a36Sopenharmony_ci#define MBOX_ERROR_INT_STATUS_WAKEUP_LSB	2
109262306a36Sopenharmony_ci#define MBOX_ERROR_INT_STATUS_WAKEUP_MASK	0x00000004
109362306a36Sopenharmony_ci#define MBOX_ERROR_INT_STATUS_RX_UNDERFLOW_LSB	1
109462306a36Sopenharmony_ci#define MBOX_ERROR_INT_STATUS_RX_UNDERFLOW_MASK	0x00000002
109562306a36Sopenharmony_ci#define MBOX_ERROR_INT_STATUS_TX_OVERFLOW_LSB	0
109662306a36Sopenharmony_ci#define MBOX_ERROR_INT_STATUS_TX_OVERFLOW_MASK	0x00000001
109762306a36Sopenharmony_ci#define MBOX_COUNTER_INT_STATUS_ADDRESS		0x00000803
109862306a36Sopenharmony_ci#define MBOX_COUNTER_INT_STATUS_COUNTER_LSB	0
109962306a36Sopenharmony_ci#define MBOX_COUNTER_INT_STATUS_COUNTER_MASK	0x000000ff
110062306a36Sopenharmony_ci#define MBOX_RX_LOOKAHEAD_VALID_ADDRESS		0x00000805
110162306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_ADDRESS		0x00000828
110262306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_ERROR_LSB	7
110362306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_ERROR_MASK	0x00000080
110462306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_CPU_LSB		6
110562306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_CPU_MASK		0x00000040
110662306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_INT_LSB		5
110762306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_INT_MASK		0x00000020
110862306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_COUNTER_LSB	4
110962306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_COUNTER_MASK	0x00000010
111062306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_MBOX_DATA_LSB	0
111162306a36Sopenharmony_ci#define MBOX_INT_STATUS_ENABLE_MBOX_DATA_MASK	0x0000000f
111262306a36Sopenharmony_ci#define MBOX_CPU_INT_STATUS_ENABLE_ADDRESS	0x00000819
111362306a36Sopenharmony_ci#define MBOX_CPU_INT_STATUS_ENABLE_BIT_LSB	0
111462306a36Sopenharmony_ci#define MBOX_CPU_INT_STATUS_ENABLE_BIT_MASK	0x000000ff
111562306a36Sopenharmony_ci#define MBOX_CPU_STATUS_ENABLE_ASSERT_MASK 0x00000001
111662306a36Sopenharmony_ci#define MBOX_ERROR_STATUS_ENABLE_ADDRESS	0x0000081a
111762306a36Sopenharmony_ci#define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB  1
111862306a36Sopenharmony_ci#define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002
111962306a36Sopenharmony_ci#define MBOX_ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB   0
112062306a36Sopenharmony_ci#define MBOX_ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK  0x00000001
112162306a36Sopenharmony_ci#define MBOX_COUNTER_INT_STATUS_ENABLE_ADDRESS	0x0000081b
112262306a36Sopenharmony_ci#define MBOX_COUNTER_INT_STATUS_ENABLE_BIT_LSB	0
112362306a36Sopenharmony_ci#define MBOX_COUNTER_INT_STATUS_ENABLE_BIT_MASK	0x000000ff
112462306a36Sopenharmony_ci#define MBOX_COUNT_ADDRESS			0x00000820
112562306a36Sopenharmony_ci#define MBOX_COUNT_DEC_ADDRESS			0x00000840
112662306a36Sopenharmony_ci#define MBOX_WINDOW_DATA_ADDRESS		0x00000874
112762306a36Sopenharmony_ci#define MBOX_WINDOW_WRITE_ADDR_ADDRESS		0x00000878
112862306a36Sopenharmony_ci#define MBOX_WINDOW_READ_ADDR_ADDRESS		0x0000087c
112962306a36Sopenharmony_ci#define MBOX_CPU_DBG_SEL_ADDRESS		0x00000883
113062306a36Sopenharmony_ci#define MBOX_CPU_DBG_ADDRESS			0x00000884
113162306a36Sopenharmony_ci#define MBOX_RTC_BASE_ADDRESS			0x00000000
113262306a36Sopenharmony_ci#define MBOX_GPIO_BASE_ADDRESS			0x00005000
113362306a36Sopenharmony_ci#define MBOX_MBOX_BASE_ADDRESS			0x00008000
113462306a36Sopenharmony_ci
113562306a36Sopenharmony_ci#define RTC_STATE_V_GET(x) (((x) & RTC_STATE_V_MASK) >> RTC_STATE_V_LSB)
113662306a36Sopenharmony_ci
113762306a36Sopenharmony_ci/* Register definitions for first generation ath10k cards. These cards include
113862306a36Sopenharmony_ci * a mac thich has a register allocation similar to ath9k and at least some
113962306a36Sopenharmony_ci * registers including the ones relevant for modifying the coverage class are
114062306a36Sopenharmony_ci * identical to the ath9k definitions.
114162306a36Sopenharmony_ci * These registers are usually managed by the ath10k firmware. However by
114262306a36Sopenharmony_ci * overriding them it is possible to support coverage class modifications.
114362306a36Sopenharmony_ci */
114462306a36Sopenharmony_ci#define WAVE1_PCU_ACK_CTS_TIMEOUT		0x8014
114562306a36Sopenharmony_ci#define WAVE1_PCU_ACK_CTS_TIMEOUT_MAX		0x00003FFF
114662306a36Sopenharmony_ci#define WAVE1_PCU_ACK_CTS_TIMEOUT_ACK_MASK	0x00003FFF
114762306a36Sopenharmony_ci#define WAVE1_PCU_ACK_CTS_TIMEOUT_ACK_LSB	0
114862306a36Sopenharmony_ci#define WAVE1_PCU_ACK_CTS_TIMEOUT_CTS_MASK	0x3FFF0000
114962306a36Sopenharmony_ci#define WAVE1_PCU_ACK_CTS_TIMEOUT_CTS_LSB	16
115062306a36Sopenharmony_ci
115162306a36Sopenharmony_ci#define WAVE1_PCU_GBL_IFS_SLOT			0x1070
115262306a36Sopenharmony_ci#define WAVE1_PCU_GBL_IFS_SLOT_MASK		0x0000FFFF
115362306a36Sopenharmony_ci#define WAVE1_PCU_GBL_IFS_SLOT_MAX		0x0000FFFF
115462306a36Sopenharmony_ci#define WAVE1_PCU_GBL_IFS_SLOT_LSB		0
115562306a36Sopenharmony_ci#define WAVE1_PCU_GBL_IFS_SLOT_RESV0		0xFFFF0000
115662306a36Sopenharmony_ci
115762306a36Sopenharmony_ci#define WAVE1_PHYCLK				0x801C
115862306a36Sopenharmony_ci#define WAVE1_PHYCLK_USEC_MASK			0x0000007F
115962306a36Sopenharmony_ci#define WAVE1_PHYCLK_USEC_LSB			0
116062306a36Sopenharmony_ci
116162306a36Sopenharmony_ci/* qca6174 PLL offset/mask */
116262306a36Sopenharmony_ci#define SOC_CORE_CLK_CTRL_OFFSET		0x00000114
116362306a36Sopenharmony_ci#define SOC_CORE_CLK_CTRL_DIV_LSB		0
116462306a36Sopenharmony_ci#define SOC_CORE_CLK_CTRL_DIV_MASK		0x00000007
116562306a36Sopenharmony_ci
116662306a36Sopenharmony_ci#define EFUSE_OFFSET				0x0000032c
116762306a36Sopenharmony_ci#define EFUSE_XTAL_SEL_LSB			8
116862306a36Sopenharmony_ci#define EFUSE_XTAL_SEL_MASK			0x00000700
116962306a36Sopenharmony_ci
117062306a36Sopenharmony_ci#define BB_PLL_CONFIG_OFFSET			0x000002f4
117162306a36Sopenharmony_ci#define BB_PLL_CONFIG_FRAC_LSB			0
117262306a36Sopenharmony_ci#define BB_PLL_CONFIG_FRAC_MASK			0x0003ffff
117362306a36Sopenharmony_ci#define BB_PLL_CONFIG_OUTDIV_LSB		18
117462306a36Sopenharmony_ci#define BB_PLL_CONFIG_OUTDIV_MASK		0x001c0000
117562306a36Sopenharmony_ci
117662306a36Sopenharmony_ci#define WLAN_PLL_SETTLE_OFFSET			0x0018
117762306a36Sopenharmony_ci#define WLAN_PLL_SETTLE_TIME_LSB		0
117862306a36Sopenharmony_ci#define WLAN_PLL_SETTLE_TIME_MASK		0x000007ff
117962306a36Sopenharmony_ci
118062306a36Sopenharmony_ci#define WLAN_PLL_CONTROL_OFFSET			0x0014
118162306a36Sopenharmony_ci#define WLAN_PLL_CONTROL_DIV_LSB		0
118262306a36Sopenharmony_ci#define WLAN_PLL_CONTROL_DIV_MASK		0x000003ff
118362306a36Sopenharmony_ci#define WLAN_PLL_CONTROL_REFDIV_LSB		10
118462306a36Sopenharmony_ci#define WLAN_PLL_CONTROL_REFDIV_MASK		0x00003c00
118562306a36Sopenharmony_ci#define WLAN_PLL_CONTROL_BYPASS_LSB		16
118662306a36Sopenharmony_ci#define WLAN_PLL_CONTROL_BYPASS_MASK		0x00010000
118762306a36Sopenharmony_ci#define WLAN_PLL_CONTROL_NOPWD_LSB		18
118862306a36Sopenharmony_ci#define WLAN_PLL_CONTROL_NOPWD_MASK		0x00040000
118962306a36Sopenharmony_ci
119062306a36Sopenharmony_ci#define RTC_SYNC_STATUS_OFFSET			0x0244
119162306a36Sopenharmony_ci#define RTC_SYNC_STATUS_PLL_CHANGING_LSB	5
119262306a36Sopenharmony_ci#define RTC_SYNC_STATUS_PLL_CHANGING_MASK	0x00000020
119362306a36Sopenharmony_ci/* qca6174 PLL offset/mask end */
119462306a36Sopenharmony_ci
119562306a36Sopenharmony_ci/* CPU_ADDR_MSB is a register, bit[3:0] is to specify which memory
119662306a36Sopenharmony_ci * region is accessed. The memory region size is 1M.
119762306a36Sopenharmony_ci * If host wants to access 0xX12345 at target, then CPU_ADDR_MSB[3:0]
119862306a36Sopenharmony_ci * is 0xX.
119962306a36Sopenharmony_ci * The following MACROs are defined to get the 0xX and the size limit.
120062306a36Sopenharmony_ci */
120162306a36Sopenharmony_ci#define CPU_ADDR_MSB_REGION_MASK	GENMASK(23, 20)
120262306a36Sopenharmony_ci#define CPU_ADDR_MSB_REGION_VAL(X)	FIELD_GET(CPU_ADDR_MSB_REGION_MASK, X)
120362306a36Sopenharmony_ci#define REGION_ACCESS_SIZE_LIMIT	0x100000
120462306a36Sopenharmony_ci#define REGION_ACCESS_SIZE_MASK		(REGION_ACCESS_SIZE_LIMIT - 1)
120562306a36Sopenharmony_ci
120662306a36Sopenharmony_ci#endif /* _HW_H_ */
1207