diff options
author | Kalle Valo <kalle.valo@nokia.com> | 2009-04-29 16:33:31 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-06 15:14:54 -0400 |
commit | 2f01a1f58889fbfeb68b1bc1b52e4197f3333490 (patch) | |
tree | 949cf33c4e3dcdf7abcf95c9bda4d8372da04f97 /drivers/net/wireless/wl12xx/init.c | |
parent | d53d9e67b55f6a9fc3f836c5c392eb41ce5676f4 (diff) |
wl12xx: add driver
wl12xx is a driver for TI wl1251 802.11 chipset designed for embedded
devices, supporting both SDIO and SPI busses. Currently the driver
supports only SPI. Adding support 1253 (the 5 GHz version) should be
relatively easy. More information here:
http://focus.ti.com/general/docs/wtbu/wtbuproductcontent.tsp?contentId=4711&navigationId=12494&templateId=6123
(Collapsed original sequence of pre-merge patches into single commit for
initial merge. -- JWL)
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/init.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/init.c | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c new file mode 100644 index 000000000000..2a573a6010bd --- /dev/null +++ b/drivers/net/wireless/wl12xx/init.c | |||
@@ -0,0 +1,200 @@ | |||
1 | /* | ||
2 | * This file is part of wl12xx | ||
3 | * | ||
4 | * Copyright (C) 2009 Nokia Corporation | ||
5 | * | ||
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
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. | ||
11 | * | ||
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. | ||
16 | * | ||
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 | ||
20 | * 02110-1301 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/module.h> | ||
26 | |||
27 | #include "init.h" | ||
28 | #include "wl12xx_80211.h" | ||
29 | #include "acx.h" | ||
30 | #include "cmd.h" | ||
31 | |||
32 | int wl12xx_hw_init_hwenc_config(struct wl12xx *wl) | ||
33 | { | ||
34 | int ret; | ||
35 | |||
36 | ret = wl12xx_acx_feature_cfg(wl); | ||
37 | if (ret < 0) { | ||
38 | wl12xx_warning("couldn't set feature config"); | ||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | ret = wl12xx_acx_default_key(wl, wl->default_key); | ||
43 | if (ret < 0) { | ||
44 | wl12xx_warning("couldn't set default key"); | ||
45 | return ret; | ||
46 | } | ||
47 | |||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | int wl12xx_hw_init_templates_config(struct wl12xx *wl) | ||
52 | { | ||
53 | int ret; | ||
54 | u8 partial_vbm[PARTIAL_VBM_MAX]; | ||
55 | |||
56 | /* send empty templates for fw memory reservation */ | ||
57 | ret = wl12xx_cmd_template_set(wl, CMD_PROBE_REQ, NULL, | ||
58 | sizeof(struct wl12xx_probe_req_template)); | ||
59 | if (ret < 0) | ||
60 | return ret; | ||
61 | |||
62 | ret = wl12xx_cmd_template_set(wl, CMD_NULL_DATA, NULL, | ||
63 | sizeof(struct wl12xx_null_data_template)); | ||
64 | if (ret < 0) | ||
65 | return ret; | ||
66 | |||
67 | ret = wl12xx_cmd_template_set(wl, CMD_PS_POLL, NULL, | ||
68 | sizeof(struct wl12xx_ps_poll_template)); | ||
69 | if (ret < 0) | ||
70 | return ret; | ||
71 | |||
72 | ret = wl12xx_cmd_template_set(wl, CMD_QOS_NULL_DATA, NULL, | ||
73 | sizeof | ||
74 | (struct wl12xx_qos_null_data_template)); | ||
75 | if (ret < 0) | ||
76 | return ret; | ||
77 | |||
78 | ret = wl12xx_cmd_template_set(wl, CMD_PROBE_RESP, NULL, | ||
79 | sizeof | ||
80 | (struct wl12xx_probe_resp_template)); | ||
81 | if (ret < 0) | ||
82 | return ret; | ||
83 | |||
84 | ret = wl12xx_cmd_template_set(wl, CMD_BEACON, NULL, | ||
85 | sizeof | ||
86 | (struct wl12xx_beacon_template)); | ||
87 | if (ret < 0) | ||
88 | return ret; | ||
89 | |||
90 | /* tim templates, first reserve space then allocate an empty one */ | ||
91 | memset(partial_vbm, 0, PARTIAL_VBM_MAX); | ||
92 | ret = wl12xx_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, PARTIAL_VBM_MAX, 0); | ||
93 | if (ret < 0) | ||
94 | return ret; | ||
95 | |||
96 | ret = wl12xx_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, 1, 0); | ||
97 | if (ret < 0) | ||
98 | return ret; | ||
99 | |||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | int wl12xx_hw_init_rx_config(struct wl12xx *wl, u32 config, u32 filter) | ||
104 | { | ||
105 | int ret; | ||
106 | |||
107 | ret = wl12xx_acx_rx_msdu_life_time(wl, RX_MSDU_LIFETIME_DEF); | ||
108 | if (ret < 0) | ||
109 | return ret; | ||
110 | |||
111 | ret = wl12xx_acx_rx_config(wl, config, filter); | ||
112 | if (ret < 0) | ||
113 | return ret; | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | int wl12xx_hw_init_phy_config(struct wl12xx *wl) | ||
119 | { | ||
120 | int ret; | ||
121 | |||
122 | ret = wl12xx_acx_pd_threshold(wl); | ||
123 | if (ret < 0) | ||
124 | return ret; | ||
125 | |||
126 | ret = wl12xx_acx_slot(wl, DEFAULT_SLOT_TIME); | ||
127 | if (ret < 0) | ||
128 | return ret; | ||
129 | |||
130 | ret = wl12xx_acx_group_address_tbl(wl); | ||
131 | if (ret < 0) | ||
132 | return ret; | ||
133 | |||
134 | ret = wl12xx_acx_service_period_timeout(wl); | ||
135 | if (ret < 0) | ||
136 | return ret; | ||
137 | |||
138 | ret = wl12xx_acx_rts_threshold(wl, RTS_THRESHOLD_DEF); | ||
139 | if (ret < 0) | ||
140 | return ret; | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | int wl12xx_hw_init_beacon_filter(struct wl12xx *wl) | ||
146 | { | ||
147 | int ret; | ||
148 | |||
149 | ret = wl12xx_acx_beacon_filter_opt(wl); | ||
150 | if (ret < 0) | ||
151 | return ret; | ||
152 | |||
153 | ret = wl12xx_acx_beacon_filter_table(wl); | ||
154 | if (ret < 0) | ||
155 | return ret; | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | int wl12xx_hw_init_pta(struct wl12xx *wl) | ||
161 | { | ||
162 | int ret; | ||
163 | |||
164 | ret = wl12xx_acx_sg_enable(wl); | ||
165 | if (ret < 0) | ||
166 | return ret; | ||
167 | |||
168 | ret = wl12xx_acx_sg_cfg(wl); | ||
169 | if (ret < 0) | ||
170 | return ret; | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | int wl12xx_hw_init_energy_detection(struct wl12xx *wl) | ||
176 | { | ||
177 | int ret; | ||
178 | |||
179 | ret = wl12xx_acx_cca_threshold(wl); | ||
180 | if (ret < 0) | ||
181 | return ret; | ||
182 | |||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | int wl12xx_hw_init_beacon_broadcast(struct wl12xx *wl) | ||
187 | { | ||
188 | int ret; | ||
189 | |||
190 | ret = wl12xx_acx_bcn_dtim_options(wl); | ||
191 | if (ret < 0) | ||
192 | return ret; | ||
193 | |||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | int wl12xx_hw_init_power_auth(struct wl12xx *wl) | ||
198 | { | ||
199 | return wl12xx_acx_sleep_auth(wl, WL12XX_PSM_CAM); | ||
200 | } | ||