treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / net / wireless / ti / wl18xx / wl18xx.h
blobb642e0c437bb30761002b22d185d495e2c8e36fb
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * This file is part of wl18xx
5 * Copyright (C) 2011 Texas Instruments Inc.
6 */
8 #ifndef __WL18XX_PRIV_H__
9 #define __WL18XX_PRIV_H__
11 #include "conf.h"
13 /* minimum FW required for driver */
14 #define WL18XX_CHIP_VER 8
15 #define WL18XX_IFTYPE_VER 9
16 #define WL18XX_MAJOR_VER WLCORE_FW_VER_IGNORE
17 #define WL18XX_SUBTYPE_VER WLCORE_FW_VER_IGNORE
18 #define WL18XX_MINOR_VER 58
20 #define WL18XX_CMD_MAX_SIZE 740
22 #define WL18XX_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
24 #define WL18XX_NUM_TX_DESCRIPTORS 32
25 #define WL18XX_NUM_RX_DESCRIPTORS 32
27 #define WL18XX_NUM_MAC_ADDRESSES 2
29 #define WL18XX_RX_BA_MAX_SESSIONS 13
31 #define WL18XX_MAX_AP_STATIONS 10
32 #define WL18XX_MAX_LINKS 16
34 struct wl18xx_priv {
35 /* buffer for sending commands to FW */
36 u8 cmd_buf[WL18XX_CMD_MAX_SIZE];
38 struct wl18xx_priv_conf conf;
40 /* Index of last released Tx desc in FW */
41 u8 last_fw_rls_idx;
43 /* number of keys requiring extra spare mem-blocks */
44 int extra_spare_key_count;
47 #define WL18XX_FW_MAX_TX_STATUS_DESC 33
49 struct wl18xx_fw_status_priv {
51 * Index in released_tx_desc for first byte that holds
52 * released tx host desc
54 u8 fw_release_idx;
57 * Array of host Tx descriptors, where fw_release_idx
58 * indicated the first released idx.
60 u8 released_tx_desc[WL18XX_FW_MAX_TX_STATUS_DESC];
62 /* A bitmap representing the currently suspended links. The suspend
63 * is short lived, for multi-channel Tx requirements.
65 __le32 link_suspend_bitmap;
67 /* packet threshold for an "almost empty" AC,
68 * for Tx schedulng purposes
70 u8 tx_ac_threshold;
72 /* number of packets to queue up for a link in PS */
73 u8 tx_ps_threshold;
75 /* number of packet to queue up for a suspended link */
76 u8 tx_suspend_threshold;
78 /* Should have less than this number of packets in queue of a slow
79 * link to qualify as high priority link
81 u8 tx_slow_link_prio_threshold;
83 /* Should have less than this number of packets in queue of a fast
84 * link to qualify as high priority link
86 u8 tx_fast_link_prio_threshold;
88 /* Should have less than this number of packets in queue of a slow
89 * link before we stop queuing up packets for it.
91 u8 tx_slow_stop_threshold;
93 /* Should have less than this number of packets in queue of a fast
94 * link before we stop queuing up packets for it.
96 u8 tx_fast_stop_threshold;
98 u8 padding[3];
101 struct wl18xx_fw_packet_counters {
102 /* Cumulative counter of released packets per AC */
103 u8 tx_released_pkts[NUM_TX_QUEUES];
105 /* Cumulative counter of freed packets per HLID */
106 u8 tx_lnk_free_pkts[WL18XX_MAX_LINKS];
108 /* Cumulative counter of released Voice memory blocks */
109 u8 tx_voice_released_blks;
111 /* Tx rate of the last transmitted packet */
112 u8 tx_last_rate;
114 /* Tx rate or Tx rate estimate pre-calculated by fw in mbps units */
115 u8 tx_last_rate_mbps;
117 /* hlid for which the rates were reported */
118 u8 hlid;
119 } __packed;
121 /* FW status registers */
122 struct wl18xx_fw_status {
123 __le32 intr;
124 u8 fw_rx_counter;
125 u8 drv_rx_counter;
126 u8 reserved;
127 u8 tx_results_counter;
128 __le32 rx_pkt_descs[WL18XX_NUM_RX_DESCRIPTORS];
130 __le32 fw_localtime;
133 * A bitmap (where each bit represents a single HLID)
134 * to indicate if the station is in PS mode.
136 __le32 link_ps_bitmap;
139 * A bitmap (where each bit represents a single HLID) to indicate
140 * if the station is in Fast mode
142 __le32 link_fast_bitmap;
144 /* Cumulative counter of total released mem blocks since FW-reset */
145 __le32 total_released_blks;
147 /* Size (in Memory Blocks) of TX pool */
148 __le32 tx_total;
150 struct wl18xx_fw_packet_counters counters;
152 __le32 log_start_addr;
154 /* Private status to be used by the lower drivers */
155 struct wl18xx_fw_status_priv priv;
156 } __packed;
158 #define WL18XX_PHY_VERSION_MAX_LEN 20
160 struct wl18xx_static_data_priv {
161 char phy_version[WL18XX_PHY_VERSION_MAX_LEN];
164 struct wl18xx_clk_cfg {
165 u32 n;
166 u32 m;
167 u32 p;
168 u32 q;
169 bool swallow;
172 enum {
173 CLOCK_CONFIG_16_2_M = 1,
174 CLOCK_CONFIG_16_368_M,
175 CLOCK_CONFIG_16_8_M,
176 CLOCK_CONFIG_19_2_M,
177 CLOCK_CONFIG_26_M,
178 CLOCK_CONFIG_32_736_M,
179 CLOCK_CONFIG_33_6_M,
180 CLOCK_CONFIG_38_468_M,
181 CLOCK_CONFIG_52_M,
183 NUM_CLOCK_CONFIGS,
186 #endif /* __WL18XX_PRIV_H__ */