aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2009-10-13 05:47:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:48:07 -0400
commit2b60100bf04aba28133ccb24efd85f72fb1a5494 (patch)
tree30b52402d2ea9ffe2edc7a28b02dfce4014b935e /drivers
parent2cc8d4db9dd7df9dd12d86f2e37d1b4760d3dd98 (diff)
wl1271: Add structure for firmware configuration values
In order to make the firmware configuration more manageable, collect hardcoded configuration values into one data structure, and set default values there. Add the SoftGemini BT/WLAN coex paramters into the config structure. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h5
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_acx.c40
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_acx.h136
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c6
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.h5
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_conf.h178
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c84
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_reg.h44
8 files changed, 274 insertions, 224 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index aa9bb2ea855..64a327009f2 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -32,6 +32,8 @@
32#include <linux/bitops.h> 32#include <linux/bitops.h>
33#include <net/mac80211.h> 33#include <net/mac80211.h>
34 34
35#include "wl1271_conf.h"
36
35#define DRIVER_NAME "wl1271" 37#define DRIVER_NAME "wl1271"
36#define DRIVER_PREFIX DRIVER_NAME ": " 38#define DRIVER_PREFIX DRIVER_NAME ": "
37 39
@@ -420,6 +422,9 @@ struct wl1271 {
420 422
421 /* Used for a workaround to send disconnect before rejoining */ 423 /* Used for a workaround to send disconnect before rejoining */
422 bool joined; 424 bool joined;
425
426 /* Current chipset configuration */
427 struct conf_drv_settings conf;
423}; 428};
424 429
425int wl1271_plt_start(struct wl1271 *wl); 430int wl1271_plt_start(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.c b/drivers/net/wireless/wl12xx/wl1271_acx.c
index 6c298900221..d19d8605b9d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_acx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_acx.c
@@ -509,6 +509,7 @@ out:
509int wl1271_acx_sg_cfg(struct wl1271 *wl) 509int wl1271_acx_sg_cfg(struct wl1271 *wl)
510{ 510{
511 struct acx_bt_wlan_coex_param *param; 511 struct acx_bt_wlan_coex_param *param;
512 struct conf_sg_settings *c = &wl->conf.sg;
512 int ret; 513 int ret;
513 514
514 wl1271_debug(DEBUG_ACX, "acx sg cfg"); 515 wl1271_debug(DEBUG_ACX, "acx sg cfg");
@@ -520,34 +521,17 @@ int wl1271_acx_sg_cfg(struct wl1271 *wl)
520 } 521 }
521 522
522 /* BT-WLAN coext parameters */ 523 /* BT-WLAN coext parameters */
523 param->min_rate = RATE_INDEX_24MBPS; 524 param->per_threshold = c->per_threshold;
524 param->bt_hp_max_time = PTA_BT_HP_MAXTIME_DEF; 525 param->max_scan_compensation_time = c->max_scan_compensation_time;
525 param->wlan_hp_max_time = PTA_WLAN_HP_MAX_TIME_DEF; 526 param->nfs_sample_interval = c->nfs_sample_interval;
526 param->sense_disable_timer = PTA_SENSE_DISABLE_TIMER_DEF; 527 param->load_ratio = c->load_ratio;
527 param->rx_time_bt_hp = PTA_PROTECTIVE_RX_TIME_DEF; 528 param->auto_ps_mode = c->auto_ps_mode;
528 param->tx_time_bt_hp = PTA_PROTECTIVE_TX_TIME_DEF; 529 param->probe_req_compensation = c->probe_req_compensation;
529 param->rx_time_bt_hp_fast = PTA_PROTECTIVE_RX_TIME_FAST_DEF; 530 param->scan_window_compensation = c->scan_window_compensation;
530 param->tx_time_bt_hp_fast = PTA_PROTECTIVE_TX_TIME_FAST_DEF; 531 param->antenna_config = c->antenna_config;
531 param->wlan_cycle_fast = PTA_CYCLE_TIME_FAST_DEF; 532 param->beacon_miss_threshold = c->beacon_miss_threshold;
532 param->bt_anti_starvation_period = PTA_ANTI_STARVE_PERIOD_DEF; 533 param->rate_adaptation_threshold = c->rate_adaptation_threshold;
533 param->next_bt_lp_packet = PTA_TIMEOUT_NEXT_BT_LP_PACKET_DEF; 534 param->rate_adaptation_snr = c->rate_adaptation_snr;
534 param->wake_up_beacon = PTA_TIME_BEFORE_BEACON_DEF;
535 param->hp_dm_max_guard_time = PTA_HPDM_MAX_TIME_DEF;
536 param->next_wlan_packet = PTA_TIME_OUT_NEXT_WLAN_DEF;
537 param->antenna_type = PTA_ANTENNA_TYPE_DEF;
538 param->signal_type = PTA_SIGNALING_TYPE_DEF;
539 param->afh_leverage_on = PTA_AFH_LEVERAGE_ON_DEF;
540 param->quiet_cycle_num = PTA_NUMBER_QUIET_CYCLE_DEF;
541 param->max_cts = PTA_MAX_NUM_CTS_DEF;
542 param->wlan_packets_num = PTA_NUMBER_OF_WLAN_PACKETS_DEF;
543 param->bt_packets_num = PTA_NUMBER_OF_BT_PACKETS_DEF;
544 param->missed_rx_avalanche = PTA_RX_FOR_AVALANCHE_DEF;
545 param->wlan_elp_hp = PTA_ELP_HP_DEF;
546 param->bt_anti_starvation_cycles = PTA_ANTI_STARVE_NUM_CYCLE_DEF;
547 param->ack_mode_dual_ant = PTA_ACK_MODE_DEF;
548 param->pa_sd_enable = PTA_ALLOW_PA_SD_DEF;
549 param->pta_auto_mode_enable = PTA_AUTO_MODE_NO_CTS_DEF;
550 param->bt_hp_respected_num = PTA_BT_HP_RESPECTED_DEF;
551 535
552 ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param)); 536 ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param));
553 if (ret < 0) { 537 if (ret < 0) {
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.h b/drivers/net/wireless/wl12xx/wl1271_acx.h
index 0c704af1953..8e3b97cff79 100644
--- a/drivers/net/wireless/wl12xx/wl1271_acx.h
+++ b/drivers/net/wireless/wl12xx/wl1271_acx.h
@@ -496,126 +496,18 @@ struct acx_smart_reflex_config_params {
496struct acx_bt_wlan_coex_param { 496struct acx_bt_wlan_coex_param {
497 struct acx_header header; 497 struct acx_header header;
498 498
499 /* 499 u32 per_threshold;
500 * The minimum rate of a received WLAN packet in the STA, 500 u32 max_scan_compensation_time;
501 * during protective mode, of which a new BT-HP request 501 u16 nfs_sample_interval;
502 * during this Rx will always be respected and gain the antenna. 502 u8 load_ratio;
503 */ 503 u8 auto_ps_mode;
504 u32 min_rate; 504 u8 probe_req_compensation;
505 505 u8 scan_window_compensation;
506 /* Max time the BT HP will be respected. */ 506 u8 antenna_config;
507 u16 bt_hp_max_time; 507 u8 beacon_miss_threshold;
508 508 u32 rate_adaptation_threshold;
509 /* Max time the WLAN HP will be respected. */ 509 s8 rate_adaptation_snr;
510 u16 wlan_hp_max_time; 510 u8 padding[3];
511
512 /*
513 * The time between the last BT activity
514 * and the moment when the sense mode returns
515 * to SENSE_INACTIVE.
516 */
517 u16 sense_disable_timer;
518
519 /* Time before the next BT HP instance */
520 u16 rx_time_bt_hp;
521 u16 tx_time_bt_hp;
522
523 /* range: 10-20000 default: 1500 */
524 u16 rx_time_bt_hp_fast;
525 u16 tx_time_bt_hp_fast;
526
527 /* range: 2000-65535 default: 8700 */
528 u16 wlan_cycle_fast;
529
530 /* range: 0 - 15000 (Msec) default: 1000 */
531 u16 bt_anti_starvation_period;
532
533 /* range 400-10000(Usec) default: 3000 */
534 u16 next_bt_lp_packet;
535
536 /* Deafult: worst case for BT DH5 traffic */
537 u16 wake_up_beacon;
538
539 /* range: 0-50000(Usec) default: 1050 */
540 u16 hp_dm_max_guard_time;
541
542 /*
543 * This is to prevent both BT & WLAN antenna
544 * starvation.
545 * Range: 100-50000(Usec) default:2550
546 */
547 u16 next_wlan_packet;
548
549 /* 0 -> shared antenna */
550 u8 antenna_type;
551
552 /*
553 * 0 -> TI legacy
554 * 1 -> Palau
555 */
556 u8 signal_type;
557
558 /*
559 * BT AFH status
560 * 0 -> no AFH
561 * 1 -> from dedicated GPIO
562 * 2 -> AFH on (from host)
563 */
564 u8 afh_leverage_on;
565
566 /*
567 * The number of cycles during which no
568 * TX will be sent after 1 cycle of RX
569 * transaction in protective mode
570 */
571 u8 quiet_cycle_num;
572
573 /*
574 * The maximum number of CTSs that will
575 * be sent for receiving RX packet in
576 * protective mode
577 */
578 u8 max_cts;
579
580 /*
581 * The number of WLAN packets
582 * transferred in common mode before
583 * switching to BT.
584 */
585 u8 wlan_packets_num;
586
587 /*
588 * The number of BT packets
589 * transferred in common mode before
590 * switching to WLAN.
591 */
592 u8 bt_packets_num;
593
594 /* range: 1-255 default: 5 */
595 u8 missed_rx_avalanche;
596
597 /* range: 0-1 default: 1 */
598 u8 wlan_elp_hp;
599
600 /* range: 0 - 15 default: 4 */
601 u8 bt_anti_starvation_cycles;
602
603 u8 ack_mode_dual_ant;
604
605 /*
606 * Allow PA_SD assertion/de-assertion
607 * during enabled BT activity.
608 */
609 u8 pa_sd_enable;
610
611 /*
612 * Enable/Disable PTA in auto mode:
613 * Support Both Active & P.S modes
614 */
615 u8 pta_auto_mode_enable;
616
617 /* range: 0 - 20 default: 1 */
618 u8 bt_hp_respected_num;
619} __attribute__ ((packed)); 511} __attribute__ ((packed));
620 512
621#define CCA_THRSH_ENABLE_ENERGY_D 0x140A 513#define CCA_THRSH_ENABLE_ENERGY_D 0x140A
@@ -690,6 +582,10 @@ struct acx_event_mask {
690#define SCAN_TRIGGERED BIT(2) 582#define SCAN_TRIGGERED BIT(2)
691#define SCAN_PRIORITY_HIGH BIT(3) 583#define SCAN_PRIORITY_HIGH BIT(3)
692 584
585/* When set, disable HW encryption */
586#define DF_ENCRYPTION_DISABLE 0x01
587#define DF_SNIFF_MODE_ENABLE 0x80
588
693struct acx_feature_config { 589struct acx_feature_config {
694 struct acx_header header; 590 struct acx_header header;
695 591
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index eaa1de97339..c7a8a64d18d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -229,8 +229,8 @@ int wl1271_cmd_join(struct wl1271 *wl)
229 join->rx_config_options = 0; 229 join->rx_config_options = 0;
230 join->rx_filter_options = WL1271_DEFAULT_RX_FILTER; 230 join->rx_filter_options = WL1271_DEFAULT_RX_FILTER;
231 231
232 join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS | 232 join->basic_rate_set = CONF_HW_BIT_RATE_1MBPS | CONF_HW_BIT_RATE_2MBPS |
233 RATE_MASK_5_5MBPS | RATE_MASK_11MBPS; 233 CONF_HW_BIT_RATE_5_5MBPS | CONF_HW_BIT_RATE_11MBPS;
234 234
235 join->beacon_interval = WL1271_DEFAULT_BEACON_INT; 235 join->beacon_interval = WL1271_DEFAULT_BEACON_INT;
236 join->dtim_interval = WL1271_DEFAULT_DTIM_PERIOD; 236 join->dtim_interval = WL1271_DEFAULT_DTIM_PERIOD;
@@ -538,7 +538,7 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len,
538 538
539 params->params.num_channels = num_channels; 539 params->params.num_channels = num_channels;
540 params->params.num_probe_requests = probe_requests; 540 params->params.num_probe_requests = probe_requests;
541 params->params.tx_rate = cpu_to_le32(RATE_MASK_2MBPS); 541 params->params.tx_rate = cpu_to_le32(CONF_HW_BIT_RATE_2MBPS);
542 params->params.tid_trigger = 0; 542 params->params.tid_trigger = 0;
543 params->params.scan_tag = WL1271_SCAN_DEFAULT_TAG; 543 params->params.scan_tag = WL1271_SCAN_DEFAULT_TAG;
544 544
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index 0219664765e..91430871c8f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -288,11 +288,6 @@ struct wl1271_cmd_ps_params {
288#define NUM_ACCESS_CATEGORIES_COPY 4 288#define NUM_ACCESS_CATEGORIES_COPY 4
289#define MAX_KEY_SIZE 32 289#define MAX_KEY_SIZE 32
290 290
291/* When set, disable HW encryption */
292#define DF_ENCRYPTION_DISABLE 0x01
293/* When set, disable HW decryption */
294#define DF_SNIFF_MODE_ENABLE 0x80
295
296enum wl1271_cmd_key_action { 291enum wl1271_cmd_key_action {
297 KEY_ADD_OR_REPLACE = 1, 292 KEY_ADD_OR_REPLACE = 1,
298 KEY_REMOVE = 2, 293 KEY_REMOVE = 2,
diff --git a/drivers/net/wireless/wl12xx/wl1271_conf.h b/drivers/net/wireless/wl12xx/wl1271_conf.h
new file mode 100644
index 00000000000..1d6a44bec1c
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl1271_conf.h
@@ -0,0 +1,178 @@
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#ifndef __WL1271_CONF_H__
25#define __WL1271_CONF_H__
26
27enum {
28 CONF_HW_BIT_RATE_1MBPS = BIT(0),
29 CONF_HW_BIT_RATE_2MBPS = BIT(1),
30 CONF_HW_BIT_RATE_5_5MBPS = BIT(2),
31 CONF_HW_BIT_RATE_6MBPS = BIT(3),
32 CONF_HW_BIT_RATE_9MBPS = BIT(4),
33 CONF_HW_BIT_RATE_11MBPS = BIT(5),
34 CONF_HW_BIT_RATE_12MBPS = BIT(6),
35 CONF_HW_BIT_RATE_18MBPS = BIT(7),
36 CONF_HW_BIT_RATE_22MBPS = BIT(8),
37 CONF_HW_BIT_RATE_24MBPS = BIT(9),
38 CONF_HW_BIT_RATE_36MBPS = BIT(10),
39 CONF_HW_BIT_RATE_48MBPS = BIT(11),
40 CONF_HW_BIT_RATE_54MBPS = BIT(12),
41 CONF_HW_BIT_RATE_MCS_0 = BIT(13),
42 CONF_HW_BIT_RATE_MCS_1 = BIT(14),
43 CONF_HW_BIT_RATE_MCS_2 = BIT(15),
44 CONF_HW_BIT_RATE_MCS_3 = BIT(16),
45 CONF_HW_BIT_RATE_MCS_4 = BIT(17),
46 CONF_HW_BIT_RATE_MCS_5 = BIT(18),
47 CONF_HW_BIT_RATE_MCS_6 = BIT(19),
48 CONF_HW_BIT_RATE_MCS_7 = BIT(20)
49};
50
51enum {
52 CONF_HW_RATE_INDEX_1MBPS = 0,
53 CONF_HW_RATE_INDEX_2MBPS = 1,
54 CONF_HW_RATE_INDEX_5_5MBPS = 2,
55 CONF_HW_RATE_INDEX_6MBPS = 3,
56 CONF_HW_RATE_INDEX_9MBPS = 4,
57 CONF_HW_RATE_INDEX_11MBPS = 5,
58 CONF_HW_RATE_INDEX_12MBPS = 6,
59 CONF_HW_RATE_INDEX_18MBPS = 7,
60 CONF_HW_RATE_INDEX_22MBPS = 8,
61 CONF_HW_RATE_INDEX_24MBPS = 9,
62 CONF_HW_RATE_INDEX_36MBPS = 10,
63 CONF_HW_RATE_INDEX_48MBPS = 11,
64 CONF_HW_RATE_INDEX_54MBPS = 12,
65 CONF_HW_RATE_INDEX_MAX = CONF_HW_RATE_INDEX_54MBPS,
66};
67
68struct conf_sg_settings {
69 /*
70 * Defines the PER threshold in PPM of the BT voice of which reaching
71 * this value will trigger raising the priority of the BT voice by
72 * the BT IP until next NFS sample interval time as defined in
73 * nfs_sample_interval.
74 *
75 * Unit: PER value in PPM (parts per million)
76 * #Error_packets / #Total_packets
77
78 * Range: u32
79 */
80 u32 per_threshold;
81
82 /*
83 * This value is an absolute time in micro-seconds to limit the
84 * maximum scan duration compensation while in SG
85 */
86 u32 max_scan_compensation_time;
87
88 /* Defines the PER threshold of the BT voice of which reaching this
89 * value will trigger raising the priority of the BT voice until next
90 * NFS sample interval time as defined in sample_interval.
91 *
92 * Unit: msec
93 * Range: 1-65000
94 */
95 u16 nfs_sample_interval;
96
97 /*
98 * Defines the load ratio for the BT.
99 * The WLAN ratio is: 100 - load_ratio
100 *
101 * Unit: Percent
102 * Range: 0-100
103 */
104 u8 load_ratio;
105
106 /*
107 * true - Co-ex is allowed to enter/exit P.S automatically and
108 * transparently to the host
109 *
110 * false - Co-ex is disallowed to enter/exit P.S and will trigger an
111 * event to the host to notify for the need to enter/exit P.S
112 * due to BT change state
113 *
114 */
115 u8 auto_ps_mode;
116
117 /*
118 * This parameter defines the compensation percentage of num of probe
119 * requests in case scan is initiated during BT voice/BT ACL
120 * guaranteed link.
121 *
122 * Unit: Percent
123 * Range: 0-255 (0 - No compensation)
124 */
125 u8 probe_req_compensation;
126
127 /*
128 * This parameter defines the compensation percentage of scan window
129 * size in case scan is initiated during BT voice/BT ACL Guaranteed
130 * link.
131 *
132 * Unit: Percent
133 * Range: 0-255 (0 - No compensation)
134 */
135 u8 scan_window_compensation;
136
137 /*
138 * Defines the antenna configuration.
139 *
140 * Range: 0 - Single Antenna; 1 - Dual Antenna
141 */
142 u8 antenna_config;
143
144 /*
145 * The percent out of the Max consecutive beacon miss roaming trigger
146 * which is the threshold for raising the priority of beacon
147 * reception.
148 *
149 * Range: 1-100
150 * N = MaxConsecutiveBeaconMiss
151 * P = coexMaxConsecutiveBeaconMissPrecent
152 * Threshold = MIN( N-1, round(N * P / 100))
153 */
154 u8 beacon_miss_threshold;
155
156 /*
157 * The RX rate threshold below which rate adaptation is assumed to be
158 * occurring at the AP which will raise priority for ACTIVE_RX and RX
159 * SP.
160 *
161 * Range: HW_BIT_RATE_*
162 */
163 u32 rate_adaptation_threshold;
164
165 /*
166 * The SNR above which the RX rate threshold indicating AP rate
167 * adaptation is valid
168 *
169 * Range: -128 - 127
170 */
171 s8 rate_adaptation_snr;
172};
173
174struct conf_drv_settings {
175 struct conf_sg_settings sg;
176};
177
178#endif
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 821a7752adf..69bc929e185 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -46,6 +46,39 @@
46#include "wl1271_cmd.h" 46#include "wl1271_cmd.h"
47#include "wl1271_boot.h" 47#include "wl1271_boot.h"
48 48
49static void wl1271_conf_init(struct wl1271 *wl)
50{
51 struct conf_drv_settings conf = {
52 .sg = {
53 .per_threshold = 7500,
54 .max_scan_compensation_time = 120000,
55 .nfs_sample_interval = 400,
56 .load_ratio = 50,
57 .auto_ps_mode = 0,
58 .probe_req_compensation = 170,
59 .scan_window_compensation = 50,
60 .antenna_config = 0,
61 .beacon_miss_threshold = 60,
62 .rate_adaptation_threshold = CONF_HW_BIT_RATE_12MBPS,
63 .rate_adaptation_snr = 0
64 }
65 };
66
67 /*
68 * This function applies the default configuration to the driver. This
69 * function is invoked upon driver load (spi probe.)
70 *
71 * The configuration is stored in a run-time structure in order to
72 * facilitate for run-time adjustment of any of the parameters. Making
73 * changes to the configuration structure will apply the new values on
74 * the next interface up (wl1271_op_start.)
75 */
76
77 /* apply driver default configuration */
78 memcpy(&wl->conf, &conf, sizeof(conf));
79}
80
81
49static int wl1271_plt_init(struct wl1271 *wl) 82static int wl1271_plt_init(struct wl1271 *wl)
50{ 83{
51 int ret; 84 int ret;
@@ -1180,44 +1213,44 @@ out:
1180/* can't be const, mac80211 writes to this */ 1213/* can't be const, mac80211 writes to this */
1181static struct ieee80211_rate wl1271_rates[] = { 1214static struct ieee80211_rate wl1271_rates[] = {
1182 { .bitrate = 10, 1215 { .bitrate = 10,
1183 .hw_value = 0x1, 1216 .hw_value = CONF_HW_BIT_RATE_1MBPS,
1184 .hw_value_short = 0x1, }, 1217 .hw_value_short = CONF_HW_BIT_RATE_1MBPS, },
1185 { .bitrate = 20, 1218 { .bitrate = 20,
1186 .hw_value = 0x2, 1219 .hw_value = CONF_HW_BIT_RATE_2MBPS,
1187 .hw_value_short = 0x2, 1220 .hw_value_short = CONF_HW_BIT_RATE_2MBPS,
1188 .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 1221 .flags = IEEE80211_RATE_SHORT_PREAMBLE },
1189 { .bitrate = 55, 1222 { .bitrate = 55,
1190 .hw_value = 0x4, 1223 .hw_value = CONF_HW_BIT_RATE_5_5MBPS,
1191 .hw_value_short = 0x4, 1224 .hw_value_short = CONF_HW_BIT_RATE_5_5MBPS,
1192 .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 1225 .flags = IEEE80211_RATE_SHORT_PREAMBLE },
1193 { .bitrate = 110, 1226 { .bitrate = 110,
1194 .hw_value = 0x20, 1227 .hw_value = CONF_HW_BIT_RATE_11MBPS,
1195 .hw_value_short = 0x20, 1228 .hw_value_short = CONF_HW_BIT_RATE_11MBPS,
1196 .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 1229 .flags = IEEE80211_RATE_SHORT_PREAMBLE },
1197 { .bitrate = 60, 1230 { .bitrate = 60,
1198 .hw_value = 0x8, 1231 .hw_value = CONF_HW_BIT_RATE_6MBPS,
1199 .hw_value_short = 0x8, }, 1232 .hw_value_short = CONF_HW_BIT_RATE_6MBPS, },
1200 { .bitrate = 90, 1233 { .bitrate = 90,
1201 .hw_value = 0x10, 1234 .hw_value = CONF_HW_BIT_RATE_9MBPS,
1202 .hw_value_short = 0x10, }, 1235 .hw_value_short = CONF_HW_BIT_RATE_9MBPS, },
1203 { .bitrate = 120, 1236 { .bitrate = 120,
1204 .hw_value = 0x40, 1237 .hw_value = CONF_HW_BIT_RATE_12MBPS,
1205 .hw_value_short = 0x40, }, 1238 .hw_value_short = CONF_HW_BIT_RATE_12MBPS, },
1206 { .bitrate = 180, 1239 { .bitrate = 180,
1207 .hw_value = 0x80, 1240 .hw_value = CONF_HW_BIT_RATE_18MBPS,
1208 .hw_value_short = 0x80, }, 1241 .hw_value_short = CONF_HW_BIT_RATE_18MBPS, },
1209 { .bitrate = 240, 1242 { .bitrate = 240,
1210 .hw_value = 0x200, 1243 .hw_value = CONF_HW_BIT_RATE_24MBPS,
1211 .hw_value_short = 0x200, }, 1244 .hw_value_short = CONF_HW_BIT_RATE_24MBPS, },
1212 { .bitrate = 360, 1245 { .bitrate = 360,
1213 .hw_value = 0x400, 1246 .hw_value = CONF_HW_BIT_RATE_36MBPS,
1214 .hw_value_short = 0x400, }, 1247 .hw_value_short = CONF_HW_BIT_RATE_36MBPS, },
1215 { .bitrate = 480, 1248 { .bitrate = 480,
1216 .hw_value = 0x800, 1249 .hw_value = CONF_HW_BIT_RATE_48MBPS,
1217 .hw_value_short = 0x800, }, 1250 .hw_value_short = CONF_HW_BIT_RATE_48MBPS, },
1218 { .bitrate = 540, 1251 { .bitrate = 540,
1219 .hw_value = 0x1000, 1252 .hw_value = CONF_HW_BIT_RATE_54MBPS,
1220 .hw_value_short = 0x1000, }, 1253 .hw_value_short = CONF_HW_BIT_RATE_54MBPS, },
1221}; 1254};
1222 1255
1223/* can't be const, mac80211 writes to this */ 1256/* can't be const, mac80211 writes to this */
@@ -1433,6 +1466,9 @@ static int __devinit wl1271_probe(struct spi_device *spi)
1433 } 1466 }
1434 dev_set_drvdata(&wl1271_device.dev, wl); 1467 dev_set_drvdata(&wl1271_device.dev, wl);
1435 1468
1469 /* Apply default driver configuration. */
1470 wl1271_conf_init(wl);
1471
1436 ret = wl1271_init_ieee80211(wl); 1472 ret = wl1271_init_ieee80211(wl);
1437 if (ret) 1473 if (ret)
1438 goto out_platform; 1474 goto out_platform;
diff --git a/drivers/net/wireless/wl12xx/wl1271_reg.h b/drivers/net/wireless/wl12xx/wl1271_reg.h
index 6af87b5573b..1f237389d1c 100644
--- a/drivers/net/wireless/wl12xx/wl1271_reg.h
+++ b/drivers/net/wireless/wl12xx/wl1271_reg.h
@@ -613,50 +613,6 @@ enum {
613 MAX_RADIO_BANDS = 0xFF 613 MAX_RADIO_BANDS = 0xFF
614}; 614};
615 615
616enum {
617 NO_RATE = 0,
618 RATE_1MBPS = 0x0A,
619 RATE_2MBPS = 0x14,
620 RATE_5_5MBPS = 0x37,
621 RATE_6MBPS = 0x0B,
622 RATE_9MBPS = 0x0F,
623 RATE_11MBPS = 0x6E,
624 RATE_12MBPS = 0x0A,
625 RATE_18MBPS = 0x0E,
626 RATE_22MBPS = 0xDC,
627 RATE_24MBPS = 0x09,
628 RATE_36MBPS = 0x0D,
629 RATE_48MBPS = 0x08,
630 RATE_54MBPS = 0x0C
631};
632
633enum {
634 RATE_INDEX_1MBPS = 0,
635 RATE_INDEX_2MBPS = 1,
636 RATE_INDEX_5_5MBPS = 2,
637 RATE_INDEX_6MBPS = 3,
638 RATE_INDEX_9MBPS = 4,
639 RATE_INDEX_11MBPS = 5,
640 RATE_INDEX_12MBPS = 6,
641 RATE_INDEX_18MBPS = 7,
642 RATE_INDEX_22MBPS = 8,
643 RATE_INDEX_24MBPS = 9,
644 RATE_INDEX_36MBPS = 10,
645 RATE_INDEX_48MBPS = 11,
646 RATE_INDEX_54MBPS = 12,
647 RATE_INDEX_MAX = RATE_INDEX_54MBPS,
648 MAX_RATE_INDEX,
649 INVALID_RATE_INDEX = MAX_RATE_INDEX,
650 RATE_INDEX_ENUM_MAX_SIZE = 0x7FFFFFFF
651};
652
653enum {
654 RATE_MASK_1MBPS = 0x1,
655 RATE_MASK_2MBPS = 0x2,
656 RATE_MASK_5_5MBPS = 0x4,
657 RATE_MASK_11MBPS = 0x20,
658};
659
660#define SHORT_PREAMBLE_BIT BIT(0) /* CCK or Barker depending on the rate */ 616#define SHORT_PREAMBLE_BIT BIT(0) /* CCK or Barker depending on the rate */
661#define OFDM_RATE_BIT BIT(6) 617#define OFDM_RATE_BIT BIT(6)
662#define PBCC_RATE_BIT BIT(7) 618#define PBCC_RATE_BIT BIT(7)