aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1271_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_init.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_init.c117
1 files changed, 4 insertions, 113 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 7c2017f480ea..11249b436cf1 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -193,125 +193,16 @@ static int wl1271_init_beacon_broadcast(struct wl1271 *wl)
193 return 0; 193 return 0;
194} 194}
195 195
196static int wl1271_init_general_parms(struct wl1271 *wl)
197{
198 struct wl1271_general_parms *gen_parms;
199 struct conf_general_parms *g = &wl->conf.init.genparam;
200 int ret;
201
202 gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
203 if (!gen_parms)
204 return -ENOMEM;
205
206 gen_parms->id = TEST_CMD_INI_FILE_GENERAL_PARAM;
207
208 gen_parms->ref_clk = g->ref_clk;
209 gen_parms->settling_time = g->settling_time;
210 gen_parms->clk_valid_on_wakeup = g->clk_valid_on_wakeup;
211 gen_parms->dc2dcmode = g->dc2dcmode;
212 gen_parms->single_dual_band = g->single_dual_band;
213 gen_parms->tx_bip_fem_autodetect = g->tx_bip_fem_autodetect;
214 gen_parms->tx_bip_fem_manufacturer = g->tx_bip_fem_manufacturer;
215 gen_parms->settings = g->settings;
216
217 ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0);
218 if (ret < 0) {
219 wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed");
220 return ret;
221 }
222
223 kfree(gen_parms);
224 return 0;
225}
226
227static int wl1271_init_radio_parms(struct wl1271 *wl)
228{
229 struct wl1271_radio_parms *radio_parms;
230 struct conf_radio_parms *r = &wl->conf.init.radioparam;
231 int i, ret;
232
233 radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL);
234 if (!radio_parms)
235 return -ENOMEM;
236
237 radio_parms->id = TEST_CMD_INI_FILE_RADIO_PARAM;
238
239 /* Static radio parameters */
240 radio_parms->rx_trace_loss = r->rx_trace_loss;
241 radio_parms->tx_trace_loss = r->tx_trace_loss;
242 memcpy(radio_parms->rx_rssi_and_proc_compens,
243 r->rx_rssi_and_proc_compens,
244 CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE);
245
246 memcpy(radio_parms->rx_trace_loss_5, r->rx_trace_loss_5,
247 CONF_NUMBER_OF_SUB_BANDS_5);
248 memcpy(radio_parms->tx_trace_loss_5, r->tx_trace_loss_5,
249 CONF_NUMBER_OF_SUB_BANDS_5);
250 memcpy(radio_parms->rx_rssi_and_proc_compens_5,
251 r->rx_rssi_and_proc_compens_5,
252 CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE);
253
254 /* Dynamic radio parameters */
255 radio_parms->tx_ref_pd_voltage = cpu_to_le16(r->tx_ref_pd_voltage);
256 radio_parms->tx_ref_power = r->tx_ref_power;
257 radio_parms->tx_offset_db = r->tx_offset_db;
258
259 memcpy(radio_parms->tx_rate_limits_normal, r->tx_rate_limits_normal,
260 CONF_NUMBER_OF_RATE_GROUPS);
261 memcpy(radio_parms->tx_rate_limits_degraded, r->tx_rate_limits_degraded,
262 CONF_NUMBER_OF_RATE_GROUPS);
263
264 memcpy(radio_parms->tx_channel_limits_11b, r->tx_channel_limits_11b,
265 CONF_NUMBER_OF_CHANNELS_2_4);
266 memcpy(radio_parms->tx_channel_limits_ofdm, r->tx_channel_limits_ofdm,
267 CONF_NUMBER_OF_CHANNELS_2_4);
268 memcpy(radio_parms->tx_pdv_rate_offsets, r->tx_pdv_rate_offsets,
269 CONF_NUMBER_OF_RATE_GROUPS);
270 memcpy(radio_parms->tx_ibias, r->tx_ibias, CONF_NUMBER_OF_RATE_GROUPS);
271
272 radio_parms->rx_fem_insertion_loss = r->rx_fem_insertion_loss;
273
274 for (i = 0; i < CONF_NUMBER_OF_SUB_BANDS_5; i++)
275 radio_parms->tx_ref_pd_voltage_5[i] =
276 cpu_to_le16(r->tx_ref_pd_voltage_5[i]);
277 memcpy(radio_parms->tx_ref_power_5, r->tx_ref_power_5,
278 CONF_NUMBER_OF_SUB_BANDS_5);
279 memcpy(radio_parms->tx_offset_db_5, r->tx_offset_db_5,
280 CONF_NUMBER_OF_SUB_BANDS_5);
281 memcpy(radio_parms->tx_rate_limits_normal_5,
282 r->tx_rate_limits_normal_5, CONF_NUMBER_OF_RATE_GROUPS);
283 memcpy(radio_parms->tx_rate_limits_degraded_5,
284 r->tx_rate_limits_degraded_5, CONF_NUMBER_OF_RATE_GROUPS);
285 memcpy(radio_parms->tx_channel_limits_ofdm_5,
286 r->tx_channel_limits_ofdm_5, CONF_NUMBER_OF_CHANNELS_5);
287 memcpy(radio_parms->tx_pdv_rate_offsets_5, r->tx_pdv_rate_offsets_5,
288 CONF_NUMBER_OF_RATE_GROUPS);
289 memcpy(radio_parms->tx_ibias_5, r->tx_ibias_5,
290 CONF_NUMBER_OF_RATE_GROUPS);
291 memcpy(radio_parms->rx_fem_insertion_loss_5,
292 r->rx_fem_insertion_loss_5, CONF_NUMBER_OF_SUB_BANDS_5);
293
294 ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0);
295 if (ret < 0)
296 wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed");
297
298 kfree(radio_parms);
299 return ret;
300}
301
302int wl1271_hw_init(struct wl1271 *wl) 196int wl1271_hw_init(struct wl1271 *wl)
303{ 197{
304 int ret; 198 int ret;
305 199
306 /* FIXME: the following parameter setting functions return error 200 ret = wl1271_cmd_general_parms(wl);
307 * codes - the reason is so far unknown. The -EIO is therefore 201 if (ret < 0)
308 * ignored for the time being. */
309 ret = wl1271_init_general_parms(wl);
310 if (ret < 0 && ret != -EIO)
311 return ret; 202 return ret;
312 203
313 ret = wl1271_init_radio_parms(wl); 204 ret = wl1271_cmd_radio_parms(wl);
314 if (ret < 0 && ret != -EIO) 205 if (ret < 0)
315 return ret; 206 return ret;
316 207
317 /* Template settings */ 208 /* Template settings */