18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * This file is part of wl18xx 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Texas Instruments Inc. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef __WL18XX_PRIV_H__ 98c2ecf20Sopenharmony_ci#define __WL18XX_PRIV_H__ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include "conf.h" 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* minimum FW required for driver */ 148c2ecf20Sopenharmony_ci#define WL18XX_CHIP_VER 8 158c2ecf20Sopenharmony_ci#define WL18XX_IFTYPE_VER 9 168c2ecf20Sopenharmony_ci#define WL18XX_MAJOR_VER WLCORE_FW_VER_IGNORE 178c2ecf20Sopenharmony_ci#define WL18XX_SUBTYPE_VER WLCORE_FW_VER_IGNORE 188c2ecf20Sopenharmony_ci#define WL18XX_MINOR_VER 58 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define WL18XX_CMD_MAX_SIZE 740 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define WL18XX_AGGR_BUFFER_SIZE (13 * PAGE_SIZE) 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define WL18XX_NUM_TX_DESCRIPTORS 32 258c2ecf20Sopenharmony_ci#define WL18XX_NUM_RX_DESCRIPTORS 32 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define WL18XX_NUM_MAC_ADDRESSES 2 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define WL18XX_RX_BA_MAX_SESSIONS 13 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define WL18XX_MAX_AP_STATIONS 10 328c2ecf20Sopenharmony_ci#define WL18XX_MAX_LINKS 16 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistruct wl18xx_priv { 358c2ecf20Sopenharmony_ci /* buffer for sending commands to FW */ 368c2ecf20Sopenharmony_ci u8 cmd_buf[WL18XX_CMD_MAX_SIZE]; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci struct wl18xx_priv_conf conf; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci /* Index of last released Tx desc in FW */ 418c2ecf20Sopenharmony_ci u8 last_fw_rls_idx; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci /* number of keys requiring extra spare mem-blocks */ 448c2ecf20Sopenharmony_ci int extra_spare_key_count; 458c2ecf20Sopenharmony_ci}; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define WL18XX_FW_MAX_TX_STATUS_DESC 33 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_cistruct wl18xx_fw_status_priv { 508c2ecf20Sopenharmony_ci /* 518c2ecf20Sopenharmony_ci * Index in released_tx_desc for first byte that holds 528c2ecf20Sopenharmony_ci * released tx host desc 538c2ecf20Sopenharmony_ci */ 548c2ecf20Sopenharmony_ci u8 fw_release_idx; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci /* 578c2ecf20Sopenharmony_ci * Array of host Tx descriptors, where fw_release_idx 588c2ecf20Sopenharmony_ci * indicated the first released idx. 598c2ecf20Sopenharmony_ci */ 608c2ecf20Sopenharmony_ci u8 released_tx_desc[WL18XX_FW_MAX_TX_STATUS_DESC]; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci /* A bitmap representing the currently suspended links. The suspend 638c2ecf20Sopenharmony_ci * is short lived, for multi-channel Tx requirements. 648c2ecf20Sopenharmony_ci */ 658c2ecf20Sopenharmony_ci __le32 link_suspend_bitmap; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci /* packet threshold for an "almost empty" AC, 688c2ecf20Sopenharmony_ci * for Tx schedulng purposes 698c2ecf20Sopenharmony_ci */ 708c2ecf20Sopenharmony_ci u8 tx_ac_threshold; 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci /* number of packets to queue up for a link in PS */ 738c2ecf20Sopenharmony_ci u8 tx_ps_threshold; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci /* number of packet to queue up for a suspended link */ 768c2ecf20Sopenharmony_ci u8 tx_suspend_threshold; 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci /* Should have less than this number of packets in queue of a slow 798c2ecf20Sopenharmony_ci * link to qualify as high priority link 808c2ecf20Sopenharmony_ci */ 818c2ecf20Sopenharmony_ci u8 tx_slow_link_prio_threshold; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci /* Should have less than this number of packets in queue of a fast 848c2ecf20Sopenharmony_ci * link to qualify as high priority link 858c2ecf20Sopenharmony_ci */ 868c2ecf20Sopenharmony_ci u8 tx_fast_link_prio_threshold; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci /* Should have less than this number of packets in queue of a slow 898c2ecf20Sopenharmony_ci * link before we stop queuing up packets for it. 908c2ecf20Sopenharmony_ci */ 918c2ecf20Sopenharmony_ci u8 tx_slow_stop_threshold; 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci /* Should have less than this number of packets in queue of a fast 948c2ecf20Sopenharmony_ci * link before we stop queuing up packets for it. 958c2ecf20Sopenharmony_ci */ 968c2ecf20Sopenharmony_ci u8 tx_fast_stop_threshold; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci u8 padding[3]; 998c2ecf20Sopenharmony_ci}; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_cistruct wl18xx_fw_packet_counters { 1028c2ecf20Sopenharmony_ci /* Cumulative counter of released packets per AC */ 1038c2ecf20Sopenharmony_ci u8 tx_released_pkts[NUM_TX_QUEUES]; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci /* Cumulative counter of freed packets per HLID */ 1068c2ecf20Sopenharmony_ci u8 tx_lnk_free_pkts[WL18XX_MAX_LINKS]; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci /* Cumulative counter of released Voice memory blocks */ 1098c2ecf20Sopenharmony_ci u8 tx_voice_released_blks; 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci /* Tx rate of the last transmitted packet */ 1128c2ecf20Sopenharmony_ci u8 tx_last_rate; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci /* Tx rate or Tx rate estimate pre-calculated by fw in mbps units */ 1158c2ecf20Sopenharmony_ci u8 tx_last_rate_mbps; 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci /* hlid for which the rates were reported */ 1188c2ecf20Sopenharmony_ci u8 hlid; 1198c2ecf20Sopenharmony_ci} __packed; 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci/* FW status registers */ 1228c2ecf20Sopenharmony_cistruct wl18xx_fw_status { 1238c2ecf20Sopenharmony_ci __le32 intr; 1248c2ecf20Sopenharmony_ci u8 fw_rx_counter; 1258c2ecf20Sopenharmony_ci u8 drv_rx_counter; 1268c2ecf20Sopenharmony_ci u8 reserved; 1278c2ecf20Sopenharmony_ci u8 tx_results_counter; 1288c2ecf20Sopenharmony_ci __le32 rx_pkt_descs[WL18XX_NUM_RX_DESCRIPTORS]; 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci __le32 fw_localtime; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci /* 1338c2ecf20Sopenharmony_ci * A bitmap (where each bit represents a single HLID) 1348c2ecf20Sopenharmony_ci * to indicate if the station is in PS mode. 1358c2ecf20Sopenharmony_ci */ 1368c2ecf20Sopenharmony_ci __le32 link_ps_bitmap; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci /* 1398c2ecf20Sopenharmony_ci * A bitmap (where each bit represents a single HLID) to indicate 1408c2ecf20Sopenharmony_ci * if the station is in Fast mode 1418c2ecf20Sopenharmony_ci */ 1428c2ecf20Sopenharmony_ci __le32 link_fast_bitmap; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci /* Cumulative counter of total released mem blocks since FW-reset */ 1458c2ecf20Sopenharmony_ci __le32 total_released_blks; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci /* Size (in Memory Blocks) of TX pool */ 1488c2ecf20Sopenharmony_ci __le32 tx_total; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci struct wl18xx_fw_packet_counters counters; 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci __le32 log_start_addr; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci /* Private status to be used by the lower drivers */ 1558c2ecf20Sopenharmony_ci struct wl18xx_fw_status_priv priv; 1568c2ecf20Sopenharmony_ci} __packed; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci#define WL18XX_PHY_VERSION_MAX_LEN 20 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_cistruct wl18xx_static_data_priv { 1618c2ecf20Sopenharmony_ci char phy_version[WL18XX_PHY_VERSION_MAX_LEN]; 1628c2ecf20Sopenharmony_ci}; 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_cistruct wl18xx_clk_cfg { 1658c2ecf20Sopenharmony_ci u32 n; 1668c2ecf20Sopenharmony_ci u32 m; 1678c2ecf20Sopenharmony_ci u32 p; 1688c2ecf20Sopenharmony_ci u32 q; 1698c2ecf20Sopenharmony_ci bool swallow; 1708c2ecf20Sopenharmony_ci}; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_cienum { 1738c2ecf20Sopenharmony_ci CLOCK_CONFIG_16_2_M = 1, 1748c2ecf20Sopenharmony_ci CLOCK_CONFIG_16_368_M, 1758c2ecf20Sopenharmony_ci CLOCK_CONFIG_16_8_M, 1768c2ecf20Sopenharmony_ci CLOCK_CONFIG_19_2_M, 1778c2ecf20Sopenharmony_ci CLOCK_CONFIG_26_M, 1788c2ecf20Sopenharmony_ci CLOCK_CONFIG_32_736_M, 1798c2ecf20Sopenharmony_ci CLOCK_CONFIG_33_6_M, 1808c2ecf20Sopenharmony_ci CLOCK_CONFIG_38_468_M, 1818c2ecf20Sopenharmony_ci CLOCK_CONFIG_52_M, 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci NUM_CLOCK_CONFIGS, 1848c2ecf20Sopenharmony_ci}; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#endif /* __WL18XX_PRIV_H__ */ 187