18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: BSD-3-Clause-Clear */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#ifndef ATH11K_HW_H 78c2ecf20Sopenharmony_ci#define ATH11K_HW_H 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include "wmi.h" 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* Target configuration defines */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* Num VDEVS per radio */ 148c2ecf20Sopenharmony_ci#define TARGET_NUM_VDEVS (16 + 1) 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#define TARGET_NUM_PEERS_PDEV (512 + TARGET_NUM_VDEVS) 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* Num of peers for Single Radio mode */ 198c2ecf20Sopenharmony_ci#define TARGET_NUM_PEERS_SINGLE (TARGET_NUM_PEERS_PDEV) 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/* Num of peers for DBS */ 228c2ecf20Sopenharmony_ci#define TARGET_NUM_PEERS_DBS (2 * TARGET_NUM_PEERS_PDEV) 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* Num of peers for DBS_SBS */ 258c2ecf20Sopenharmony_ci#define TARGET_NUM_PEERS_DBS_SBS (3 * TARGET_NUM_PEERS_PDEV) 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* Max num of stations (per radio) */ 288c2ecf20Sopenharmony_ci#define TARGET_NUM_STATIONS 512 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define TARGET_NUM_PEERS(x) TARGET_NUM_PEERS_##x 318c2ecf20Sopenharmony_ci#define TARGET_NUM_PEER_KEYS 2 328c2ecf20Sopenharmony_ci#define TARGET_NUM_TIDS(x) (2 * TARGET_NUM_PEERS(x) + \ 338c2ecf20Sopenharmony_ci 4 * TARGET_NUM_VDEVS + 8) 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define TARGET_AST_SKID_LIMIT 16 368c2ecf20Sopenharmony_ci#define TARGET_NUM_OFFLD_PEERS 4 378c2ecf20Sopenharmony_ci#define TARGET_NUM_OFFLD_REORDER_BUFFS 4 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define TARGET_TX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(4)) 408c2ecf20Sopenharmony_ci#define TARGET_RX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(4)) 418c2ecf20Sopenharmony_ci#define TARGET_RX_TIMEOUT_LO_PRI 100 428c2ecf20Sopenharmony_ci#define TARGET_RX_TIMEOUT_HI_PRI 40 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define TARGET_DECAP_MODE_RAW 0 458c2ecf20Sopenharmony_ci#define TARGET_DECAP_MODE_NATIVE_WIFI 1 468c2ecf20Sopenharmony_ci#define TARGET_DECAP_MODE_ETH 2 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define TARGET_SCAN_MAX_PENDING_REQS 4 498c2ecf20Sopenharmony_ci#define TARGET_BMISS_OFFLOAD_MAX_VDEV 3 508c2ecf20Sopenharmony_ci#define TARGET_ROAM_OFFLOAD_MAX_VDEV 3 518c2ecf20Sopenharmony_ci#define TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES 8 528c2ecf20Sopenharmony_ci#define TARGET_GTK_OFFLOAD_MAX_VDEV 3 538c2ecf20Sopenharmony_ci#define TARGET_NUM_MCAST_GROUPS 12 548c2ecf20Sopenharmony_ci#define TARGET_NUM_MCAST_TABLE_ELEMS 64 558c2ecf20Sopenharmony_ci#define TARGET_MCAST2UCAST_MODE 2 568c2ecf20Sopenharmony_ci#define TARGET_TX_DBG_LOG_SIZE 1024 578c2ecf20Sopenharmony_ci#define TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1 588c2ecf20Sopenharmony_ci#define TARGET_VOW_CONFIG 0 598c2ecf20Sopenharmony_ci#define TARGET_NUM_MSDU_DESC (2500) 608c2ecf20Sopenharmony_ci#define TARGET_MAX_FRAG_ENTRIES 6 618c2ecf20Sopenharmony_ci#define TARGET_MAX_BCN_OFFLD 16 628c2ecf20Sopenharmony_ci#define TARGET_NUM_WDS_ENTRIES 32 638c2ecf20Sopenharmony_ci#define TARGET_DMA_BURST_SIZE 1 648c2ecf20Sopenharmony_ci#define TARGET_RX_BATCHMODE 1 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#define ATH11K_HW_MAX_QUEUES 4 678c2ecf20Sopenharmony_ci#define ATH11K_QUEUE_LEN 4096 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define ATH11k_HW_RATECODE_CCK_SHORT_PREAM_MASK 0x4 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#define ATH11K_FW_DIR "ath11k" 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define ATH11K_BOARD_MAGIC "QCA-ATH11K-BOARD" 748c2ecf20Sopenharmony_ci#define ATH11K_BOARD_API2_FILE "board-2.bin" 758c2ecf20Sopenharmony_ci#define ATH11K_DEFAULT_BOARD_FILE "board.bin" 768c2ecf20Sopenharmony_ci#define ATH11K_DEFAULT_CAL_FILE "caldata.bin" 778c2ecf20Sopenharmony_ci#define ATH11K_AMSS_FILE "amss.bin" 788c2ecf20Sopenharmony_ci#define ATH11K_M3_FILE "m3.bin" 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_cienum ath11k_hw_rate_cck { 818c2ecf20Sopenharmony_ci ATH11K_HW_RATE_CCK_LP_11M = 0, 828c2ecf20Sopenharmony_ci ATH11K_HW_RATE_CCK_LP_5_5M, 838c2ecf20Sopenharmony_ci ATH11K_HW_RATE_CCK_LP_2M, 848c2ecf20Sopenharmony_ci ATH11K_HW_RATE_CCK_LP_1M, 858c2ecf20Sopenharmony_ci ATH11K_HW_RATE_CCK_SP_11M, 868c2ecf20Sopenharmony_ci ATH11K_HW_RATE_CCK_SP_5_5M, 878c2ecf20Sopenharmony_ci ATH11K_HW_RATE_CCK_SP_2M, 888c2ecf20Sopenharmony_ci}; 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_cienum ath11k_hw_rate_ofdm { 918c2ecf20Sopenharmony_ci ATH11K_HW_RATE_OFDM_48M = 0, 928c2ecf20Sopenharmony_ci ATH11K_HW_RATE_OFDM_24M, 938c2ecf20Sopenharmony_ci ATH11K_HW_RATE_OFDM_12M, 948c2ecf20Sopenharmony_ci ATH11K_HW_RATE_OFDM_6M, 958c2ecf20Sopenharmony_ci ATH11K_HW_RATE_OFDM_54M, 968c2ecf20Sopenharmony_ci ATH11K_HW_RATE_OFDM_36M, 978c2ecf20Sopenharmony_ci ATH11K_HW_RATE_OFDM_18M, 988c2ecf20Sopenharmony_ci ATH11K_HW_RATE_OFDM_9M, 998c2ecf20Sopenharmony_ci}; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_cienum ath11k_bus { 1028c2ecf20Sopenharmony_ci ATH11K_BUS_AHB, 1038c2ecf20Sopenharmony_ci ATH11K_BUS_PCI, 1048c2ecf20Sopenharmony_ci}; 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#define ATH11K_EXT_IRQ_GRP_NUM_MAX 11 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_cistruct ath11k_hw_ring_mask { 1098c2ecf20Sopenharmony_ci u8 tx[ATH11K_EXT_IRQ_GRP_NUM_MAX]; 1108c2ecf20Sopenharmony_ci u8 rx_mon_status[ATH11K_EXT_IRQ_GRP_NUM_MAX]; 1118c2ecf20Sopenharmony_ci u8 rx[ATH11K_EXT_IRQ_GRP_NUM_MAX]; 1128c2ecf20Sopenharmony_ci u8 rx_err[ATH11K_EXT_IRQ_GRP_NUM_MAX]; 1138c2ecf20Sopenharmony_ci u8 rx_wbm_rel[ATH11K_EXT_IRQ_GRP_NUM_MAX]; 1148c2ecf20Sopenharmony_ci u8 reo_status[ATH11K_EXT_IRQ_GRP_NUM_MAX]; 1158c2ecf20Sopenharmony_ci u8 rxdma2host[ATH11K_EXT_IRQ_GRP_NUM_MAX]; 1168c2ecf20Sopenharmony_ci u8 host2rxdma[ATH11K_EXT_IRQ_GRP_NUM_MAX]; 1178c2ecf20Sopenharmony_ci}; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_cistruct ath11k_hw_params { 1208c2ecf20Sopenharmony_ci const char *name; 1218c2ecf20Sopenharmony_ci u16 hw_rev; 1228c2ecf20Sopenharmony_ci u8 max_radios; 1238c2ecf20Sopenharmony_ci u32 bdf_addr; 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci struct { 1268c2ecf20Sopenharmony_ci const char *dir; 1278c2ecf20Sopenharmony_ci size_t board_size; 1288c2ecf20Sopenharmony_ci size_t cal_size; 1298c2ecf20Sopenharmony_ci } fw; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci const struct ath11k_hw_ops *hw_ops; 1328c2ecf20Sopenharmony_ci const struct ath11k_hw_ring_mask *ring_mask; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci bool internal_sleep_clock; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci const struct ath11k_hw_regs *regs; 1378c2ecf20Sopenharmony_ci const struct ce_attr *host_ce_config; 1388c2ecf20Sopenharmony_ci u32 ce_count; 1398c2ecf20Sopenharmony_ci const struct ce_pipe_config *target_ce_config; 1408c2ecf20Sopenharmony_ci u32 target_ce_count; 1418c2ecf20Sopenharmony_ci const struct service_to_pipe *svc_to_ce_map; 1428c2ecf20Sopenharmony_ci u32 svc_to_ce_map_len; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci bool single_pdev_only; 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci /* For example on QCA6390 struct 1478c2ecf20Sopenharmony_ci * wmi_init_cmd_param::band_to_mac_config needs to be false as the 1488c2ecf20Sopenharmony_ci * firmware creates the mapping. 1498c2ecf20Sopenharmony_ci */ 1508c2ecf20Sopenharmony_ci bool needs_band_to_mac; 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci bool rxdma1_enable; 1538c2ecf20Sopenharmony_ci int num_rxmda_per_pdev; 1548c2ecf20Sopenharmony_ci bool rx_mac_buf_ring; 1558c2ecf20Sopenharmony_ci bool vdev_start_delay; 1568c2ecf20Sopenharmony_ci bool htt_peer_map_v2; 1578c2ecf20Sopenharmony_ci bool tcl_0_only; 1588c2ecf20Sopenharmony_ci u8 spectral_fft_sz; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci u16 interface_modes; 1618c2ecf20Sopenharmony_ci bool supports_monitor; 1628c2ecf20Sopenharmony_ci bool supports_shadow_regs; 1638c2ecf20Sopenharmony_ci bool idle_ps; 1648c2ecf20Sopenharmony_ci}; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_cistruct ath11k_hw_ops { 1678c2ecf20Sopenharmony_ci u8 (*get_hw_mac_from_pdev_id)(int pdev_id); 1688c2ecf20Sopenharmony_ci void (*wmi_init_config)(struct ath11k_base *ab, 1698c2ecf20Sopenharmony_ci struct target_resource_config *config); 1708c2ecf20Sopenharmony_ci int (*mac_id_to_pdev_id)(struct ath11k_hw_params *hw, int mac_id); 1718c2ecf20Sopenharmony_ci int (*mac_id_to_srng_id)(struct ath11k_hw_params *hw, int mac_id); 1728c2ecf20Sopenharmony_ci}; 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ciextern const struct ath11k_hw_ops ipq8074_ops; 1758c2ecf20Sopenharmony_ciextern const struct ath11k_hw_ops ipq6018_ops; 1768c2ecf20Sopenharmony_ciextern const struct ath11k_hw_ops qca6390_ops; 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ciextern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ipq8074; 1798c2ecf20Sopenharmony_ciextern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_cistatic inline 1828c2ecf20Sopenharmony_ciint ath11k_hw_get_mac_from_pdev_id(struct ath11k_hw_params *hw, 1838c2ecf20Sopenharmony_ci int pdev_idx) 1848c2ecf20Sopenharmony_ci{ 1858c2ecf20Sopenharmony_ci if (hw->hw_ops->get_hw_mac_from_pdev_id) 1868c2ecf20Sopenharmony_ci return hw->hw_ops->get_hw_mac_from_pdev_id(pdev_idx); 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci return 0; 1898c2ecf20Sopenharmony_ci} 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_cistatic inline int ath11k_hw_mac_id_to_pdev_id(struct ath11k_hw_params *hw, 1928c2ecf20Sopenharmony_ci int mac_id) 1938c2ecf20Sopenharmony_ci{ 1948c2ecf20Sopenharmony_ci if (hw->hw_ops->mac_id_to_pdev_id) 1958c2ecf20Sopenharmony_ci return hw->hw_ops->mac_id_to_pdev_id(hw, mac_id); 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci return 0; 1988c2ecf20Sopenharmony_ci} 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_cistatic inline int ath11k_hw_mac_id_to_srng_id(struct ath11k_hw_params *hw, 2018c2ecf20Sopenharmony_ci int mac_id) 2028c2ecf20Sopenharmony_ci{ 2038c2ecf20Sopenharmony_ci if (hw->hw_ops->mac_id_to_srng_id) 2048c2ecf20Sopenharmony_ci return hw->hw_ops->mac_id_to_srng_id(hw, mac_id); 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci return 0; 2078c2ecf20Sopenharmony_ci} 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_cistruct ath11k_fw_ie { 2108c2ecf20Sopenharmony_ci __le32 id; 2118c2ecf20Sopenharmony_ci __le32 len; 2128c2ecf20Sopenharmony_ci u8 data[]; 2138c2ecf20Sopenharmony_ci}; 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_cienum ath11k_bd_ie_board_type { 2168c2ecf20Sopenharmony_ci ATH11K_BD_IE_BOARD_NAME = 0, 2178c2ecf20Sopenharmony_ci ATH11K_BD_IE_BOARD_DATA = 1, 2188c2ecf20Sopenharmony_ci}; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_cienum ath11k_bd_ie_type { 2218c2ecf20Sopenharmony_ci /* contains sub IEs of enum ath11k_bd_ie_board_type */ 2228c2ecf20Sopenharmony_ci ATH11K_BD_IE_BOARD = 0, 2238c2ecf20Sopenharmony_ci ATH11K_BD_IE_BOARD_EXT = 1, 2248c2ecf20Sopenharmony_ci}; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_cistruct ath11k_hw_regs { 2278c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_base_lsb; 2288c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_base_msb; 2298c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_id; 2308c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_misc; 2318c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_tp_addr_lsb; 2328c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_tp_addr_msb; 2338c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_consumer_int_setup_ix0; 2348c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_consumer_int_setup_ix1; 2358c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_msi1_base_lsb; 2368c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_msi1_base_msb; 2378c2ecf20Sopenharmony_ci u32 hal_tcl1_ring_msi1_data; 2388c2ecf20Sopenharmony_ci u32 hal_tcl2_ring_base_lsb; 2398c2ecf20Sopenharmony_ci u32 hal_tcl_ring_base_lsb; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci u32 hal_tcl_status_ring_base_lsb; 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci u32 hal_reo1_ring_base_lsb; 2448c2ecf20Sopenharmony_ci u32 hal_reo1_ring_base_msb; 2458c2ecf20Sopenharmony_ci u32 hal_reo1_ring_id; 2468c2ecf20Sopenharmony_ci u32 hal_reo1_ring_misc; 2478c2ecf20Sopenharmony_ci u32 hal_reo1_ring_hp_addr_lsb; 2488c2ecf20Sopenharmony_ci u32 hal_reo1_ring_hp_addr_msb; 2498c2ecf20Sopenharmony_ci u32 hal_reo1_ring_producer_int_setup; 2508c2ecf20Sopenharmony_ci u32 hal_reo1_ring_msi1_base_lsb; 2518c2ecf20Sopenharmony_ci u32 hal_reo1_ring_msi1_base_msb; 2528c2ecf20Sopenharmony_ci u32 hal_reo1_ring_msi1_data; 2538c2ecf20Sopenharmony_ci u32 hal_reo2_ring_base_lsb; 2548c2ecf20Sopenharmony_ci u32 hal_reo1_aging_thresh_ix_0; 2558c2ecf20Sopenharmony_ci u32 hal_reo1_aging_thresh_ix_1; 2568c2ecf20Sopenharmony_ci u32 hal_reo1_aging_thresh_ix_2; 2578c2ecf20Sopenharmony_ci u32 hal_reo1_aging_thresh_ix_3; 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci u32 hal_reo1_ring_hp; 2608c2ecf20Sopenharmony_ci u32 hal_reo1_ring_tp; 2618c2ecf20Sopenharmony_ci u32 hal_reo2_ring_hp; 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci u32 hal_reo_tcl_ring_base_lsb; 2648c2ecf20Sopenharmony_ci u32 hal_reo_tcl_ring_hp; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci u32 hal_reo_status_ring_base_lsb; 2678c2ecf20Sopenharmony_ci u32 hal_reo_status_hp; 2688c2ecf20Sopenharmony_ci}; 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ciextern const struct ath11k_hw_regs ipq8074_regs; 2718c2ecf20Sopenharmony_ciextern const struct ath11k_hw_regs qca6390_regs; 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci#endif 274