diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1251.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1251.c | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251.c b/drivers/net/wireless/wl12xx/wl1251.c index ce1561a41fa4..1a352cf8c3ec 100644 --- a/drivers/net/wireless/wl12xx/wl1251.c +++ b/drivers/net/wireless/wl12xx/wl1251.c | |||
@@ -297,45 +297,48 @@ out: | |||
297 | 297 | ||
298 | static int wl1251_mem_cfg(struct wl12xx *wl) | 298 | static int wl1251_mem_cfg(struct wl12xx *wl) |
299 | { | 299 | { |
300 | struct wl1251_acx_config_memory mem_conf; | 300 | struct wl1251_acx_config_memory *mem_conf; |
301 | int ret, i; | 301 | int ret, i; |
302 | 302 | ||
303 | wl12xx_debug(DEBUG_ACX, "wl1251 mem cfg"); | 303 | wl12xx_debug(DEBUG_ACX, "wl1251 mem cfg"); |
304 | 304 | ||
305 | mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL); | ||
306 | if (!mem_conf) { | ||
307 | ret = -ENOMEM; | ||
308 | goto out; | ||
309 | } | ||
310 | |||
305 | /* memory config */ | 311 | /* memory config */ |
306 | mem_conf.mem_config.num_stations = cpu_to_le16(DEFAULT_NUM_STATIONS); | 312 | mem_conf->mem_config.num_stations = cpu_to_le16(DEFAULT_NUM_STATIONS); |
307 | mem_conf.mem_config.rx_mem_block_num = 35; | 313 | mem_conf->mem_config.rx_mem_block_num = 35; |
308 | mem_conf.mem_config.tx_min_mem_block_num = 64; | 314 | mem_conf->mem_config.tx_min_mem_block_num = 64; |
309 | mem_conf.mem_config.num_tx_queues = MAX_TX_QUEUES; | 315 | mem_conf->mem_config.num_tx_queues = MAX_TX_QUEUES; |
310 | mem_conf.mem_config.host_if_options = HOSTIF_PKT_RING; | 316 | mem_conf->mem_config.host_if_options = HOSTIF_PKT_RING; |
311 | mem_conf.mem_config.num_ssid_profiles = 1; | 317 | mem_conf->mem_config.num_ssid_profiles = 1; |
312 | mem_conf.mem_config.debug_buffer_size = | 318 | mem_conf->mem_config.debug_buffer_size = |
313 | cpu_to_le16(TRACE_BUFFER_MAX_SIZE); | 319 | cpu_to_le16(TRACE_BUFFER_MAX_SIZE); |
314 | 320 | ||
315 | /* RX queue config */ | 321 | /* RX queue config */ |
316 | mem_conf.rx_queue_config.dma_address = 0; | 322 | mem_conf->rx_queue_config.dma_address = 0; |
317 | mem_conf.rx_queue_config.num_descs = ACX_RX_DESC_DEF; | 323 | mem_conf->rx_queue_config.num_descs = ACX_RX_DESC_DEF; |
318 | mem_conf.rx_queue_config.priority = DEFAULT_RXQ_PRIORITY; | 324 | mem_conf->rx_queue_config.priority = DEFAULT_RXQ_PRIORITY; |
319 | mem_conf.rx_queue_config.type = DEFAULT_RXQ_TYPE; | 325 | mem_conf->rx_queue_config.type = DEFAULT_RXQ_TYPE; |
320 | 326 | ||
321 | /* TX queue config */ | 327 | /* TX queue config */ |
322 | for (i = 0; i < MAX_TX_QUEUES; i++) { | 328 | for (i = 0; i < MAX_TX_QUEUES; i++) { |
323 | mem_conf.tx_queue_config[i].num_descs = ACX_TX_DESC_DEF; | 329 | mem_conf->tx_queue_config[i].num_descs = ACX_TX_DESC_DEF; |
324 | mem_conf.tx_queue_config[i].attributes = i; | 330 | mem_conf->tx_queue_config[i].attributes = i; |
325 | } | 331 | } |
326 | 332 | ||
327 | mem_conf.header.id = ACX_MEM_CFG; | 333 | ret = wl12xx_cmd_configure(wl, ACX_MEM_CFG, mem_conf, |
328 | mem_conf.header.len = sizeof(struct wl1251_acx_config_memory) - | 334 | sizeof(*mem_conf)); |
329 | sizeof(struct acx_header); | 335 | if (ret < 0) { |
330 | mem_conf.header.len -= | ||
331 | (MAX_TX_QUEUE_CONFIGS - mem_conf.mem_config.num_tx_queues) * | ||
332 | sizeof(struct wl1251_acx_tx_queue_config); | ||
333 | |||
334 | ret = wl12xx_cmd_configure(wl, &mem_conf, | ||
335 | sizeof(struct wl1251_acx_config_memory)); | ||
336 | if (ret < 0) | ||
337 | wl12xx_warning("wl1251 mem config failed: %d", ret); | 336 | wl12xx_warning("wl1251 mem config failed: %d", ret); |
337 | goto out; | ||
338 | } | ||
338 | 339 | ||
340 | out: | ||
341 | kfree(mem_conf); | ||
339 | return ret; | 342 | return ret; |
340 | } | 343 | } |
341 | 344 | ||
@@ -529,28 +532,33 @@ static int wl1251_hw_init_txq_fill(u8 qid, | |||
529 | 532 | ||
530 | static int wl1251_hw_init_tx_queue_config(struct wl12xx *wl) | 533 | static int wl1251_hw_init_tx_queue_config(struct wl12xx *wl) |
531 | { | 534 | { |
532 | struct acx_tx_queue_qos_config config; | 535 | struct acx_tx_queue_qos_config *config; |
533 | struct wl1251_acx_mem_map *wl_mem_map = wl->target_mem_map; | 536 | struct wl1251_acx_mem_map *wl_mem_map = wl->target_mem_map; |
534 | int ret, i; | 537 | int ret, i; |
535 | 538 | ||
536 | wl12xx_debug(DEBUG_ACX, "acx tx queue config"); | 539 | wl12xx_debug(DEBUG_ACX, "acx tx queue config"); |
537 | 540 | ||
538 | config.header.id = ACX_TX_QUEUE_CFG; | 541 | config = kzalloc(sizeof(*config), GFP_KERNEL); |
539 | config.header.len = sizeof(struct acx_tx_queue_qos_config) - | 542 | if (!config) { |
540 | sizeof(struct acx_header); | 543 | ret = -ENOMEM; |
544 | goto out; | ||
545 | } | ||
541 | 546 | ||
542 | for (i = 0; i < MAX_NUM_OF_AC; i++) { | 547 | for (i = 0; i < MAX_NUM_OF_AC; i++) { |
543 | ret = wl1251_hw_init_txq_fill(i, &config, | 548 | ret = wl1251_hw_init_txq_fill(i, config, |
544 | wl_mem_map->num_tx_mem_blocks); | 549 | wl_mem_map->num_tx_mem_blocks); |
545 | if (ret < 0) | 550 | if (ret < 0) |
546 | return ret; | 551 | goto out; |
547 | 552 | ||
548 | ret = wl12xx_cmd_configure(wl, &config, sizeof(config)); | 553 | ret = wl12xx_cmd_configure(wl, ACX_TX_QUEUE_CFG, |
554 | config, sizeof(*config)); | ||
549 | if (ret < 0) | 555 | if (ret < 0) |
550 | return ret; | 556 | goto out; |
551 | } | 557 | } |
552 | 558 | ||
553 | return 0; | 559 | out: |
560 | kfree(config); | ||
561 | return ret; | ||
554 | } | 562 | } |
555 | 563 | ||
556 | static int wl1251_hw_init_data_path_config(struct wl12xx *wl) | 564 | static int wl1251_hw_init_data_path_config(struct wl12xx *wl) |