2 * This file is part of wl1271
4 * Copyright (C) 2008-2009 Nokia Corporation
6 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 #include "wl1271_acx.h"
26 #include <linux/module.h>
27 #include <linux/platform_device.h>
28 #include <linux/crc7.h>
29 #include <linux/spi/spi.h>
32 #include "wl12xx_80211.h"
33 #include "wl1271_reg.h"
34 #include "wl1271_spi.h"
35 #include "wl1271_ps.h"
37 int wl1271_acx_wake_up_conditions(struct wl1271
*wl
)
39 struct acx_wake_up_condition
*wake_up
;
42 wl1271_debug(DEBUG_ACX
, "acx wake up conditions");
44 wake_up
= kzalloc(sizeof(*wake_up
), GFP_KERNEL
);
50 wake_up
->wake_up_event
= wl
->conf
.conn
.wake_up_event
;
51 wake_up
->listen_interval
= wl
->conf
.conn
.listen_interval
;
53 ret
= wl1271_cmd_configure(wl
, ACX_WAKE_UP_CONDITIONS
,
54 wake_up
, sizeof(*wake_up
));
56 wl1271_warning("could not set wake up conditions: %d", ret
);
65 int wl1271_acx_sleep_auth(struct wl1271
*wl
, u8 sleep_auth
)
67 struct acx_sleep_auth
*auth
;
70 wl1271_debug(DEBUG_ACX
, "acx sleep auth");
72 auth
= kzalloc(sizeof(*auth
), GFP_KERNEL
);
78 auth
->sleep_auth
= sleep_auth
;
80 ret
= wl1271_cmd_configure(wl
, ACX_SLEEP_AUTH
, auth
, sizeof(*auth
));
89 int wl1271_acx_fw_version(struct wl1271
*wl
, char *buf
, size_t len
)
91 struct acx_revision
*rev
;
94 wl1271_debug(DEBUG_ACX
, "acx fw rev");
96 rev
= kzalloc(sizeof(*rev
), GFP_KERNEL
);
102 ret
= wl1271_cmd_interrogate(wl
, ACX_FW_REV
, rev
, sizeof(*rev
));
104 wl1271_warning("ACX_FW_REV interrogate failed");
108 /* be careful with the buffer sizes */
109 strncpy(buf
, rev
->fw_version
, min(len
, sizeof(rev
->fw_version
)));
112 * if the firmware version string is exactly
113 * sizeof(rev->fw_version) long or fw_len is less than
114 * sizeof(rev->fw_version) it won't be null terminated
116 buf
[min(len
, sizeof(rev
->fw_version
)) - 1] = '\0';
123 int wl1271_acx_tx_power(struct wl1271
*wl
, int power
)
125 struct acx_current_tx_power
*acx
;
128 wl1271_debug(DEBUG_ACX
, "acx dot11_cur_tx_pwr");
130 if (power
< 0 || power
> 25)
133 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
140 * FIXME: This is a workaround needed while we don't the correct
141 * calibration, to avoid distortions
143 /* acx->current_tx_power = power * 10; */
144 acx
->current_tx_power
= 120;
146 ret
= wl1271_cmd_configure(wl
, DOT11_CUR_TX_PWR
, acx
, sizeof(*acx
));
148 wl1271_warning("configure of tx power failed: %d", ret
);
157 int wl1271_acx_feature_cfg(struct wl1271
*wl
)
159 struct acx_feature_config
*feature
;
162 wl1271_debug(DEBUG_ACX
, "acx feature cfg");
164 feature
= kzalloc(sizeof(*feature
), GFP_KERNEL
);
170 /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */
171 feature
->data_flow_options
= 0;
172 feature
->options
= 0;
174 ret
= wl1271_cmd_configure(wl
, ACX_FEATURE_CFG
,
175 feature
, sizeof(*feature
));
177 wl1271_error("Couldnt set HW encryption");
186 int wl1271_acx_mem_map(struct wl1271
*wl
, struct acx_header
*mem_map
,
191 wl1271_debug(DEBUG_ACX
, "acx mem map");
193 ret
= wl1271_cmd_interrogate(wl
, ACX_MEM_MAP
, mem_map
, len
);
200 int wl1271_acx_rx_msdu_life_time(struct wl1271
*wl
)
202 struct acx_rx_msdu_lifetime
*acx
;
205 wl1271_debug(DEBUG_ACX
, "acx rx msdu life time");
207 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
213 acx
->lifetime
= cpu_to_le32(wl
->conf
.rx
.rx_msdu_life_time
);
214 ret
= wl1271_cmd_configure(wl
, DOT11_RX_MSDU_LIFE_TIME
,
217 wl1271_warning("failed to set rx msdu life time: %d", ret
);
226 int wl1271_acx_rx_config(struct wl1271
*wl
, u32 config
, u32 filter
)
228 struct acx_rx_config
*rx_config
;
231 wl1271_debug(DEBUG_ACX
, "acx rx config");
233 rx_config
= kzalloc(sizeof(*rx_config
), GFP_KERNEL
);
239 rx_config
->config_options
= cpu_to_le32(config
);
240 rx_config
->filter_options
= cpu_to_le32(filter
);
242 ret
= wl1271_cmd_configure(wl
, ACX_RX_CFG
,
243 rx_config
, sizeof(*rx_config
));
245 wl1271_warning("failed to set rx config: %d", ret
);
254 int wl1271_acx_pd_threshold(struct wl1271
*wl
)
256 struct acx_packet_detection
*pd
;
259 wl1271_debug(DEBUG_ACX
, "acx data pd threshold");
261 pd
= kzalloc(sizeof(*pd
), GFP_KERNEL
);
267 pd
->threshold
= cpu_to_le32(wl
->conf
.rx
.packet_detection_threshold
);
269 ret
= wl1271_cmd_configure(wl
, ACX_PD_THRESHOLD
, pd
, sizeof(*pd
));
271 wl1271_warning("failed to set pd threshold: %d", ret
);
280 int wl1271_acx_slot(struct wl1271
*wl
, enum acx_slot_type slot_time
)
282 struct acx_slot
*slot
;
285 wl1271_debug(DEBUG_ACX
, "acx slot");
287 slot
= kzalloc(sizeof(*slot
), GFP_KERNEL
);
293 slot
->wone_index
= STATION_WONE_INDEX
;
294 slot
->slot_time
= slot_time
;
296 ret
= wl1271_cmd_configure(wl
, ACX_SLOT
, slot
, sizeof(*slot
));
298 wl1271_warning("failed to set slot time: %d", ret
);
307 int wl1271_acx_group_address_tbl(struct wl1271
*wl
, bool enable
,
308 void *mc_list
, u32 mc_list_len
)
310 struct acx_dot11_grp_addr_tbl
*acx
;
313 wl1271_debug(DEBUG_ACX
, "acx group address tbl");
315 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
322 acx
->enabled
= enable
;
323 acx
->num_groups
= mc_list_len
;
324 memcpy(acx
->mac_table
, mc_list
, mc_list_len
* ETH_ALEN
);
326 ret
= wl1271_cmd_configure(wl
, DOT11_GROUP_ADDRESS_TBL
,
329 wl1271_warning("failed to set group addr table: %d", ret
);
338 int wl1271_acx_service_period_timeout(struct wl1271
*wl
)
340 struct acx_rx_timeout
*rx_timeout
;
343 rx_timeout
= kzalloc(sizeof(*rx_timeout
), GFP_KERNEL
);
349 wl1271_debug(DEBUG_ACX
, "acx service period timeout");
351 rx_timeout
->ps_poll_timeout
= cpu_to_le16(wl
->conf
.rx
.ps_poll_timeout
);
352 rx_timeout
->upsd_timeout
= cpu_to_le16(wl
->conf
.rx
.upsd_timeout
);
354 ret
= wl1271_cmd_configure(wl
, ACX_SERVICE_PERIOD_TIMEOUT
,
355 rx_timeout
, sizeof(*rx_timeout
));
357 wl1271_warning("failed to set service period timeout: %d",
367 int wl1271_acx_rts_threshold(struct wl1271
*wl
, u16 rts_threshold
)
369 struct acx_rts_threshold
*rts
;
372 wl1271_debug(DEBUG_ACX
, "acx rts threshold");
374 rts
= kzalloc(sizeof(*rts
), GFP_KERNEL
);
380 rts
->threshold
= cpu_to_le16(rts_threshold
);
382 ret
= wl1271_cmd_configure(wl
, DOT11_RTS_THRESHOLD
, rts
, sizeof(*rts
));
384 wl1271_warning("failed to set rts threshold: %d", ret
);
393 int wl1271_acx_dco_itrim_params(struct wl1271
*wl
)
395 struct acx_dco_itrim_params
*dco
;
396 struct conf_itrim_settings
*c
= &wl
->conf
.itrim
;
399 wl1271_debug(DEBUG_ACX
, "acx dco itrim parameters");
401 dco
= kzalloc(sizeof(*dco
), GFP_KERNEL
);
407 dco
->enable
= c
->enable
;
408 dco
->timeout
= cpu_to_le32(c
->timeout
);
410 ret
= wl1271_cmd_configure(wl
, ACX_SET_DCO_ITRIM_PARAMS
,
413 wl1271_warning("failed to set dco itrim parameters: %d", ret
);
422 int wl1271_acx_beacon_filter_opt(struct wl1271
*wl
, bool enable_filter
)
424 struct acx_beacon_filter_option
*beacon_filter
= NULL
;
427 wl1271_debug(DEBUG_ACX
, "acx beacon filter opt");
430 wl
->conf
.conn
.bcn_filt_mode
== CONF_BCN_FILT_MODE_DISABLED
)
433 beacon_filter
= kzalloc(sizeof(*beacon_filter
), GFP_KERNEL
);
434 if (!beacon_filter
) {
439 beacon_filter
->enable
= enable_filter
;
442 * When set to zero, and the filter is enabled, beacons
443 * without the unicast TIM bit set are dropped.
445 beacon_filter
->max_num_beacons
= 0;
447 ret
= wl1271_cmd_configure(wl
, ACX_BEACON_FILTER_OPT
,
448 beacon_filter
, sizeof(*beacon_filter
));
450 wl1271_warning("failed to set beacon filter opt: %d", ret
);
455 kfree(beacon_filter
);
459 int wl1271_acx_beacon_filter_table(struct wl1271
*wl
)
461 struct acx_beacon_filter_ie_table
*ie_table
;
464 bool vendor_spec
= false;
466 wl1271_debug(DEBUG_ACX
, "acx beacon filter table");
468 ie_table
= kzalloc(sizeof(*ie_table
), GFP_KERNEL
);
474 /* configure default beacon pass-through rules */
475 ie_table
->num_ie
= 0;
476 for (i
= 0; i
< wl
->conf
.conn
.bcn_filt_ie_count
; i
++) {
477 struct conf_bcn_filt_rule
*r
= &(wl
->conf
.conn
.bcn_filt_ie
[i
]);
478 ie_table
->table
[idx
++] = r
->ie
;
479 ie_table
->table
[idx
++] = r
->rule
;
481 if (r
->ie
== WLAN_EID_VENDOR_SPECIFIC
) {
482 /* only one vendor specific ie allowed */
486 /* for vendor specific rules configure the
488 memcpy(&(ie_table
->table
[idx
]), r
->oui
,
489 CONF_BCN_IE_OUI_LEN
);
490 idx
+= CONF_BCN_IE_OUI_LEN
;
491 ie_table
->table
[idx
++] = r
->type
;
492 memcpy(&(ie_table
->table
[idx
]), r
->version
,
493 CONF_BCN_IE_VER_LEN
);
494 idx
+= CONF_BCN_IE_VER_LEN
;
501 ret
= wl1271_cmd_configure(wl
, ACX_BEACON_FILTER_TABLE
,
502 ie_table
, sizeof(*ie_table
));
504 wl1271_warning("failed to set beacon filter table: %d", ret
);
513 int wl1271_acx_conn_monit_params(struct wl1271
*wl
)
515 struct acx_conn_monit_params
*acx
;
518 wl1271_debug(DEBUG_ACX
, "acx connection monitor parameters");
520 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
526 acx
->synch_fail_thold
= cpu_to_le32(wl
->conf
.conn
.synch_fail_thold
);
527 acx
->bss_lose_timeout
= cpu_to_le32(wl
->conf
.conn
.bss_lose_timeout
);
529 ret
= wl1271_cmd_configure(wl
, ACX_CONN_MONIT_PARAMS
,
532 wl1271_warning("failed to set connection monitor "
533 "parameters: %d", ret
);
543 int wl1271_acx_sg_enable(struct wl1271
*wl
)
545 struct acx_bt_wlan_coex
*pta
;
548 wl1271_debug(DEBUG_ACX
, "acx sg enable");
550 pta
= kzalloc(sizeof(*pta
), GFP_KERNEL
);
556 pta
->enable
= SG_ENABLE
;
558 ret
= wl1271_cmd_configure(wl
, ACX_SG_ENABLE
, pta
, sizeof(*pta
));
560 wl1271_warning("failed to set softgemini enable: %d", ret
);
569 int wl1271_acx_sg_cfg(struct wl1271
*wl
)
571 struct acx_bt_wlan_coex_param
*param
;
572 struct conf_sg_settings
*c
= &wl
->conf
.sg
;
575 wl1271_debug(DEBUG_ACX
, "acx sg cfg");
577 param
= kzalloc(sizeof(*param
), GFP_KERNEL
);
583 /* BT-WLAN coext parameters */
584 param
->per_threshold
= cpu_to_le32(c
->per_threshold
);
585 param
->max_scan_compensation_time
=
586 cpu_to_le32(c
->max_scan_compensation_time
);
587 param
->nfs_sample_interval
= cpu_to_le16(c
->nfs_sample_interval
);
588 param
->load_ratio
= c
->load_ratio
;
589 param
->auto_ps_mode
= c
->auto_ps_mode
;
590 param
->probe_req_compensation
= c
->probe_req_compensation
;
591 param
->scan_window_compensation
= c
->scan_window_compensation
;
592 param
->antenna_config
= c
->antenna_config
;
593 param
->beacon_miss_threshold
= c
->beacon_miss_threshold
;
594 param
->rate_adaptation_threshold
=
595 cpu_to_le32(c
->rate_adaptation_threshold
);
596 param
->rate_adaptation_snr
= c
->rate_adaptation_snr
;
598 ret
= wl1271_cmd_configure(wl
, ACX_SG_CFG
, param
, sizeof(*param
));
600 wl1271_warning("failed to set sg config: %d", ret
);
609 int wl1271_acx_cca_threshold(struct wl1271
*wl
)
611 struct acx_energy_detection
*detection
;
614 wl1271_debug(DEBUG_ACX
, "acx cca threshold");
616 detection
= kzalloc(sizeof(*detection
), GFP_KERNEL
);
622 detection
->rx_cca_threshold
= cpu_to_le16(wl
->conf
.rx
.rx_cca_threshold
);
623 detection
->tx_energy_detection
= wl
->conf
.tx
.tx_energy_detection
;
625 ret
= wl1271_cmd_configure(wl
, ACX_CCA_THRESHOLD
,
626 detection
, sizeof(*detection
));
628 wl1271_warning("failed to set cca threshold: %d", ret
);
637 int wl1271_acx_bcn_dtim_options(struct wl1271
*wl
)
639 struct acx_beacon_broadcast
*bb
;
642 wl1271_debug(DEBUG_ACX
, "acx bcn dtim options");
644 bb
= kzalloc(sizeof(*bb
), GFP_KERNEL
);
650 bb
->beacon_rx_timeout
= cpu_to_le16(wl
->conf
.conn
.beacon_rx_timeout
);
651 bb
->broadcast_timeout
= cpu_to_le16(wl
->conf
.conn
.broadcast_timeout
);
652 bb
->rx_broadcast_in_ps
= wl
->conf
.conn
.rx_broadcast_in_ps
;
653 bb
->ps_poll_threshold
= wl
->conf
.conn
.ps_poll_threshold
;
655 ret
= wl1271_cmd_configure(wl
, ACX_BCN_DTIM_OPTIONS
, bb
, sizeof(*bb
));
657 wl1271_warning("failed to set rx config: %d", ret
);
666 int wl1271_acx_aid(struct wl1271
*wl
, u16 aid
)
668 struct acx_aid
*acx_aid
;
671 wl1271_debug(DEBUG_ACX
, "acx aid");
673 acx_aid
= kzalloc(sizeof(*acx_aid
), GFP_KERNEL
);
679 acx_aid
->aid
= cpu_to_le16(aid
);
681 ret
= wl1271_cmd_configure(wl
, ACX_AID
, acx_aid
, sizeof(*acx_aid
));
683 wl1271_warning("failed to set aid: %d", ret
);
692 int wl1271_acx_event_mbox_mask(struct wl1271
*wl
, u32 event_mask
)
694 struct acx_event_mask
*mask
;
697 wl1271_debug(DEBUG_ACX
, "acx event mbox mask");
699 mask
= kzalloc(sizeof(*mask
), GFP_KERNEL
);
705 /* high event mask is unused */
706 mask
->high_event_mask
= cpu_to_le32(0xffffffff);
707 mask
->event_mask
= cpu_to_le32(event_mask
);
709 ret
= wl1271_cmd_configure(wl
, ACX_EVENT_MBOX_MASK
,
710 mask
, sizeof(*mask
));
712 wl1271_warning("failed to set acx_event_mbox_mask: %d", ret
);
721 int wl1271_acx_set_preamble(struct wl1271
*wl
, enum acx_preamble_type preamble
)
723 struct acx_preamble
*acx
;
726 wl1271_debug(DEBUG_ACX
, "acx_set_preamble");
728 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
734 acx
->preamble
= preamble
;
736 ret
= wl1271_cmd_configure(wl
, ACX_PREAMBLE_TYPE
, acx
, sizeof(*acx
));
738 wl1271_warning("Setting of preamble failed: %d", ret
);
747 int wl1271_acx_cts_protect(struct wl1271
*wl
,
748 enum acx_ctsprotect_type ctsprotect
)
750 struct acx_ctsprotect
*acx
;
753 wl1271_debug(DEBUG_ACX
, "acx_set_ctsprotect");
755 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
761 acx
->ctsprotect
= ctsprotect
;
763 ret
= wl1271_cmd_configure(wl
, ACX_CTS_PROTECTION
, acx
, sizeof(*acx
));
765 wl1271_warning("Setting of ctsprotect failed: %d", ret
);
774 int wl1271_acx_statistics(struct wl1271
*wl
, struct acx_statistics
*stats
)
778 wl1271_debug(DEBUG_ACX
, "acx statistics");
780 ret
= wl1271_cmd_interrogate(wl
, ACX_STATISTICS
, stats
,
783 wl1271_warning("acx statistics failed: %d", ret
);
790 int wl1271_acx_rate_policies(struct wl1271
*wl
, u32 enabled_rates
)
792 struct acx_rate_policy
*acx
;
793 struct conf_tx_rate_class
*c
= &wl
->conf
.tx
.rc_conf
;
796 wl1271_debug(DEBUG_ACX
, "acx rate policies");
798 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
805 /* configure one default (one-size-fits-all) rate class */
806 acx
->rate_class_cnt
= cpu_to_le32(1);
807 acx
->rate_class
[0].enabled_rates
= cpu_to_le32(enabled_rates
);
808 acx
->rate_class
[0].short_retry_limit
= c
->short_retry_limit
;
809 acx
->rate_class
[0].long_retry_limit
= c
->long_retry_limit
;
810 acx
->rate_class
[0].aflags
= c
->aflags
;
812 ret
= wl1271_cmd_configure(wl
, ACX_RATE_POLICY
, acx
, sizeof(*acx
));
814 wl1271_warning("Setting of rate policies failed: %d", ret
);
823 int wl1271_acx_ac_cfg(struct wl1271
*wl
)
825 struct acx_ac_cfg
*acx
;
828 wl1271_debug(DEBUG_ACX
, "acx access category config");
830 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
837 for (i
= 0; i
< wl
->conf
.tx
.ac_conf_count
; i
++) {
838 struct conf_tx_ac_category
*c
= &(wl
->conf
.tx
.ac_conf
[i
]);
840 acx
->cw_min
= c
->cw_min
;
841 acx
->cw_max
= cpu_to_le16(c
->cw_max
);
842 acx
->aifsn
= c
->aifsn
;
844 acx
->tx_op_limit
= cpu_to_le16(c
->tx_op_limit
);
846 ret
= wl1271_cmd_configure(wl
, ACX_AC_CFG
, acx
, sizeof(*acx
));
848 wl1271_warning("Setting of access category "
859 int wl1271_acx_tid_cfg(struct wl1271
*wl
)
861 struct acx_tid_config
*acx
;
864 wl1271_debug(DEBUG_ACX
, "acx tid config");
866 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
873 for (i
= 0; i
< wl
->conf
.tx
.tid_conf_count
; i
++) {
874 struct conf_tx_tid
*c
= &(wl
->conf
.tx
.tid_conf
[i
]);
875 acx
->queue_id
= c
->queue_id
;
876 acx
->channel_type
= c
->channel_type
;
878 acx
->ps_scheme
= c
->ps_scheme
;
879 acx
->ack_policy
= c
->ack_policy
;
880 acx
->apsd_conf
[0] = cpu_to_le32(c
->apsd_conf
[0]);
881 acx
->apsd_conf
[1] = cpu_to_le32(c
->apsd_conf
[1]);
883 ret
= wl1271_cmd_configure(wl
, ACX_TID_CFG
, acx
, sizeof(*acx
));
885 wl1271_warning("Setting of tid config failed: %d", ret
);
895 int wl1271_acx_frag_threshold(struct wl1271
*wl
)
897 struct acx_frag_threshold
*acx
;
900 wl1271_debug(DEBUG_ACX
, "acx frag threshold");
902 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
909 acx
->frag_threshold
= cpu_to_le16(wl
->conf
.tx
.frag_threshold
);
910 ret
= wl1271_cmd_configure(wl
, ACX_FRAG_CFG
, acx
, sizeof(*acx
));
912 wl1271_warning("Setting of frag threshold failed: %d", ret
);
921 int wl1271_acx_tx_config_options(struct wl1271
*wl
)
923 struct acx_tx_config_options
*acx
;
926 wl1271_debug(DEBUG_ACX
, "acx tx config options");
928 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
935 acx
->tx_compl_timeout
= cpu_to_le16(wl
->conf
.tx
.tx_compl_timeout
);
936 acx
->tx_compl_threshold
= cpu_to_le16(wl
->conf
.tx
.tx_compl_threshold
);
937 ret
= wl1271_cmd_configure(wl
, ACX_TX_CONFIG_OPT
, acx
, sizeof(*acx
));
939 wl1271_warning("Setting of tx options failed: %d", ret
);
948 int wl1271_acx_mem_cfg(struct wl1271
*wl
)
950 struct wl1271_acx_config_memory
*mem_conf
;
953 wl1271_debug(DEBUG_ACX
, "wl1271 mem cfg");
955 mem_conf
= kzalloc(sizeof(*mem_conf
), GFP_KERNEL
);
962 mem_conf
->num_stations
= DEFAULT_NUM_STATIONS
;
963 mem_conf
->rx_mem_block_num
= ACX_RX_MEM_BLOCKS
;
964 mem_conf
->tx_min_mem_block_num
= ACX_TX_MIN_MEM_BLOCKS
;
965 mem_conf
->num_ssid_profiles
= ACX_NUM_SSID_PROFILES
;
966 mem_conf
->total_tx_descriptors
= cpu_to_le32(ACX_TX_DESCRIPTORS
);
968 ret
= wl1271_cmd_configure(wl
, ACX_MEM_CFG
, mem_conf
,
971 wl1271_warning("wl1271 mem config failed: %d", ret
);
980 int wl1271_acx_init_mem_config(struct wl1271
*wl
)
984 ret
= wl1271_acx_mem_cfg(wl
);
988 wl
->target_mem_map
= kzalloc(sizeof(struct wl1271_acx_mem_map
),
990 if (!wl
->target_mem_map
) {
991 wl1271_error("couldn't allocate target memory map");
995 /* we now ask for the firmware built memory map */
996 ret
= wl1271_acx_mem_map(wl
, (void *)wl
->target_mem_map
,
997 sizeof(struct wl1271_acx_mem_map
));
999 wl1271_error("couldn't retrieve firmware memory map");
1000 kfree(wl
->target_mem_map
);
1001 wl
->target_mem_map
= NULL
;
1005 /* initialize TX block book keeping */
1006 wl
->tx_blocks_available
=
1007 le32_to_cpu(wl
->target_mem_map
->num_tx_mem_blocks
);
1008 wl1271_debug(DEBUG_TX
, "available tx blocks: %d",
1009 wl
->tx_blocks_available
);
1014 int wl1271_acx_init_rx_interrupt(struct wl1271
*wl
)
1016 struct wl1271_acx_rx_config_opt
*rx_conf
;
1019 wl1271_debug(DEBUG_ACX
, "wl1271 rx interrupt config");
1021 rx_conf
= kzalloc(sizeof(*rx_conf
), GFP_KERNEL
);
1027 rx_conf
->threshold
= cpu_to_le16(wl
->conf
.rx
.irq_pkt_threshold
);
1028 rx_conf
->timeout
= cpu_to_le16(wl
->conf
.rx
.irq_timeout
);
1029 rx_conf
->mblk_threshold
= cpu_to_le16(wl
->conf
.rx
.irq_blk_threshold
);
1030 rx_conf
->queue_type
= wl
->conf
.rx
.queue_type
;
1032 ret
= wl1271_cmd_configure(wl
, ACX_RX_CONFIG_OPT
, rx_conf
,
1035 wl1271_warning("wl1271 rx config opt failed: %d", ret
);
1044 int wl1271_acx_smart_reflex(struct wl1271
*wl
)
1046 struct acx_smart_reflex_state
*sr_state
= NULL
;
1047 struct acx_smart_reflex_config_params
*sr_param
= NULL
;
1050 wl1271_debug(DEBUG_ACX
, "acx smart reflex");
1052 sr_param
= kzalloc(sizeof(*sr_param
), GFP_KERNEL
);
1058 for (i
= 0; i
< CONF_SR_ERR_TBL_COUNT
; i
++) {
1059 struct conf_mart_reflex_err_table
*e
=
1060 &(wl
->conf
.init
.sr_err_tbl
[i
]);
1062 sr_param
->error_table
[i
].len
= e
->len
;
1063 sr_param
->error_table
[i
].upper_limit
= e
->upper_limit
;
1064 memcpy(sr_param
->error_table
[i
].values
, e
->values
, e
->len
);
1067 ret
= wl1271_cmd_configure(wl
, ACX_SET_SMART_REFLEX_PARAMS
,
1068 sr_param
, sizeof(*sr_param
));
1070 wl1271_warning("failed to set smart reflex params: %d", ret
);
1074 sr_state
= kzalloc(sizeof(*sr_state
), GFP_KERNEL
);
1080 /* enable smart reflex */
1081 sr_state
->enable
= wl
->conf
.init
.sr_enable
;
1083 ret
= wl1271_cmd_configure(wl
, ACX_SET_SMART_REFLEX_STATE
,
1084 sr_state
, sizeof(*sr_state
));
1086 wl1271_warning("failed to set smart reflex params: %d", ret
);
1097 int wl1271_acx_bet_enable(struct wl1271
*wl
, bool enable
)
1099 struct wl1271_acx_bet_enable
*acx
= NULL
;
1102 wl1271_debug(DEBUG_ACX
, "acx bet enable");
1104 if (enable
&& wl
->conf
.conn
.bet_enable
== CONF_BET_MODE_DISABLE
)
1107 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1113 acx
->enable
= enable
? CONF_BET_MODE_ENABLE
: CONF_BET_MODE_DISABLE
;
1114 acx
->max_consecutive
= wl
->conf
.conn
.bet_max_consecutive
;
1116 ret
= wl1271_cmd_configure(wl
, ACX_BET_ENABLE
, acx
, sizeof(*acx
));
1118 wl1271_warning("acx bet enable failed: %d", ret
);
1127 int wl1271_acx_arp_ip_filter(struct wl1271
*wl
, bool enable
, u8
*address
,
1130 struct wl1271_acx_arp_filter
*acx
;
1133 wl1271_debug(DEBUG_ACX
, "acx arp ip filter, enable: %d", enable
);
1135 acx
= kzalloc(sizeof(*acx
), GFP_KERNEL
);
1141 acx
->version
= version
;
1142 acx
->enable
= enable
;
1144 if (enable
== true) {
1145 if (version
== ACX_IPV4_VERSION
)
1146 memcpy(acx
->address
, address
, ACX_IPV4_ADDR_SIZE
);
1147 else if (version
== ACX_IPV6_VERSION
)
1148 memcpy(acx
->address
, address
, sizeof(acx
->address
));
1150 wl1271_error("Invalid IP version");
1153 ret
= wl1271_cmd_configure(wl
, ACX_ARP_IP_FILTER
,
1156 wl1271_warning("failed to set arp ip filter: %d", ret
);