Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of wl1271 |
| 3 | * |
| 4 | * Copyright (C) 2009 Nokia Corporation |
| 5 | * |
| 6 | * Contact: Luciano Coelho <luciano.coelho@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> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 26 | #include <linux/slab.h> |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 27 | |
Shahar Levi | 00d2010 | 2010-11-08 11:20:10 +0000 | [diff] [blame] | 28 | #include "init.h" |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 29 | #include "wl12xx_80211.h" |
Shahar Levi | 00d2010 | 2010-11-08 11:20:10 +0000 | [diff] [blame] | 30 | #include "acx.h" |
| 31 | #include "cmd.h" |
| 32 | #include "reg.h" |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 33 | #include "tx.h" |
Shahar Levi | 48a6147 | 2011-03-06 16:32:08 +0200 | [diff] [blame] | 34 | #include "io.h" |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 35 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 36 | int wl1271_init_templates_config(struct wl1271 *wl) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 37 | { |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 38 | int ret, i; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 39 | |
| 40 | /* send empty templates for fw memory reservation */ |
| 41 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL, |
Eliad Peller | 154037d | 2011-08-14 13:17:12 +0300 | [diff] [blame] | 42 | WL1271_CMD_TEMPL_DFLT_SIZE, |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 43 | 0, WL1271_RATE_AUTOMATIC); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 44 | if (ret < 0) |
| 45 | return ret; |
| 46 | |
Juuso Oikarinen | 11eb542 | 2010-08-24 06:28:03 +0300 | [diff] [blame] | 47 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5, |
Eliad Peller | 154037d | 2011-08-14 13:17:12 +0300 | [diff] [blame] | 48 | NULL, WL1271_CMD_TEMPL_DFLT_SIZE, 0, |
Juuso Oikarinen | 11eb542 | 2010-08-24 06:28:03 +0300 | [diff] [blame] | 49 | WL1271_RATE_AUTOMATIC); |
| 50 | if (ret < 0) |
| 51 | return ret; |
Teemu Paasikivi | abb0b3b | 2009-10-13 12:47:50 +0300 | [diff] [blame] | 52 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 53 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL, |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 54 | sizeof(struct wl12xx_null_data_template), |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 55 | 0, WL1271_RATE_AUTOMATIC); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 56 | if (ret < 0) |
| 57 | return ret; |
| 58 | |
| 59 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PS_POLL, NULL, |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 60 | sizeof(struct wl12xx_ps_poll_template), |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 61 | 0, WL1271_RATE_AUTOMATIC); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 62 | if (ret < 0) |
| 63 | return ret; |
| 64 | |
| 65 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, NULL, |
| 66 | sizeof |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 67 | (struct wl12xx_qos_null_data_template), |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 68 | 0, WL1271_RATE_AUTOMATIC); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 69 | if (ret < 0) |
| 70 | return ret; |
| 71 | |
| 72 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL, |
Eliad Peller | 154037d | 2011-08-14 13:17:12 +0300 | [diff] [blame] | 73 | WL1271_CMD_TEMPL_DFLT_SIZE, |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 74 | 0, WL1271_RATE_AUTOMATIC); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 75 | if (ret < 0) |
| 76 | return ret; |
| 77 | |
| 78 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL, |
Eliad Peller | 154037d | 2011-08-14 13:17:12 +0300 | [diff] [blame] | 79 | WL1271_CMD_TEMPL_DFLT_SIZE, |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 80 | 0, WL1271_RATE_AUTOMATIC); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 81 | if (ret < 0) |
| 82 | return ret; |
| 83 | |
Eliad Peller | c531277 | 2010-12-09 11:31:27 +0200 | [diff] [blame] | 84 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_ARP_RSP, NULL, |
| 85 | sizeof |
| 86 | (struct wl12xx_arp_rsp_template), |
| 87 | 0, WL1271_RATE_AUTOMATIC); |
| 88 | if (ret < 0) |
| 89 | return ret; |
| 90 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 91 | /* |
| 92 | * Put very large empty placeholders for all templates. These |
| 93 | * reserve memory for later. |
| 94 | */ |
| 95 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_PROBE_RESPONSE, NULL, |
| 96 | WL1271_CMD_TEMPL_MAX_SIZE, |
| 97 | 0, WL1271_RATE_AUTOMATIC); |
| 98 | if (ret < 0) |
| 99 | return ret; |
| 100 | |
| 101 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_BEACON, NULL, |
| 102 | WL1271_CMD_TEMPL_MAX_SIZE, |
| 103 | 0, WL1271_RATE_AUTOMATIC); |
| 104 | if (ret < 0) |
| 105 | return ret; |
| 106 | |
| 107 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP, NULL, |
| 108 | sizeof |
| 109 | (struct wl12xx_disconn_template), |
| 110 | 0, WL1271_RATE_AUTOMATIC); |
| 111 | if (ret < 0) |
| 112 | return ret; |
| 113 | |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 114 | for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) { |
| 115 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, NULL, |
Eliad Peller | 154037d | 2011-08-14 13:17:12 +0300 | [diff] [blame] | 116 | WL1271_CMD_TEMPL_DFLT_SIZE, i, |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 117 | WL1271_RATE_AUTOMATIC); |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 118 | if (ret < 0) |
| 119 | return ret; |
| 120 | } |
| 121 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 122 | return 0; |
| 123 | } |
| 124 | |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 125 | static int wl1271_ap_init_deauth_template(struct wl1271 *wl) |
| 126 | { |
| 127 | struct wl12xx_disconn_template *tmpl; |
| 128 | int ret; |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 129 | u32 rate; |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 130 | |
| 131 | tmpl = kzalloc(sizeof(*tmpl), GFP_KERNEL); |
| 132 | if (!tmpl) { |
| 133 | ret = -ENOMEM; |
| 134 | goto out; |
| 135 | } |
| 136 | |
| 137 | tmpl->header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
| 138 | IEEE80211_STYPE_DEAUTH); |
| 139 | |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 140 | rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 141 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP, |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 142 | tmpl, sizeof(*tmpl), 0, rate); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 143 | |
| 144 | out: |
| 145 | kfree(tmpl); |
| 146 | return ret; |
| 147 | } |
| 148 | |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 149 | static int wl1271_ap_init_null_template(struct wl1271 *wl, |
| 150 | struct ieee80211_vif *vif) |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 151 | { |
| 152 | struct ieee80211_hdr_3addr *nullfunc; |
| 153 | int ret; |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 154 | u32 rate; |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 155 | |
| 156 | nullfunc = kzalloc(sizeof(*nullfunc), GFP_KERNEL); |
| 157 | if (!nullfunc) { |
| 158 | ret = -ENOMEM; |
| 159 | goto out; |
| 160 | } |
| 161 | |
| 162 | nullfunc->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | |
| 163 | IEEE80211_STYPE_NULLFUNC | |
| 164 | IEEE80211_FCTL_FROMDS); |
| 165 | |
| 166 | /* nullfunc->addr1 is filled by FW */ |
| 167 | |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 168 | memcpy(nullfunc->addr2, vif->addr, ETH_ALEN); |
| 169 | memcpy(nullfunc->addr3, vif->addr, ETH_ALEN); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 170 | |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 171 | rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 172 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, nullfunc, |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 173 | sizeof(*nullfunc), 0, rate); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 174 | |
| 175 | out: |
| 176 | kfree(nullfunc); |
| 177 | return ret; |
| 178 | } |
| 179 | |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 180 | static int wl1271_ap_init_qos_null_template(struct wl1271 *wl, |
| 181 | struct ieee80211_vif *vif) |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 182 | { |
| 183 | struct ieee80211_qos_hdr *qosnull; |
| 184 | int ret; |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 185 | u32 rate; |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 186 | |
| 187 | qosnull = kzalloc(sizeof(*qosnull), GFP_KERNEL); |
| 188 | if (!qosnull) { |
| 189 | ret = -ENOMEM; |
| 190 | goto out; |
| 191 | } |
| 192 | |
| 193 | qosnull->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | |
| 194 | IEEE80211_STYPE_QOS_NULLFUNC | |
| 195 | IEEE80211_FCTL_FROMDS); |
| 196 | |
| 197 | /* qosnull->addr1 is filled by FW */ |
| 198 | |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 199 | memcpy(qosnull->addr2, vif->addr, ETH_ALEN); |
| 200 | memcpy(qosnull->addr3, vif->addr, ETH_ALEN); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 201 | |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 202 | rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 203 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, qosnull, |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 204 | sizeof(*qosnull), 0, rate); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 205 | |
| 206 | out: |
| 207 | kfree(qosnull); |
| 208 | return ret; |
| 209 | } |
| 210 | |
Eliad Peller | 08c1d1c | 2011-08-14 13:17:04 +0300 | [diff] [blame] | 211 | static int wl12xx_init_rx_config(struct wl1271 *wl) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 212 | { |
| 213 | int ret; |
| 214 | |
Juuso Oikarinen | 8793f9b | 2009-10-13 12:47:40 +0300 | [diff] [blame] | 215 | ret = wl1271_acx_rx_msdu_life_time(wl); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 216 | if (ret < 0) |
| 217 | return ret; |
| 218 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 219 | return 0; |
| 220 | } |
| 221 | |
Luciano Coelho | 12419cc | 2010-02-18 13:25:44 +0200 | [diff] [blame] | 222 | int wl1271_init_phy_config(struct wl1271 *wl) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 223 | { |
| 224 | int ret; |
| 225 | |
| 226 | ret = wl1271_acx_pd_threshold(wl); |
| 227 | if (ret < 0) |
| 228 | return ret; |
| 229 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 230 | return 0; |
| 231 | } |
| 232 | |
| 233 | static int wl12xx_init_phy_vif_config(struct wl1271 *wl) |
| 234 | { |
| 235 | int ret; |
| 236 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 237 | ret = wl1271_acx_slot(wl, DEFAULT_SLOT_TIME); |
| 238 | if (ret < 0) |
| 239 | return ret; |
| 240 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 241 | ret = wl1271_acx_service_period_timeout(wl); |
| 242 | if (ret < 0) |
| 243 | return ret; |
| 244 | |
Arik Nemtsov | 5f704d1 | 2011-04-18 14:15:21 +0300 | [diff] [blame] | 245 | ret = wl1271_acx_rts_threshold(wl, wl->hw->wiphy->rts_threshold); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 246 | if (ret < 0) |
| 247 | return ret; |
| 248 | |
| 249 | return 0; |
| 250 | } |
| 251 | |
| 252 | static int wl1271_init_beacon_filter(struct wl1271 *wl) |
| 253 | { |
| 254 | int ret; |
| 255 | |
Juuso Oikarinen | 1922167 | 2009-10-08 21:56:35 +0300 | [diff] [blame] | 256 | /* disable beacon filtering at this stage */ |
| 257 | ret = wl1271_acx_beacon_filter_opt(wl, false); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 258 | if (ret < 0) |
| 259 | return ret; |
| 260 | |
| 261 | ret = wl1271_acx_beacon_filter_table(wl); |
| 262 | if (ret < 0) |
| 263 | return ret; |
| 264 | |
| 265 | return 0; |
| 266 | } |
| 267 | |
Luciano Coelho | 12419cc | 2010-02-18 13:25:44 +0200 | [diff] [blame] | 268 | int wl1271_init_pta(struct wl1271 *wl) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 269 | { |
| 270 | int ret; |
| 271 | |
Eliad Peller | 3be4112 | 2011-08-14 13:17:19 +0300 | [diff] [blame] | 272 | ret = wl12xx_acx_sg_cfg(wl); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 273 | if (ret < 0) |
| 274 | return ret; |
| 275 | |
Juuso Oikarinen | 7fc3a86 | 2010-03-18 12:26:32 +0200 | [diff] [blame] | 276 | ret = wl1271_acx_sg_enable(wl, wl->sg_enabled); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 277 | if (ret < 0) |
| 278 | return ret; |
| 279 | |
| 280 | return 0; |
| 281 | } |
| 282 | |
Luciano Coelho | 12419cc | 2010-02-18 13:25:44 +0200 | [diff] [blame] | 283 | int wl1271_init_energy_detection(struct wl1271 *wl) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 284 | { |
| 285 | int ret; |
| 286 | |
| 287 | ret = wl1271_acx_cca_threshold(wl); |
| 288 | if (ret < 0) |
| 289 | return ret; |
| 290 | |
| 291 | return 0; |
| 292 | } |
| 293 | |
| 294 | static int wl1271_init_beacon_broadcast(struct wl1271 *wl) |
| 295 | { |
| 296 | int ret; |
| 297 | |
| 298 | ret = wl1271_acx_bcn_dtim_options(wl); |
| 299 | if (ret < 0) |
| 300 | return ret; |
| 301 | |
| 302 | return 0; |
| 303 | } |
| 304 | |
Ido Yariv | 95dac04f | 2011-06-06 14:57:06 +0300 | [diff] [blame] | 305 | static int wl12xx_init_fwlog(struct wl1271 *wl) |
| 306 | { |
| 307 | int ret; |
| 308 | |
| 309 | if (wl->quirks & WL12XX_QUIRK_FWLOG_NOT_IMPLEMENTED) |
| 310 | return 0; |
| 311 | |
| 312 | ret = wl12xx_cmd_config_fwlog(wl); |
| 313 | if (ret < 0) |
| 314 | return ret; |
| 315 | |
| 316 | return 0; |
| 317 | } |
| 318 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 319 | /* generic sta initialization (non vif-specific) */ |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 320 | static int wl1271_sta_hw_init(struct wl1271 *wl) |
| 321 | { |
| 322 | int ret; |
| 323 | |
Shahar Levi | 49d750ca | 2011-03-06 16:32:09 +0200 | [diff] [blame] | 324 | if (wl->chip.id != CHIP_ID_1283_PG20) { |
| 325 | ret = wl1271_cmd_ext_radio_parms(wl); |
| 326 | if (ret < 0) |
| 327 | return ret; |
| 328 | } |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 329 | |
Eliad Peller | c8bde24 | 2011-02-02 09:59:35 +0200 | [diff] [blame] | 330 | /* PS config */ |
| 331 | ret = wl1271_acx_config_ps(wl); |
| 332 | if (ret < 0) |
| 333 | return ret; |
| 334 | |
Shahar Levi | ff86843 | 2011-04-11 15:41:46 +0300 | [diff] [blame] | 335 | /* FM WLAN coexistence */ |
| 336 | ret = wl1271_acx_fm_coex(wl); |
| 337 | if (ret < 0) |
| 338 | return ret; |
| 339 | |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 340 | /* Configure for ELP power saving */ |
| 341 | ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP); |
| 342 | if (ret < 0) |
| 343 | return ret; |
| 344 | |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 345 | ret = wl1271_acx_sta_rate_policies(wl); |
| 346 | if (ret < 0) |
| 347 | return ret; |
| 348 | |
| 349 | return 0; |
| 350 | } |
| 351 | |
| 352 | static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl) |
| 353 | { |
| 354 | int ret, i; |
| 355 | |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 356 | /* disable all keep-alive templates */ |
| 357 | for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) { |
| 358 | ret = wl1271_acx_keep_alive_config(wl, i, |
| 359 | ACX_KEEP_ALIVE_TPL_INVALID); |
| 360 | if (ret < 0) |
| 361 | return ret; |
| 362 | } |
| 363 | |
| 364 | /* disable the keep-alive feature */ |
| 365 | ret = wl1271_acx_keep_alive_mode(wl, false); |
| 366 | if (ret < 0) |
| 367 | return ret; |
| 368 | |
| 369 | return 0; |
| 370 | } |
| 371 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 372 | /* generic ap initialization (non vif-specific) */ |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 373 | static int wl1271_ap_hw_init(struct wl1271 *wl) |
| 374 | { |
Arik Nemtsov | 70f4742 | 2011-04-18 14:15:25 +0300 | [diff] [blame] | 375 | int ret; |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 376 | |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 377 | /* Configure for power always on */ |
| 378 | ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); |
| 379 | if (ret < 0) |
| 380 | return ret; |
| 381 | |
Arik Nemtsov | 70f4742 | 2011-04-18 14:15:25 +0300 | [diff] [blame] | 382 | ret = wl1271_init_ap_rates(wl); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 383 | if (ret < 0) |
| 384 | return ret; |
| 385 | |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 386 | return 0; |
| 387 | } |
| 388 | |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 389 | int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif) |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 390 | { |
| 391 | int ret; |
| 392 | |
| 393 | ret = wl1271_ap_init_deauth_template(wl); |
| 394 | if (ret < 0) |
| 395 | return ret; |
| 396 | |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 397 | ret = wl1271_ap_init_null_template(wl, vif); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 398 | if (ret < 0) |
| 399 | return ret; |
| 400 | |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 401 | ret = wl1271_ap_init_qos_null_template(wl, vif); |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 402 | if (ret < 0) |
| 403 | return ret; |
| 404 | |
Arik Nemtsov | 521a4a2 | 2011-04-18 14:15:22 +0300 | [diff] [blame] | 405 | /* |
| 406 | * when operating as AP we want to receive external beacons for |
| 407 | * configuring ERP protection. |
| 408 | */ |
Eliad Peller | f42bd2c | 2011-08-14 13:17:13 +0300 | [diff] [blame] | 409 | ret = wl1271_acx_beacon_filter_opt(wl, false); |
Arik Nemtsov | 521a4a2 | 2011-04-18 14:15:22 +0300 | [diff] [blame] | 410 | if (ret < 0) |
| 411 | return ret; |
| 412 | |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 413 | return 0; |
| 414 | } |
| 415 | |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 416 | static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl, |
| 417 | struct ieee80211_vif *vif) |
Arik Nemtsov | c45a85b | 2011-04-18 14:15:26 +0300 | [diff] [blame] | 418 | { |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 419 | return wl1271_ap_init_templates(wl, vif); |
Arik Nemtsov | c45a85b | 2011-04-18 14:15:26 +0300 | [diff] [blame] | 420 | } |
| 421 | |
Arik Nemtsov | 70f4742 | 2011-04-18 14:15:25 +0300 | [diff] [blame] | 422 | int wl1271_init_ap_rates(struct wl1271 *wl) |
| 423 | { |
| 424 | int i, ret; |
| 425 | struct conf_tx_rate_class rc; |
| 426 | u32 supported_rates; |
| 427 | |
| 428 | wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x", wl->basic_rate_set); |
| 429 | |
| 430 | if (wl->basic_rate_set == 0) |
| 431 | return -EINVAL; |
| 432 | |
| 433 | rc.enabled_rates = wl->basic_rate_set; |
| 434 | rc.long_retry_limit = 10; |
| 435 | rc.short_retry_limit = 10; |
| 436 | rc.aflags = 0; |
| 437 | ret = wl1271_acx_ap_rate_policy(wl, &rc, ACX_TX_AP_MODE_MGMT_RATE); |
| 438 | if (ret < 0) |
| 439 | return ret; |
| 440 | |
| 441 | /* use the min basic rate for AP broadcast/multicast */ |
Eliad Peller | af7fbb2 | 2011-09-19 13:51:42 +0300 | [diff] [blame] | 442 | rc.enabled_rates = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); |
Arik Nemtsov | 70f4742 | 2011-04-18 14:15:25 +0300 | [diff] [blame] | 443 | rc.short_retry_limit = 10; |
| 444 | rc.long_retry_limit = 10; |
| 445 | rc.aflags = 0; |
| 446 | ret = wl1271_acx_ap_rate_policy(wl, &rc, ACX_TX_AP_MODE_BCST_RATE); |
| 447 | if (ret < 0) |
| 448 | return ret; |
| 449 | |
| 450 | /* |
| 451 | * If the basic rates contain OFDM rates, use OFDM only |
| 452 | * rates for unicast TX as well. Else use all supported rates. |
| 453 | */ |
| 454 | if ((wl->basic_rate_set & CONF_TX_OFDM_RATES)) |
| 455 | supported_rates = CONF_TX_OFDM_RATES; |
| 456 | else |
| 457 | supported_rates = CONF_TX_AP_ENABLED_RATES; |
| 458 | |
Arik Nemtsov | 1a8adb6 | 2011-08-14 13:17:29 +0300 | [diff] [blame] | 459 | /* unconditionally enable HT rates */ |
| 460 | supported_rates |= CONF_TX_MCS_RATES; |
| 461 | |
Arik Nemtsov | 70f4742 | 2011-04-18 14:15:25 +0300 | [diff] [blame] | 462 | /* configure unicast TX rate classes */ |
| 463 | for (i = 0; i < wl->conf.tx.ac_conf_count; i++) { |
| 464 | rc.enabled_rates = supported_rates; |
| 465 | rc.short_retry_limit = 10; |
| 466 | rc.long_retry_limit = 10; |
| 467 | rc.aflags = 0; |
| 468 | ret = wl1271_acx_ap_rate_policy(wl, &rc, i); |
| 469 | if (ret < 0) |
| 470 | return ret; |
| 471 | } |
| 472 | |
| 473 | return 0; |
| 474 | } |
| 475 | |
Levi, Shahar | 4b7fac7 | 2011-01-23 07:27:22 +0100 | [diff] [blame] | 476 | static int wl1271_set_ba_policies(struct wl1271 *wl) |
| 477 | { |
Levi, Shahar | 4b7fac7 | 2011-01-23 07:27:22 +0100 | [diff] [blame] | 478 | /* Reset the BA RX indicators */ |
Levi, Shahar | 4b7fac7 | 2011-01-23 07:27:22 +0100 | [diff] [blame] | 479 | wl->ba_rx_bitmap = 0; |
Shahar Levi | 70559a0 | 2011-05-22 16:10:22 +0300 | [diff] [blame] | 480 | wl->ba_allowed = true; |
Arik Nemtsov | 0f9c825 | 2011-08-17 10:45:49 +0300 | [diff] [blame] | 481 | wl->ba_rx_session_count = 0; |
Levi, Shahar | 4b7fac7 | 2011-01-23 07:27:22 +0100 | [diff] [blame] | 482 | |
Arik Nemtsov | 0f9c825 | 2011-08-17 10:45:49 +0300 | [diff] [blame] | 483 | /* BA is supported in STA/AP modes */ |
| 484 | if (wl->bss_type != BSS_TYPE_AP_BSS && |
| 485 | wl->bss_type != BSS_TYPE_STA_BSS) { |
| 486 | wl->ba_support = false; |
| 487 | return 0; |
| 488 | } |
Levi, Shahar | 4b7fac7 | 2011-01-23 07:27:22 +0100 | [diff] [blame] | 489 | |
Arik Nemtsov | 0f9c825 | 2011-08-17 10:45:49 +0300 | [diff] [blame] | 490 | wl->ba_support = true; |
Levi, Shahar | 4b7fac7 | 2011-01-23 07:27:22 +0100 | [diff] [blame] | 491 | |
Arik Nemtsov | 0f9c825 | 2011-08-17 10:45:49 +0300 | [diff] [blame] | 492 | /* 802.11n initiator BA session setting */ |
| 493 | return wl12xx_acx_set_ba_initiator_policy(wl); |
Levi, Shahar | 4b7fac7 | 2011-01-23 07:27:22 +0100 | [diff] [blame] | 494 | } |
| 495 | |
Shahar Levi | 48a6147 | 2011-03-06 16:32:08 +0200 | [diff] [blame] | 496 | int wl1271_chip_specific_init(struct wl1271 *wl) |
| 497 | { |
| 498 | int ret = 0; |
| 499 | |
| 500 | if (wl->chip.id == CHIP_ID_1283_PG20) { |
| 501 | u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE; |
| 502 | |
Ido Yariv | 0da13da | 2011-03-31 10:06:58 +0200 | [diff] [blame] | 503 | if (wl->quirks & WL12XX_QUIRK_BLOCKSIZE_ALIGNMENT) |
Shahar Levi | 48a6147 | 2011-03-06 16:32:08 +0200 | [diff] [blame] | 504 | /* Enable SDIO padding */ |
| 505 | host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK; |
| 506 | |
| 507 | /* Must be before wl1271_acx_init_mem_config() */ |
| 508 | ret = wl1271_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap); |
| 509 | if (ret < 0) |
| 510 | goto out; |
| 511 | } |
| 512 | out: |
| 513 | return ret; |
| 514 | } |
| 515 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 516 | /* vif-specifc initialization */ |
| 517 | static int wl12xx_init_sta_role(struct wl1271 *wl, struct ieee80211_vif *vif) |
| 518 | { |
| 519 | int ret; |
Shahar Levi | 48a6147 | 2011-03-06 16:32:08 +0200 | [diff] [blame] | 520 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 521 | ret = wl1271_acx_group_address_tbl(wl, true, NULL, 0); |
| 522 | if (ret < 0) |
| 523 | return ret; |
| 524 | |
| 525 | /* Initialize connection monitoring thresholds */ |
| 526 | ret = wl1271_acx_conn_monit_params(wl, false); |
| 527 | if (ret < 0) |
| 528 | return ret; |
| 529 | |
| 530 | /* Beacon filtering */ |
| 531 | ret = wl1271_init_beacon_filter(wl); |
| 532 | if (ret < 0) |
| 533 | return ret; |
| 534 | |
| 535 | /* Beacons and broadcast settings */ |
| 536 | ret = wl1271_init_beacon_broadcast(wl); |
| 537 | if (ret < 0) |
| 538 | return ret; |
| 539 | |
| 540 | /* Configure rssi/snr averaging weights */ |
| 541 | ret = wl1271_acx_rssi_snr_avg_weights(wl); |
| 542 | if (ret < 0) |
| 543 | return ret; |
| 544 | |
| 545 | return 0; |
| 546 | } |
| 547 | |
| 548 | /* vif-specific intialization */ |
| 549 | static int wl12xx_init_ap_role(struct wl1271 *wl, struct ieee80211_vif *vif) |
| 550 | { |
| 551 | int ret; |
| 552 | |
| 553 | ret = wl1271_acx_ap_max_tx_retry(wl); |
| 554 | if (ret < 0) |
| 555 | return ret; |
| 556 | |
| 557 | /* initialize Tx power */ |
| 558 | ret = wl1271_acx_tx_power(wl, wl->power_level); |
| 559 | if (ret < 0) |
| 560 | return ret; |
| 561 | |
| 562 | return 0; |
| 563 | } |
| 564 | |
| 565 | int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 566 | { |
Kalle Valo | 243eeb5 | 2010-02-18 13:25:39 +0200 | [diff] [blame] | 567 | struct conf_tx_ac_category *conf_ac; |
Kalle Valo | f2054df | 2010-02-18 13:25:40 +0200 | [diff] [blame] | 568 | struct conf_tx_tid *conf_tid; |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 569 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 570 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 571 | int ret, i; |
| 572 | |
| 573 | /* Mode specific init */ |
| 574 | if (is_ap) { |
| 575 | ret = wl1271_ap_hw_init(wl); |
| 576 | if (ret < 0) |
| 577 | return ret; |
| 578 | |
| 579 | ret = wl12xx_init_ap_role(wl, vif); |
| 580 | if (ret < 0) |
| 581 | return ret; |
| 582 | } else { |
| 583 | ret = wl1271_sta_hw_init(wl); |
| 584 | if (ret < 0) |
| 585 | return ret; |
| 586 | |
| 587 | ret = wl12xx_init_sta_role(wl, vif); |
| 588 | if (ret < 0) |
| 589 | return ret; |
| 590 | } |
| 591 | |
| 592 | wl12xx_init_phy_vif_config(wl); |
| 593 | |
| 594 | /* Default TID/AC configuration */ |
| 595 | BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count); |
| 596 | for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { |
| 597 | conf_ac = &wl->conf.tx.ac_conf[i]; |
| 598 | ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, |
| 599 | conf_ac->cw_max, conf_ac->aifsn, |
| 600 | conf_ac->tx_op_limit); |
| 601 | if (ret < 0) |
| 602 | return ret; |
| 603 | |
| 604 | conf_tid = &wl->conf.tx.tid_conf[i]; |
| 605 | ret = wl1271_acx_tid_cfg(wl, |
| 606 | conf_tid->queue_id, |
| 607 | conf_tid->channel_type, |
| 608 | conf_tid->tsid, |
| 609 | conf_tid->ps_scheme, |
| 610 | conf_tid->ack_policy, |
| 611 | conf_tid->apsd_conf[0], |
| 612 | conf_tid->apsd_conf[1]); |
| 613 | if (ret < 0) |
| 614 | return ret; |
| 615 | } |
| 616 | |
| 617 | /* Configure HW encryption */ |
| 618 | ret = wl1271_acx_feature_cfg(wl); |
| 619 | if (ret < 0) |
| 620 | return ret; |
| 621 | |
| 622 | /* Mode specific init - post mem init */ |
| 623 | if (is_ap) |
| 624 | ret = wl1271_ap_hw_init_post_mem(wl, vif); |
| 625 | else |
| 626 | ret = wl1271_sta_hw_init_post_mem(wl); |
| 627 | |
| 628 | if (ret < 0) |
| 629 | return ret; |
| 630 | |
| 631 | /* Configure initiator BA sessions policies */ |
| 632 | ret = wl1271_set_ba_policies(wl); |
| 633 | if (ret < 0) |
| 634 | return ret; |
| 635 | |
| 636 | return 0; |
| 637 | } |
| 638 | |
| 639 | int wl1271_hw_init(struct wl1271 *wl) |
| 640 | { |
| 641 | int ret; |
| 642 | |
Shahar Levi | 49d750ca | 2011-03-06 16:32:09 +0200 | [diff] [blame] | 643 | if (wl->chip.id == CHIP_ID_1283_PG20) |
| 644 | ret = wl128x_cmd_general_parms(wl); |
| 645 | else |
| 646 | ret = wl1271_cmd_general_parms(wl); |
Luciano Coelho | 4a90406 | 2009-11-23 23:22:18 +0200 | [diff] [blame] | 647 | if (ret < 0) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 648 | return ret; |
| 649 | |
Shahar Levi | 49d750ca | 2011-03-06 16:32:09 +0200 | [diff] [blame] | 650 | if (wl->chip.id == CHIP_ID_1283_PG20) |
| 651 | ret = wl128x_cmd_radio_parms(wl); |
| 652 | else |
| 653 | ret = wl1271_cmd_radio_parms(wl); |
Luciano Coelho | 4a90406 | 2009-11-23 23:22:18 +0200 | [diff] [blame] | 654 | if (ret < 0) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 655 | return ret; |
| 656 | |
Shahar Levi | 48a6147 | 2011-03-06 16:32:08 +0200 | [diff] [blame] | 657 | /* Chip-specific init */ |
| 658 | ret = wl1271_chip_specific_init(wl); |
| 659 | if (ret < 0) |
| 660 | return ret; |
| 661 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 662 | /* Init templates */ |
| 663 | ret = wl1271_init_templates_config(wl); |
| 664 | if (ret < 0) |
| 665 | return ret; |
Juuso Oikarinen | 644a486 | 2010-10-05 13:11:56 +0200 | [diff] [blame] | 666 | |
Eliad Peller | 92c77c7 | 2011-10-05 11:55:40 +0200 | [diff] [blame^] | 667 | ret = wl12xx_acx_mem_cfg(wl); |
| 668 | if (ret < 0) |
| 669 | return ret; |
| 670 | |
| 671 | /* Configure the FW logger */ |
| 672 | ret = wl12xx_init_fwlog(wl); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 673 | if (ret < 0) |
| 674 | return ret; |
| 675 | |
Arik Nemtsov | 801f870 | 2011-04-18 14:15:20 +0300 | [diff] [blame] | 676 | /* Bluetooth WLAN coexistence */ |
| 677 | ret = wl1271_init_pta(wl); |
| 678 | if (ret < 0) |
| 679 | return ret; |
| 680 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 681 | /* Default memory configuration */ |
| 682 | ret = wl1271_acx_init_mem_config(wl); |
| 683 | if (ret < 0) |
| 684 | return ret; |
| 685 | |
| 686 | /* RX config */ |
Eliad Peller | 08c1d1c | 2011-08-14 13:17:04 +0300 | [diff] [blame] | 687 | ret = wl12xx_init_rx_config(wl); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 688 | if (ret < 0) |
| 689 | goto out_free_memmap; |
| 690 | |
| 691 | /* PHY layer config */ |
| 692 | ret = wl1271_init_phy_config(wl); |
| 693 | if (ret < 0) |
| 694 | goto out_free_memmap; |
| 695 | |
Luciano Coelho | 6e92b41 | 2009-12-11 15:40:50 +0200 | [diff] [blame] | 696 | ret = wl1271_acx_dco_itrim_params(wl); |
| 697 | if (ret < 0) |
| 698 | goto out_free_memmap; |
| 699 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 700 | /* Configure TX patch complete interrupt behavior */ |
| 701 | ret = wl1271_acx_tx_config_options(wl); |
| 702 | if (ret < 0) |
| 703 | goto out_free_memmap; |
| 704 | |
| 705 | /* RX complete interrupt pacing */ |
| 706 | ret = wl1271_acx_init_rx_interrupt(wl); |
| 707 | if (ret < 0) |
| 708 | goto out_free_memmap; |
| 709 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 710 | /* Energy detection */ |
| 711 | ret = wl1271_init_energy_detection(wl); |
| 712 | if (ret < 0) |
| 713 | goto out_free_memmap; |
| 714 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 715 | /* Default fragmentation threshold */ |
Arik Nemtsov | 5f704d1 | 2011-04-18 14:15:21 +0300 | [diff] [blame] | 716 | ret = wl1271_acx_frag_threshold(wl, wl->hw->wiphy->frag_threshold); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 717 | if (ret < 0) |
| 718 | goto out_free_memmap; |
| 719 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 720 | /* Enable data path */ |
Luciano Coelho | 9421089 | 2009-12-11 15:40:55 +0200 | [diff] [blame] | 721 | ret = wl1271_cmd_data_path(wl, 1); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 722 | if (ret < 0) |
| 723 | goto out_free_memmap; |
| 724 | |
Juuso Oikarinen | 38ad2d8 | 2009-12-11 15:41:08 +0200 | [diff] [blame] | 725 | /* configure PM */ |
| 726 | ret = wl1271_acx_pm_config(wl); |
| 727 | if (ret < 0) |
| 728 | goto out_free_memmap; |
| 729 | |
Eliad Peller | fa6ad9f | 2011-08-14 13:17:14 +0300 | [diff] [blame] | 730 | ret = wl12xx_acx_set_rate_mgmt_params(wl); |
| 731 | if (ret < 0) |
| 732 | goto out_free_memmap; |
| 733 | |
Eliad Peller | 9487775 | 2011-08-28 15:11:56 +0300 | [diff] [blame] | 734 | /* configure hangover */ |
| 735 | ret = wl12xx_acx_config_hangover(wl); |
| 736 | if (ret < 0) |
| 737 | goto out_free_memmap; |
| 738 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 739 | return 0; |
| 740 | |
| 741 | out_free_memmap: |
| 742 | kfree(wl->target_mem_map); |
Juuso Oikarinen | 3441523 | 2009-10-08 21:56:33 +0300 | [diff] [blame] | 743 | wl->target_mem_map = NULL; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 744 | |
| 745 | return ret; |
| 746 | } |