2009-08-06 13:25:28 +00:00
|
|
|
/*
|
|
|
|
* 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 cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2009-08-06 13:25:28 +00:00
|
|
|
|
|
|
|
#include "wl1271_init.h"
|
|
|
|
#include "wl12xx_80211.h"
|
|
|
|
#include "wl1271_acx.h"
|
|
|
|
#include "wl1271_cmd.h"
|
|
|
|
#include "wl1271_reg.h"
|
|
|
|
|
|
|
|
static int wl1271_init_hwenc_config(struct wl1271 *wl)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = wl1271_acx_feature_cfg(wl);
|
|
|
|
if (ret < 0) {
|
|
|
|
wl1271_warning("couldn't set feature config");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = wl1271_cmd_set_default_wep_key(wl, wl->default_key);
|
|
|
|
if (ret < 0) {
|
|
|
|
wl1271_warning("couldn't set default key");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-02-18 11:25:44 +00:00
|
|
|
int wl1271_init_templates_config(struct wl1271 *wl)
|
2009-08-06 13:25:28 +00:00
|
|
|
{
|
2010-03-26 10:53:31 +00:00
|
|
|
int ret, i;
|
2010-08-24 03:28:03 +00:00
|
|
|
size_t size;
|
2009-08-06 13:25:28 +00:00
|
|
|
|
|
|
|
/* send empty templates for fw memory reservation */
|
|
|
|
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL,
|
2010-03-26 10:53:31 +00:00
|
|
|
sizeof(struct wl12xx_probe_req_template),
|
2010-04-01 08:38:21 +00:00
|
|
|
0, WL1271_RATE_AUTOMATIC);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2010-08-24 03:28:03 +00:00
|
|
|
size = sizeof(struct wl12xx_probe_req_template);
|
|
|
|
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5,
|
|
|
|
NULL, size, 0,
|
|
|
|
WL1271_RATE_AUTOMATIC);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2009-10-13 09:47:50 +00:00
|
|
|
|
2009-08-06 13:25:28 +00:00
|
|
|
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL,
|
2010-03-26 10:53:31 +00:00
|
|
|
sizeof(struct wl12xx_null_data_template),
|
2010-04-01 08:38:21 +00:00
|
|
|
0, WL1271_RATE_AUTOMATIC);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PS_POLL, NULL,
|
2010-03-26 10:53:31 +00:00
|
|
|
sizeof(struct wl12xx_ps_poll_template),
|
2010-04-01 08:38:21 +00:00
|
|
|
0, WL1271_RATE_AUTOMATIC);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, NULL,
|
|
|
|
sizeof
|
2010-03-26 10:53:31 +00:00
|
|
|
(struct wl12xx_qos_null_data_template),
|
2010-04-01 08:38:21 +00:00
|
|
|
0, WL1271_RATE_AUTOMATIC);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL,
|
|
|
|
sizeof
|
2010-03-26 10:53:31 +00:00
|
|
|
(struct wl12xx_probe_resp_template),
|
2010-04-01 08:38:21 +00:00
|
|
|
0, WL1271_RATE_AUTOMATIC);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL,
|
|
|
|
sizeof
|
2010-03-26 10:53:31 +00:00
|
|
|
(struct wl12xx_beacon_template),
|
2010-04-01 08:38:21 +00:00
|
|
|
0, WL1271_RATE_AUTOMATIC);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2010-03-26 10:53:31 +00:00
|
|
|
for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
|
|
|
|
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, NULL,
|
2010-04-01 08:38:21 +00:00
|
|
|
WL1271_CMD_TEMPL_MAX_SIZE, i,
|
|
|
|
WL1271_RATE_AUTOMATIC);
|
2010-03-26 10:53:31 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-08-06 13:25:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int wl1271_init_rx_config(struct wl1271 *wl, u32 config, u32 filter)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2009-10-13 09:47:40 +00:00
|
|
|
ret = wl1271_acx_rx_msdu_life_time(wl);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = wl1271_acx_rx_config(wl, config, filter);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-02-18 11:25:44 +00:00
|
|
|
int wl1271_init_phy_config(struct wl1271 *wl)
|
2009-08-06 13:25:28 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = wl1271_acx_pd_threshold(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = wl1271_acx_slot(wl, DEFAULT_SLOT_TIME);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2009-10-08 18:56:31 +00:00
|
|
|
ret = wl1271_acx_group_address_tbl(wl, true, NULL, 0);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = wl1271_acx_service_period_timeout(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2009-10-13 09:47:40 +00:00
|
|
|
ret = wl1271_acx_rts_threshold(wl, wl->conf.rx.rts_threshold);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int wl1271_init_beacon_filter(struct wl1271 *wl)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2009-10-08 18:56:35 +00:00
|
|
|
/* disable beacon filtering at this stage */
|
|
|
|
ret = wl1271_acx_beacon_filter_opt(wl, false);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = wl1271_acx_beacon_filter_table(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-02-18 11:25:44 +00:00
|
|
|
int wl1271_init_pta(struct wl1271 *wl)
|
2009-08-06 13:25:28 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2010-03-18 10:26:30 +00:00
|
|
|
ret = wl1271_acx_sg_cfg(wl);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2010-03-18 10:26:32 +00:00
|
|
|
ret = wl1271_acx_sg_enable(wl, wl->sg_enabled);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-02-18 11:25:44 +00:00
|
|
|
int wl1271_init_energy_detection(struct wl1271 *wl)
|
2009-08-06 13:25:28 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = wl1271_acx_cca_threshold(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int wl1271_init_beacon_broadcast(struct wl1271 *wl)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = wl1271_acx_bcn_dtim_options(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int wl1271_hw_init(struct wl1271 *wl)
|
|
|
|
{
|
2010-02-18 11:25:39 +00:00
|
|
|
struct conf_tx_ac_category *conf_ac;
|
2010-02-18 11:25:40 +00:00
|
|
|
struct conf_tx_tid *conf_tid;
|
2010-02-18 11:25:39 +00:00
|
|
|
int ret, i;
|
2009-08-06 13:25:28 +00:00
|
|
|
|
2009-11-23 21:22:17 +00:00
|
|
|
ret = wl1271_cmd_general_parms(wl);
|
2009-11-23 21:22:18 +00:00
|
|
|
if (ret < 0)
|
2009-08-06 13:25:28 +00:00
|
|
|
return ret;
|
|
|
|
|
2009-11-23 21:22:17 +00:00
|
|
|
ret = wl1271_cmd_radio_parms(wl);
|
2009-11-23 21:22:18 +00:00
|
|
|
if (ret < 0)
|
2009-08-06 13:25:28 +00:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* Template settings */
|
|
|
|
ret = wl1271_init_templates_config(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* Default memory configuration */
|
|
|
|
ret = wl1271_acx_init_mem_config(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* RX config */
|
|
|
|
ret = wl1271_init_rx_config(wl,
|
2009-10-13 09:47:45 +00:00
|
|
|
RX_CFG_PROMISCUOUS | RX_CFG_TSF,
|
|
|
|
RX_FILTER_OPTION_DEF);
|
2009-08-06 13:25:28 +00:00
|
|
|
/* RX_CONFIG_OPTION_ANY_DST_ANY_BSS,
|
|
|
|
RX_FILTER_OPTION_FILTER_ALL); */
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
|
|
|
/* PHY layer config */
|
|
|
|
ret = wl1271_init_phy_config(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
2009-12-11 13:40:50 +00:00
|
|
|
ret = wl1271_acx_dco_itrim_params(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
2009-10-08 18:56:33 +00:00
|
|
|
/* Initialize connection monitoring thresholds */
|
2010-03-26 10:53:23 +00:00
|
|
|
ret = wl1271_acx_conn_monit_params(wl, false);
|
2009-10-08 18:56:33 +00:00
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
2009-08-06 13:25:28 +00:00
|
|
|
/* Beacon filtering */
|
|
|
|
ret = wl1271_init_beacon_filter(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;
|
|
|
|
|
|
|
|
/* Bluetooth WLAN coexistence */
|
|
|
|
ret = wl1271_init_pta(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
|
|
|
/* Energy detection */
|
|
|
|
ret = wl1271_init_energy_detection(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
|
|
|
/* Beacons and boradcast settings */
|
|
|
|
ret = wl1271_init_beacon_broadcast(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
|
|
|
/* Default fragmentation threshold */
|
|
|
|
ret = wl1271_acx_frag_threshold(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
2010-09-01 09:31:12 +00:00
|
|
|
/* Default TID/AC configuration */
|
|
|
|
BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count);
|
2010-02-18 11:25:40 +00:00
|
|
|
for (i = 0; i < wl->conf.tx.tid_conf_count; i++) {
|
2010-09-01 09:31:12 +00:00
|
|
|
conf_ac = &wl->conf.tx.ac_conf[i];
|
|
|
|
ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min,
|
|
|
|
conf_ac->cw_max, conf_ac->aifsn,
|
|
|
|
conf_ac->tx_op_limit);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
2010-02-18 11:25:40 +00:00
|
|
|
conf_tid = &wl->conf.tx.tid_conf[i];
|
|
|
|
ret = wl1271_acx_tid_cfg(wl, 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)
|
|
|
|
goto out_free_memmap;
|
|
|
|
}
|
2009-08-06 13:25:28 +00:00
|
|
|
|
|
|
|
/* Configure TX rate classes */
|
2009-12-11 13:41:06 +00:00
|
|
|
ret = wl1271_acx_rate_policies(wl);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
|
|
|
/* Enable data path */
|
2009-12-11 13:40:55 +00:00
|
|
|
ret = wl1271_cmd_data_path(wl, 1);
|
2009-08-06 13:25:28 +00:00
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
|
|
|
/* Configure for ELP power saving */
|
|
|
|
ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
|
|
|
/* Configure HW encryption */
|
|
|
|
ret = wl1271_init_hwenc_config(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
2009-12-11 13:41:08 +00:00
|
|
|
/* configure PM */
|
|
|
|
ret = wl1271_acx_pm_config(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
2010-03-26 10:53:32 +00:00
|
|
|
/* disable all keep-alive templates */
|
|
|
|
for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
|
|
|
|
ret = wl1271_acx_keep_alive_config(wl, i,
|
|
|
|
ACX_KEEP_ALIVE_TPL_INVALID);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* disable the keep-alive feature */
|
|
|
|
ret = wl1271_acx_keep_alive_mode(wl, false);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
2010-04-09 08:07:30 +00:00
|
|
|
/* Configure rssi/snr averaging weights */
|
|
|
|
ret = wl1271_acx_rssi_snr_avg_weights(wl);
|
|
|
|
if (ret < 0)
|
|
|
|
goto out_free_memmap;
|
|
|
|
|
2009-08-06 13:25:28 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
out_free_memmap:
|
|
|
|
kfree(wl->target_mem_map);
|
2009-10-08 18:56:33 +00:00
|
|
|
wl->target_mem_map = NULL;
|
2009-08-06 13:25:28 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|