123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766 |
- /*
- * This file is part of wl1271
- *
- * Copyright (C) 2009 Nokia Corporation
- *
- * Contact: Luciano Coelho <luciano.coelho@nokia.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/slab.h>
- #include "debug.h"
- #include "init.h"
- #include "wl12xx_80211.h"
- #include "acx.h"
- #include "cmd.h"
- #include "reg.h"
- #include "tx.h"
- #include "io.h"
- int wl1271_init_templates_config(struct wl1271 *wl)
- {
- int ret, i;
- size_t max_size;
- /* send empty templates for fw memory reservation */
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL,
- WL1271_CMD_TEMPL_MAX_SIZE,
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_CFG_PROBE_REQ_5,
- NULL, WL1271_CMD_TEMPL_MAX_SIZE, 0,
- WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_NULL_DATA, NULL,
- sizeof(struct wl12xx_null_data_template),
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_PS_POLL, NULL,
- sizeof(struct wl12xx_ps_poll_template),
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_QOS_NULL_DATA, NULL,
- sizeof
- (struct ieee80211_qos_hdr),
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_PROBE_RESPONSE, NULL,
- WL1271_CMD_TEMPL_DFLT_SIZE,
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_BEACON, NULL,
- WL1271_CMD_TEMPL_DFLT_SIZE,
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- max_size = sizeof(struct wl12xx_arp_rsp_template) +
- WL1271_EXTRA_SPACE_MAX;
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_ARP_RSP, NULL,
- max_size,
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- /*
- * Put very large empty placeholders for all templates. These
- * reserve memory for later.
- */
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_AP_PROBE_RESPONSE, NULL,
- WL1271_CMD_TEMPL_MAX_SIZE,
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_AP_BEACON, NULL,
- WL1271_CMD_TEMPL_MAX_SIZE,
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_DEAUTH_AP, NULL,
- sizeof
- (struct wl12xx_disconn_template),
- 0, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
- ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
- CMD_TEMPL_KLV, NULL,
- sizeof(struct ieee80211_qos_hdr),
- i, WL1271_RATE_AUTOMATIC);
- if (ret < 0)
- return ret;
- }
- return 0;
- }
- static int wl1271_ap_init_deauth_template(struct wl1271 *wl,
- struct wl12xx_vif *wlvif)
- {
- struct wl12xx_disconn_template *tmpl;
- int ret;
- u32 rate;
- tmpl = kzalloc(sizeof(*tmpl), GFP_KERNEL);
- if (!tmpl) {
- ret = -ENOMEM;
- goto out;
- }
- tmpl->header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT |
- IEEE80211_STYPE_DEAUTH);
- rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
- ret = wl1271_cmd_template_set(wl, wlvif->role_id,
- CMD_TEMPL_DEAUTH_AP,
- tmpl, sizeof(*tmpl), 0, rate);
- out:
- kfree(tmpl);
- return ret;
- }
- static int wl1271_ap_init_null_template(struct wl1271 *wl,
- struct ieee80211_vif *vif)
- {
- struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
- struct ieee80211_hdr_3addr *nullfunc;
- int ret;
- u32 rate;
- nullfunc = kzalloc(sizeof(*nullfunc), GFP_KERNEL);
- if (!nullfunc) {
- ret = -ENOMEM;
- goto out;
- }
- nullfunc->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC |
- IEEE80211_FCTL_FROMDS);
- /* nullfunc->addr1 is filled by FW */
- memcpy(nullfunc->addr2, vif->addr, ETH_ALEN);
- memcpy(nullfunc->addr3, vif->addr, ETH_ALEN);
- rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
- ret = wl1271_cmd_template_set(wl, wlvif->role_id,
- CMD_TEMPL_NULL_DATA, nullfunc,
- sizeof(*nullfunc), 0, rate);
- out:
- kfree(nullfunc);
- return ret;
- }
- static int wl1271_ap_init_qos_null_template(struct wl1271 *wl,
- struct ieee80211_vif *vif)
- {
- struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
- struct ieee80211_qos_hdr *qosnull;
- int ret;
- u32 rate;
- qosnull = kzalloc(sizeof(*qosnull), GFP_KERNEL);
- if (!qosnull) {
- ret = -ENOMEM;
- goto out;
- }
- qosnull->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_QOS_NULLFUNC |
- IEEE80211_FCTL_FROMDS);
- /* qosnull->addr1 is filled by FW */
- memcpy(qosnull->addr2, vif->addr, ETH_ALEN);
- memcpy(qosnull->addr3, vif->addr, ETH_ALEN);
- rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
- ret = wl1271_cmd_template_set(wl, wlvif->role_id,
- CMD_TEMPL_QOS_NULL_DATA, qosnull,
- sizeof(*qosnull), 0, rate);
- out:
- kfree(qosnull);
- return ret;
- }
- static int wl12xx_init_rx_config(struct wl1271 *wl)
- {
- int ret;
- ret = wl1271_acx_rx_msdu_life_time(wl);
- if (ret < 0)
- return ret;
- return 0;
- }
- static int wl12xx_init_phy_vif_config(struct wl1271 *wl,
- struct wl12xx_vif *wlvif)
- {
- int ret;
- ret = wl1271_acx_slot(wl, wlvif, DEFAULT_SLOT_TIME);
- if (ret < 0)
- return ret;
- ret = wl1271_acx_service_period_timeout(wl, wlvif);
- if (ret < 0)
- return ret;
- ret = wl1271_acx_rts_threshold(wl, wlvif, wl->hw->wiphy->rts_threshold);
- if (ret < 0)
- return ret;
- return 0;
- }
- static int wl1271_init_sta_beacon_filter(struct wl1271 *wl,
- struct wl12xx_vif *wlvif)
- {
- int ret;
- ret = wl1271_acx_beacon_filter_table(wl, wlvif);
- if (ret < 0)
- return ret;
- /* enable beacon filtering */
- ret = wl1271_acx_beacon_filter_opt(wl, wlvif, true);
- if (ret < 0)
- return ret;
- return 0;
- }
- int wl1271_init_pta(struct wl1271 *wl)
- {
- int ret;
- ret = wl12xx_acx_sg_cfg(wl);
- if (ret < 0)
- return ret;
- ret = wl1271_acx_sg_enable(wl, wl->sg_enabled);
- if (ret < 0)
- return ret;
- return 0;
- }
- int wl1271_init_energy_detection(struct wl1271 *wl)
- {
- int ret;
- ret = wl1271_acx_cca_threshold(wl);
- if (ret < 0)
- return ret;
- return 0;
- }
- static int wl1271_init_beacon_broadcast(struct wl1271 *wl,
- struct wl12xx_vif *wlvif)
- {
- int ret;
- ret = wl1271_acx_bcn_dtim_options(wl, wlvif);
- if (ret < 0)
- return ret;
- return 0;
- }
- static int wl12xx_init_fwlog(struct wl1271 *wl)
- {
- int ret;
- if (wl->quirks & WL12XX_QUIRK_FWLOG_NOT_IMPLEMENTED)
- return 0;
- ret = wl12xx_cmd_config_fwlog(wl);
- if (ret < 0)
- return ret;
- return 0;
- }
- /* generic sta initialization (non vif-specific) */
- static int wl1271_sta_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif)
- {
- int ret;
- /* PS config */
- ret = wl12xx_acx_config_ps(wl, wlvif);
- if (ret < 0)
- return ret;
- /* FM WLAN coexistence */
- ret = wl1271_acx_fm_coex(wl);
- if (ret < 0)
- return ret;
- ret = wl1271_acx_sta_rate_policies(wl, wlvif);
- if (ret < 0)
- return ret;
- return 0;
- }
- static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl,
- struct ieee80211_vif *vif)
- {
- struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
- int ret, i;
- /* disable all keep-alive templates */
- for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
- ret = wl1271_acx_keep_alive_config(wl, wlvif, i,
- ACX_KEEP_ALIVE_TPL_INVALID);
- if (ret < 0)
- return ret;
- }
- /* disable the keep-alive feature */
- ret = wl1271_acx_keep_alive_mode(wl, wlvif, false);
- if (ret < 0)
- return ret;
- return 0;
- }
- /* generic ap initialization (non vif-specific) */
- static int wl1271_ap_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif)
- {
- int ret;
- ret = wl1271_init_ap_rates(wl, wlvif);
- if (ret < 0)
- return ret;
- return 0;
- }
- int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif)
- {
- struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
- int ret;
- ret = wl1271_ap_init_deauth_template(wl, wlvif);
- if (ret < 0)
- return ret;
- ret = wl1271_ap_init_null_template(wl, vif);
- if (ret < 0)
- return ret;
- ret = wl1271_ap_init_qos_null_template(wl, vif);
- if (ret < 0)
- return ret;
- /*
- * when operating as AP we want to receive external beacons for
- * configuring ERP protection.
- */
- ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false);
- if (ret < 0)
- return ret;
- return 0;
- }
- static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl,
- struct ieee80211_vif *vif)
- {
- return wl1271_ap_init_templates(wl, vif);
- }
- int wl1271_init_ap_rates(struct wl1271 *wl, struct wl12xx_vif *wlvif)
- {
- int i, ret;
- struct conf_tx_rate_class rc;
- u32 supported_rates;
- wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x",
- wlvif->basic_rate_set);
- if (wlvif->basic_rate_set == 0)
- return -EINVAL;
- rc.enabled_rates = wlvif->basic_rate_set;
- rc.long_retry_limit = 10;
- rc.short_retry_limit = 10;
- rc.aflags = 0;
- ret = wl1271_acx_ap_rate_policy(wl, &rc, wlvif->ap.mgmt_rate_idx);
- if (ret < 0)
- return ret;
- /* use the min basic rate for AP broadcast/multicast */
- rc.enabled_rates = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
- rc.short_retry_limit = 10;
- rc.long_retry_limit = 10;
- rc.aflags = 0;
- ret = wl1271_acx_ap_rate_policy(wl, &rc, wlvif->ap.bcast_rate_idx);
- if (ret < 0)
- return ret;
- /*
- * If the basic rates contain OFDM rates, use OFDM only
- * rates for unicast TX as well. Else use all supported rates.
- */
- if ((wlvif->basic_rate_set & CONF_TX_OFDM_RATES))
- supported_rates = CONF_TX_OFDM_RATES;
- else
- supported_rates = CONF_TX_AP_ENABLED_RATES;
- /* unconditionally enable HT rates */
- supported_rates |= CONF_TX_MCS_RATES;
- /* configure unicast TX rate classes */
- for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
- rc.enabled_rates = supported_rates;
- rc.short_retry_limit = 10;
- rc.long_retry_limit = 10;
- rc.aflags = 0;
- ret = wl1271_acx_ap_rate_policy(wl, &rc,
- wlvif->ap.ucast_rate_idx[i]);
- if (ret < 0)
- return ret;
- }
- return 0;
- }
- static int wl1271_set_ba_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif)
- {
- /* Reset the BA RX indicators */
- wlvif->ba_allowed = true;
- wl->ba_rx_session_count = 0;
- /* BA is supported in STA/AP modes */
- if (wlvif->bss_type != BSS_TYPE_AP_BSS &&
- wlvif->bss_type != BSS_TYPE_STA_BSS) {
- wlvif->ba_support = false;
- return 0;
- }
- wlvif->ba_support = true;
- /* 802.11n initiator BA session setting */
- return wl12xx_acx_set_ba_initiator_policy(wl, wlvif);
- }
- int wl1271_chip_specific_init(struct wl1271 *wl)
- {
- int ret = 0;
- if (wl->chip.id == CHIP_ID_1283_PG20) {
- u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE;
- if (!(wl->quirks & WL12XX_QUIRK_NO_BLOCKSIZE_ALIGNMENT))
- /* Enable SDIO padding */
- host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK;
- /* Must be before wl1271_acx_init_mem_config() */
- ret = wl1271_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap);
- if (ret < 0)
- goto out;
- }
- out:
- return ret;
- }
- /* vif-specifc initialization */
- static int wl12xx_init_sta_role(struct wl1271 *wl, struct wl12xx_vif *wlvif)
- {
- int ret;
- ret = wl1271_acx_group_address_tbl(wl, wlvif, true, NULL, 0);
- if (ret < 0)
- return ret;
- /* Initialize connection monitoring thresholds */
- ret = wl1271_acx_conn_monit_params(wl, wlvif, false);
- if (ret < 0)
- return ret;
- /* Beacon filtering */
- ret = wl1271_init_sta_beacon_filter(wl, wlvif);
- if (ret < 0)
- return ret;
- /* Beacons and broadcast settings */
- ret = wl1271_init_beacon_broadcast(wl, wlvif);
- if (ret < 0)
- return ret;
- /* Configure rssi/snr averaging weights */
- ret = wl1271_acx_rssi_snr_avg_weights(wl, wlvif);
- if (ret < 0)
- return ret;
- return 0;
- }
- /* vif-specific intialization */
- static int wl12xx_init_ap_role(struct wl1271 *wl, struct wl12xx_vif *wlvif)
- {
- int ret;
- ret = wl1271_acx_ap_max_tx_retry(wl, wlvif);
- if (ret < 0)
- return ret;
- /* initialize Tx power */
- ret = wl1271_acx_tx_power(wl, wlvif, wlvif->power_level);
- if (ret < 0)
- return ret;
- return 0;
- }
- int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
- {
- struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
- struct conf_tx_ac_category *conf_ac;
- struct conf_tx_tid *conf_tid;
- bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS);
- int ret, i;
- /*
- * consider all existing roles before configuring psm.
- * TODO: reconfigure on interface removal.
- */
- if (!wl->ap_count) {
- if (is_ap) {
- /* Configure for power always on */
- ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
- if (ret < 0)
- return ret;
- } else if (!wl->sta_count) {
- /* Configure for ELP power saving */
- ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP);
- if (ret < 0)
- return ret;
- }
- }
- /* Mode specific init */
- if (is_ap) {
- ret = wl1271_ap_hw_init(wl, wlvif);
- if (ret < 0)
- return ret;
- ret = wl12xx_init_ap_role(wl, wlvif);
- if (ret < 0)
- return ret;
- } else {
- ret = wl1271_sta_hw_init(wl, wlvif);
- if (ret < 0)
- return ret;
- ret = wl12xx_init_sta_role(wl, wlvif);
- if (ret < 0)
- return ret;
- }
- wl12xx_init_phy_vif_config(wl, wlvif);
- /* Default TID/AC configuration */
- BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count);
- for (i = 0; i < wl->conf.tx.tid_conf_count; i++) {
- conf_ac = &wl->conf.tx.ac_conf[i];
- ret = wl1271_acx_ac_cfg(wl, wlvif, conf_ac->ac,
- conf_ac->cw_min, conf_ac->cw_max,
- conf_ac->aifsn, conf_ac->tx_op_limit);
- if (ret < 0)
- return ret;
- conf_tid = &wl->conf.tx.tid_conf[i];
- ret = wl1271_acx_tid_cfg(wl, wlvif,
- conf_tid->queue_id,
- conf_tid->channel_type,
- conf_tid->tsid,
- conf_tid->ps_scheme,
- conf_tid->ack_policy,
- conf_tid->apsd_conf[0],
- conf_tid->apsd_conf[1]);
- if (ret < 0)
- return ret;
- }
- /* Configure HW encryption */
- ret = wl1271_acx_feature_cfg(wl, wlvif);
- if (ret < 0)
- return ret;
- /* Mode specific init - post mem init */
- if (is_ap)
- ret = wl1271_ap_hw_init_post_mem(wl, vif);
- else
- ret = wl1271_sta_hw_init_post_mem(wl, vif);
- if (ret < 0)
- return ret;
- /* Configure initiator BA sessions policies */
- ret = wl1271_set_ba_policies(wl, wlvif);
- if (ret < 0)
- return ret;
- return 0;
- }
- int wl1271_hw_init(struct wl1271 *wl)
- {
- int ret;
- if (wl->chip.id == CHIP_ID_1283_PG20) {
- ret = wl128x_cmd_general_parms(wl);
- if (ret < 0)
- return ret;
- ret = wl128x_cmd_radio_parms(wl);
- if (ret < 0)
- return ret;
- } else {
- ret = wl1271_cmd_general_parms(wl);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_radio_parms(wl);
- if (ret < 0)
- return ret;
- ret = wl1271_cmd_ext_radio_parms(wl);
- if (ret < 0)
- return ret;
- }
- /* Chip-specific init */
- ret = wl1271_chip_specific_init(wl);
- if (ret < 0)
- return ret;
- /* Init templates */
- ret = wl1271_init_templates_config(wl);
- if (ret < 0)
- return ret;
- ret = wl12xx_acx_mem_cfg(wl);
- if (ret < 0)
- return ret;
- /* Configure the FW logger */
- ret = wl12xx_init_fwlog(wl);
- if (ret < 0)
- return ret;
- /* Bluetooth WLAN coexistence */
- ret = wl1271_init_pta(wl);
- if (ret < 0)
- return ret;
- /* Default memory configuration */
- ret = wl1271_acx_init_mem_config(wl);
- if (ret < 0)
- return ret;
- /* RX config */
- ret = wl12xx_init_rx_config(wl);
- if (ret < 0)
- goto out_free_memmap;
- ret = wl1271_acx_dco_itrim_params(wl);
- if (ret < 0)
- goto out_free_memmap;
- /* Configure TX patch complete interrupt behavior */
- ret = wl1271_acx_tx_config_options(wl);
- if (ret < 0)
- goto out_free_memmap;
- /* RX complete interrupt pacing */
- ret = wl1271_acx_init_rx_interrupt(wl);
- if (ret < 0)
- goto out_free_memmap;
- /* Energy detection */
- ret = wl1271_init_energy_detection(wl);
- if (ret < 0)
- goto out_free_memmap;
- /* Default fragmentation threshold */
- ret = wl1271_acx_frag_threshold(wl, wl->hw->wiphy->frag_threshold);
- if (ret < 0)
- goto out_free_memmap;
- /* Enable data path */
- ret = wl1271_cmd_data_path(wl, 1);
- if (ret < 0)
- goto out_free_memmap;
- /* configure PM */
- ret = wl1271_acx_pm_config(wl);
- if (ret < 0)
- goto out_free_memmap;
- ret = wl12xx_acx_set_rate_mgmt_params(wl);
- if (ret < 0)
- goto out_free_memmap;
- /* configure hangover */
- ret = wl12xx_acx_config_hangover(wl);
- if (ret < 0)
- goto out_free_memmap;
- return 0;
- out_free_memmap:
- kfree(wl->target_mem_map);
- wl->target_mem_map = NULL;
- return ret;
- }
|