1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * This file is part of wl18xx
4  *
5  * Copyright (C) 2011 Texas Instruments Inc.
6  */
7 
8 #ifndef __WL18XX_CONF_H__
9 #define __WL18XX_CONF_H__
10 
11 #define WL18XX_CONF_MAGIC	0x10e100ca
12 #define WL18XX_CONF_VERSION	(WLCORE_CONF_VERSION | 0x0007)
13 #define WL18XX_CONF_MASK	0x0000ffff
14 #define WL18XX_CONF_SIZE	(WLCORE_CONF_SIZE + \
15 				 sizeof(struct wl18xx_priv_conf))
16 
17 #define NUM_OF_CHANNELS_11_ABG 150
18 #define NUM_OF_CHANNELS_11_P 7
19 #define SRF_TABLE_LEN 16
20 #define PIN_MUXING_SIZE 2
21 #define WL18XX_TRACE_LOSS_GAPS_TX 10
22 #define WL18XX_TRACE_LOSS_GAPS_RX 18
23 
24 struct wl18xx_mac_and_phy_params {
25 	u8 phy_standalone;
26 	u8 spare0;
27 	u8 enable_clpc;
28 	u8 enable_tx_low_pwr_on_siso_rdl;
29 	u8 auto_detect;
30 	u8 dedicated_fem;
31 
32 	u8 low_band_component;
33 
34 	/* Bit 0: One Hot, Bit 1: Control Enable, Bit 2: 1.8V, Bit 3: 3V */
35 	u8 low_band_component_type;
36 
37 	u8 high_band_component;
38 
39 	/* Bit 0: One Hot, Bit 1: Control Enable, Bit 2: 1.8V, Bit 3: 3V */
40 	u8 high_band_component_type;
41 	u8 number_of_assembled_ant2_4;
42 	u8 number_of_assembled_ant5;
43 	u8 pin_muxing_platform_options[PIN_MUXING_SIZE];
44 	u8 external_pa_dc2dc;
45 	u8 tcxo_ldo_voltage;
46 	u8 xtal_itrim_val;
47 	u8 srf_state;
48 	u8 srf1[SRF_TABLE_LEN];
49 	u8 srf2[SRF_TABLE_LEN];
50 	u8 srf3[SRF_TABLE_LEN];
51 	u8 io_configuration;
52 	u8 sdio_configuration;
53 	u8 settings;
54 	u8 rx_profile;
55 	u8 per_chan_pwr_limit_arr_11abg[NUM_OF_CHANNELS_11_ABG];
56 	u8 pwr_limit_reference_11_abg;
57 	u8 per_chan_pwr_limit_arr_11p[NUM_OF_CHANNELS_11_P];
58 	u8 pwr_limit_reference_11p;
59 	u8 spare1;
60 	u8 per_chan_bo_mode_11_abg[13];
61 	u8 per_chan_bo_mode_11_p[4];
62 	u8 primary_clock_setting_time;
63 	u8 clock_valid_on_wake_up;
64 	u8 secondary_clock_setting_time;
65 	u8 board_type;
66 	/* enable point saturation */
67 	u8 psat;
68 	/* low/medium/high Tx power in dBm for STA-HP BG */
69 	s8 low_power_val;
70 	s8 med_power_val;
71 	s8 high_power_val;
72 	s8 per_sub_band_tx_trace_loss[WL18XX_TRACE_LOSS_GAPS_TX];
73 	s8 per_sub_band_rx_trace_loss[WL18XX_TRACE_LOSS_GAPS_RX];
74 	u8 tx_rf_margin;
75 	/* low/medium/high Tx power in dBm for other role */
76 	s8 low_power_val_2nd;
77 	s8 med_power_val_2nd;
78 	s8 high_power_val_2nd;
79 
80 	u8 padding[1];
81 } __packed;
82 
83 enum wl18xx_ht_mode {
84 	/* Default - use MIMO, fallback to SISO20 */
85 	HT_MODE_DEFAULT = 0,
86 
87 	/* Wide - use SISO40 */
88 	HT_MODE_WIDE = 1,
89 
90 	/* Use SISO20 */
91 	HT_MODE_SISO20 = 2,
92 };
93 
94 struct wl18xx_ht_settings {
95 	/* DEFAULT / WIDE / SISO20 */
96 	u8 mode;
97 } __packed;
98 
99 struct conf_ap_sleep_settings {
100 	/* Duty Cycle (20-80% of staying Awake) for IDLE AP
101 	 * (0: disable)
102 	 */
103 	u8 idle_duty_cycle;
104 	/* Duty Cycle (20-80% of staying Awake) for Connected AP
105 	 * (0: disable)
106 	 */
107 	u8 connected_duty_cycle;
108 	/* Maximum stations that are allowed to be connected to AP
109 	 *  (255: no limit)
110 	 */
111 	u8 max_stations_thresh;
112 	/* Timeout till enabling the Sleep Mechanism after data stops
113 	 * [unit: 100 msec]
114 	 */
115 	u8 idle_conn_thresh;
116 } __packed;
117 
118 struct wl18xx_priv_conf {
119 	/* Module params structures */
120 	struct wl18xx_ht_settings ht;
121 
122 	/* this structure is copied wholesale to FW */
123 	struct wl18xx_mac_and_phy_params phy;
124 
125 	struct conf_ap_sleep_settings ap_sleep;
126 } __packed;
127 
128 enum wl18xx_sg_params {
129 	WL18XX_CONF_SG_PARAM_0 = 0,
130 
131 	/* Configuration Parameters */
132 	WL18XX_CONF_SG_ANTENNA_CONFIGURATION,
133 	WL18XX_CONF_SG_ZIGBEE_COEX,
134 	WL18XX_CONF_SG_TIME_SYNC,
135 
136 	WL18XX_CONF_SG_PARAM_4,
137 	WL18XX_CONF_SG_PARAM_5,
138 	WL18XX_CONF_SG_PARAM_6,
139 	WL18XX_CONF_SG_PARAM_7,
140 	WL18XX_CONF_SG_PARAM_8,
141 	WL18XX_CONF_SG_PARAM_9,
142 	WL18XX_CONF_SG_PARAM_10,
143 	WL18XX_CONF_SG_PARAM_11,
144 	WL18XX_CONF_SG_PARAM_12,
145 	WL18XX_CONF_SG_PARAM_13,
146 	WL18XX_CONF_SG_PARAM_14,
147 	WL18XX_CONF_SG_PARAM_15,
148 	WL18XX_CONF_SG_PARAM_16,
149 	WL18XX_CONF_SG_PARAM_17,
150 	WL18XX_CONF_SG_PARAM_18,
151 	WL18XX_CONF_SG_PARAM_19,
152 	WL18XX_CONF_SG_PARAM_20,
153 	WL18XX_CONF_SG_PARAM_21,
154 	WL18XX_CONF_SG_PARAM_22,
155 	WL18XX_CONF_SG_PARAM_23,
156 	WL18XX_CONF_SG_PARAM_24,
157 	WL18XX_CONF_SG_PARAM_25,
158 
159 	/* Active Scan Parameters */
160 	WL18XX_CONF_SG_AUTO_SCAN_PROBE_REQ,
161 	WL18XX_CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_HV3,
162 
163 	WL18XX_CONF_SG_PARAM_28,
164 
165 	/* Passive Scan Parameters */
166 	WL18XX_CONF_SG_PARAM_29,
167 	WL18XX_CONF_SG_PARAM_30,
168 	WL18XX_CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_HV3,
169 
170 	/* Passive Scan in Dual Antenna Parameters */
171 	WL18XX_CONF_SG_CONSECUTIVE_HV3_IN_PASSIVE_SCAN,
172 	WL18XX_CONF_SG_BEACON_HV3_COLL_TH_IN_PASSIVE_SCAN,
173 	WL18XX_CONF_SG_TX_RX_PROTECT_BW_IN_PASSIVE_SCAN,
174 
175 	/* General Parameters */
176 	WL18XX_CONF_SG_STA_FORCE_PS_IN_BT_SCO,
177 	WL18XX_CONF_SG_PARAM_36,
178 	WL18XX_CONF_SG_BEACON_MISS_PERCENT,
179 	WL18XX_CONF_SG_PARAM_38,
180 	WL18XX_CONF_SG_RXT,
181 	WL18XX_CONF_SG_UNUSED,
182 	WL18XX_CONF_SG_ADAPTIVE_RXT_TXT,
183 	WL18XX_CONF_SG_GENERAL_USAGE_BIT_MAP,
184 	WL18XX_CONF_SG_HV3_MAX_SERVED,
185 	WL18XX_CONF_SG_PARAM_44,
186 	WL18XX_CONF_SG_PARAM_45,
187 	WL18XX_CONF_SG_CONSECUTIVE_CTS_THRESHOLD,
188 	WL18XX_CONF_SG_GEMINI_PARAM_47,
189 	WL18XX_CONF_SG_STA_CONNECTION_PROTECTION_TIME,
190 
191 	/* AP Parameters */
192 	WL18XX_CONF_SG_AP_BEACON_MISS_TX,
193 	WL18XX_CONF_SG_PARAM_50,
194 	WL18XX_CONF_SG_AP_BEACON_WINDOW_INTERVAL,
195 	WL18XX_CONF_SG_AP_CONNECTION_PROTECTION_TIME,
196 	WL18XX_CONF_SG_PARAM_53,
197 	WL18XX_CONF_SG_PARAM_54,
198 
199 	/* CTS Diluting Parameters */
200 	WL18XX_CONF_SG_CTS_DILUTED_BAD_RX_PACKETS_TH,
201 	WL18XX_CONF_SG_CTS_CHOP_IN_DUAL_ANT_SCO_MASTER,
202 
203 	WL18XX_CONF_SG_TEMP_PARAM_1,
204 	WL18XX_CONF_SG_TEMP_PARAM_2,
205 	WL18XX_CONF_SG_TEMP_PARAM_3,
206 	WL18XX_CONF_SG_TEMP_PARAM_4,
207 	WL18XX_CONF_SG_TEMP_PARAM_5,
208 	WL18XX_CONF_SG_TEMP_PARAM_6,
209 	WL18XX_CONF_SG_TEMP_PARAM_7,
210 	WL18XX_CONF_SG_TEMP_PARAM_8,
211 	WL18XX_CONF_SG_TEMP_PARAM_9,
212 	WL18XX_CONF_SG_TEMP_PARAM_10,
213 
214 	WL18XX_CONF_SG_PARAMS_MAX,
215 	WL18XX_CONF_SG_PARAMS_ALL = 0xff
216 };
217 
218 #endif /* __WL18XX_CONF_H__ */
219