aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1271_cmd.c
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2010-02-18 06:25:42 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-02-19 15:52:43 -0500
commit152ee6e09e2ce54d7d1cc9d338b82c0bf3cbbc95 (patch)
treed6f9ffed8d59cc257f2dfd884337f946a212ea3b /drivers/net/wireless/wl12xx/wl1271_cmd.c
parentc6999d831ab9ae5e368b20f3bc11b0ca9c17a7ec (diff)
wl1271: Use NVS INI file configuration
Replace the hardcoded general and radio parameter configuration in the driver with configuration taken from the NVS file directly. Also remove the driver dependency to the structures with the parameter data. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_cmd.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c117
1 files changed, 18 insertions, 99 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index dd2b5f0540a5..54b5124fc0c0 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -191,43 +191,19 @@ static int wl1271_cmd_cal(struct wl1271 *wl)
191int wl1271_cmd_general_parms(struct wl1271 *wl) 191int wl1271_cmd_general_parms(struct wl1271 *wl)
192{ 192{
193 struct wl1271_general_parms_cmd *gen_parms; 193 struct wl1271_general_parms_cmd *gen_parms;
194 struct conf_general_parms *g = &wl->conf.init.genparam;
195 int ret; 194 int ret;
196 195
196 if (!wl->nvs)
197 return -ENODEV;
198
197 gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); 199 gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
198 if (!gen_parms) 200 if (!gen_parms)
199 return -ENOMEM; 201 return -ENOMEM;
200 202
201 gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; 203 gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM;
202 204
203 gen_parms->ref_clk = g->ref_clk; 205 memcpy(gen_parms->params, wl->nvs->general_params,
204 gen_parms->settling_time = g->settling_time; 206 WL1271_NVS_GENERAL_PARAMS_SIZE);
205 gen_parms->clk_valid_on_wakeup = g->clk_valid_on_wakeup;
206 gen_parms->dc2dcmode = g->dc2dcmode;
207 gen_parms->single_dual_band = g->single_dual_band;
208 gen_parms->tx_bip_fem_autodetect = g->tx_bip_fem_autodetect;
209 gen_parms->tx_bip_fem_manufacturer = g->tx_bip_fem_manufacturer;
210 gen_parms->settings = g->settings;
211
212 gen_parms->sr_state = g->sr_state;
213
214 memcpy(gen_parms->srf1,
215 g->srf1,
216 CONF_MAX_SMART_REFLEX_PARAMS);
217 memcpy(gen_parms->srf2,
218 g->srf2,
219 CONF_MAX_SMART_REFLEX_PARAMS);
220 memcpy(gen_parms->srf3,
221 g->srf3,
222 CONF_MAX_SMART_REFLEX_PARAMS);
223 memcpy(gen_parms->sr_debug_table,
224 g->sr_debug_table,
225 CONF_MAX_SMART_REFLEX_PARAMS);
226
227 gen_parms->sr_sen_n_p = g->sr_sen_n_p;
228 gen_parms->sr_sen_n_p_gain = g->sr_sen_n_p_gain;
229 gen_parms->sr_sen_nrn = g->sr_sen_nrn;
230 gen_parms->sr_sen_prn = g->sr_sen_prn;
231 207
232 ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0); 208 ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0);
233 if (ret < 0) 209 if (ret < 0)
@@ -240,8 +216,11 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
240int wl1271_cmd_radio_parms(struct wl1271 *wl) 216int wl1271_cmd_radio_parms(struct wl1271 *wl)
241{ 217{
242 struct wl1271_radio_parms_cmd *radio_parms; 218 struct wl1271_radio_parms_cmd *radio_parms;
243 struct conf_radio_parms *r = &wl->conf.init.radioparam; 219 struct conf_radio_parms *rparam = &wl->conf.init.radioparam;
244 int i, ret; 220 int ret;
221
222 if (!wl->nvs)
223 return -ENODEV;
245 224
246 radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); 225 radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL);
247 if (!radio_parms) 226 if (!radio_parms)
@@ -249,73 +228,13 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl)
249 228
250 radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; 229 radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM;
251 230
252 /* Static radio parameters */ 231 memcpy(radio_parms->stat_radio_params, wl->nvs->stat_radio_params,
253 radio_parms->rx_trace_loss = r->rx_trace_loss; 232 WL1271_NVS_STAT_RADIO_PARAMS_SIZE);
254 radio_parms->tx_trace_loss = r->tx_trace_loss; 233 memcpy(radio_parms->dyn_radio_params,
255 memcpy(radio_parms->rx_rssi_and_proc_compens, 234 wl->nvs->dyn_radio_params[rparam->fem],
256 r->rx_rssi_and_proc_compens, 235 WL1271_NVS_DYN_RADIO_PARAMS_SIZE);
257 CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE); 236
258 237 /* FIXME: current NVS is missing 5GHz parameters */
259 memcpy(radio_parms->rx_trace_loss_5, r->rx_trace_loss_5,
260 CONF_NUMBER_OF_SUB_BANDS_5);
261 memcpy(radio_parms->tx_trace_loss_5, r->tx_trace_loss_5,
262 CONF_NUMBER_OF_SUB_BANDS_5);
263 memcpy(radio_parms->rx_rssi_and_proc_compens_5,
264 r->rx_rssi_and_proc_compens_5,
265 CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE);
266
267 /* Dynamic radio parameters */
268 radio_parms->tx_ref_pd_voltage = cpu_to_le16(r->tx_ref_pd_voltage);
269 radio_parms->tx_ref_power = r->tx_ref_power;
270 radio_parms->tx_offset_db = r->tx_offset_db;
271
272 memcpy(radio_parms->tx_rate_limits_normal, r->tx_rate_limits_normal,
273 CONF_NUMBER_OF_RATE_GROUPS);
274 memcpy(radio_parms->tx_rate_limits_degraded, r->tx_rate_limits_degraded,
275 CONF_NUMBER_OF_RATE_GROUPS);
276 memcpy(radio_parms->tx_rate_limits_extreme, r->tx_rate_limits_extreme,
277 CONF_NUMBER_OF_RATE_GROUPS);
278
279 memcpy(radio_parms->tx_channel_limits_11b, r->tx_channel_limits_11b,
280 CONF_NUMBER_OF_CHANNELS_2_4);
281 memcpy(radio_parms->tx_channel_limits_ofdm, r->tx_channel_limits_ofdm,
282 CONF_NUMBER_OF_CHANNELS_2_4);
283 memcpy(radio_parms->tx_pdv_rate_offsets, r->tx_pdv_rate_offsets,
284 CONF_NUMBER_OF_RATE_GROUPS);
285 memcpy(radio_parms->tx_ibias, r->tx_ibias, CONF_NUMBER_OF_RATE_GROUPS);
286
287 radio_parms->rx_fem_insertion_loss = r->rx_fem_insertion_loss;
288 radio_parms->degraded_low_to_normal_threshold =
289 r->degraded_low_to_normal_threshold;
290 radio_parms->degraded_normal_to_high_threshold =
291 r->degraded_normal_to_high_threshold;
292
293
294 for (i = 0; i < CONF_NUMBER_OF_SUB_BANDS_5; i++)
295 radio_parms->tx_ref_pd_voltage_5[i] =
296 cpu_to_le16(r->tx_ref_pd_voltage_5[i]);
297 memcpy(radio_parms->tx_ref_power_5, r->tx_ref_power_5,
298 CONF_NUMBER_OF_SUB_BANDS_5);
299 memcpy(radio_parms->tx_offset_db_5, r->tx_offset_db_5,
300 CONF_NUMBER_OF_SUB_BANDS_5);
301 memcpy(radio_parms->tx_rate_limits_normal_5,
302 r->tx_rate_limits_normal_5, CONF_NUMBER_OF_RATE_GROUPS);
303 memcpy(radio_parms->tx_rate_limits_degraded_5,
304 r->tx_rate_limits_degraded_5, CONF_NUMBER_OF_RATE_GROUPS);
305 memcpy(radio_parms->tx_rate_limits_extreme_5,
306 r->tx_rate_limits_extreme_5, CONF_NUMBER_OF_RATE_GROUPS);
307 memcpy(radio_parms->tx_channel_limits_ofdm_5,
308 r->tx_channel_limits_ofdm_5, CONF_NUMBER_OF_CHANNELS_5);
309 memcpy(radio_parms->tx_pdv_rate_offsets_5, r->tx_pdv_rate_offsets_5,
310 CONF_NUMBER_OF_RATE_GROUPS);
311 memcpy(radio_parms->tx_ibias_5, r->tx_ibias_5,
312 CONF_NUMBER_OF_RATE_GROUPS);
313 memcpy(radio_parms->rx_fem_insertion_loss_5,
314 r->rx_fem_insertion_loss_5, CONF_NUMBER_OF_SUB_BANDS_5);
315 radio_parms->degraded_low_to_normal_threshold_5 =
316 r->degraded_low_to_normal_threshold_5;
317 radio_parms->degraded_normal_to_high_threshold_5 =
318 r->degraded_normal_to_high_threshold_5;
319 238
320 wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", 239 wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ",
321 radio_parms, sizeof(*radio_parms)); 240 radio_parms, sizeof(*radio_parms));
@@ -1022,7 +941,7 @@ int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
1022 ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); 941 ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0);
1023 if (ret < 0) { 942 if (ret < 0) {
1024 wl1271_warning("could not set keys"); 943 wl1271_warning("could not set keys");
1025 goto out; 944 goto out;
1026 } 945 }
1027 946
1028out: 947out: