diff options
author | Bob Copeland <me@bobcopeland.com> | 2015-01-09 14:15:45 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-01-23 12:11:54 -0500 |
commit | 69a88cc7b164d92b4e397d9505dd4533f95fbc8a (patch) | |
tree | a6c229a21e12a0a8cedef8d83afbc60790d89c40 | |
parent | 96dae59155eb98dd0ba10e8fe5d130f425e406df (diff) |
wcn36xx: initialize device defaults on start
Set up default configuration for the device when we call start.
The defaults come from dumps from the prima driver for the same
hardware.
This fixes transmit A-MPDU; previously only one MPDU would be
sent per A-MPDU due to missing MAX_MPDUS_IN_AMPDU setting.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/ath/wcn36xx/smd.c | 73 |
1 files changed, 71 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 63986931829e..69ed39731902 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c | |||
@@ -21,6 +21,61 @@ | |||
21 | #include <linux/bitops.h> | 21 | #include <linux/bitops.h> |
22 | #include "smd.h" | 22 | #include "smd.h" |
23 | 23 | ||
24 | struct wcn36xx_cfg_val { | ||
25 | u32 cfg_id; | ||
26 | u32 value; | ||
27 | }; | ||
28 | |||
29 | #define WCN36XX_CFG_VAL(id, val) \ | ||
30 | { \ | ||
31 | .cfg_id = WCN36XX_HAL_CFG_ ## id, \ | ||
32 | .value = val \ | ||
33 | } | ||
34 | |||
35 | static struct wcn36xx_cfg_val wcn36xx_cfg_vals[] = { | ||
36 | WCN36XX_CFG_VAL(CURRENT_TX_ANTENNA, 1), | ||
37 | WCN36XX_CFG_VAL(CURRENT_RX_ANTENNA, 1), | ||
38 | WCN36XX_CFG_VAL(LOW_GAIN_OVERRIDE, 0), | ||
39 | WCN36XX_CFG_VAL(POWER_STATE_PER_CHAIN, 785), | ||
40 | WCN36XX_CFG_VAL(CAL_PERIOD, 5), | ||
41 | WCN36XX_CFG_VAL(CAL_CONTROL, 1), | ||
42 | WCN36XX_CFG_VAL(PROXIMITY, 0), | ||
43 | WCN36XX_CFG_VAL(NETWORK_DENSITY, 3), | ||
44 | WCN36XX_CFG_VAL(MAX_MEDIUM_TIME, 6000), | ||
45 | WCN36XX_CFG_VAL(MAX_MPDUS_IN_AMPDU, 64), | ||
46 | WCN36XX_CFG_VAL(RTS_THRESHOLD, 2347), | ||
47 | WCN36XX_CFG_VAL(SHORT_RETRY_LIMIT, 6), | ||
48 | WCN36XX_CFG_VAL(LONG_RETRY_LIMIT, 6), | ||
49 | WCN36XX_CFG_VAL(FRAGMENTATION_THRESHOLD, 8000), | ||
50 | WCN36XX_CFG_VAL(DYNAMIC_THRESHOLD_ZERO, 5), | ||
51 | WCN36XX_CFG_VAL(DYNAMIC_THRESHOLD_ONE, 10), | ||
52 | WCN36XX_CFG_VAL(DYNAMIC_THRESHOLD_TWO, 15), | ||
53 | WCN36XX_CFG_VAL(FIXED_RATE, 0), | ||
54 | WCN36XX_CFG_VAL(RETRYRATE_POLICY, 4), | ||
55 | WCN36XX_CFG_VAL(RETRYRATE_SECONDARY, 0), | ||
56 | WCN36XX_CFG_VAL(RETRYRATE_TERTIARY, 0), | ||
57 | WCN36XX_CFG_VAL(FORCE_POLICY_PROTECTION, 5), | ||
58 | WCN36XX_CFG_VAL(FIXED_RATE_MULTICAST_24GHZ, 1), | ||
59 | WCN36XX_CFG_VAL(FIXED_RATE_MULTICAST_5GHZ, 5), | ||
60 | WCN36XX_CFG_VAL(DEFAULT_RATE_INDEX_5GHZ, 5), | ||
61 | WCN36XX_CFG_VAL(MAX_BA_SESSIONS, 40), | ||
62 | WCN36XX_CFG_VAL(PS_DATA_INACTIVITY_TIMEOUT, 200), | ||
63 | WCN36XX_CFG_VAL(PS_ENABLE_BCN_FILTER, 1), | ||
64 | WCN36XX_CFG_VAL(PS_ENABLE_RSSI_MONITOR, 1), | ||
65 | WCN36XX_CFG_VAL(NUM_BEACON_PER_RSSI_AVERAGE, 20), | ||
66 | WCN36XX_CFG_VAL(STATS_PERIOD, 10), | ||
67 | WCN36XX_CFG_VAL(CFP_MAX_DURATION, 30000), | ||
68 | WCN36XX_CFG_VAL(FRAME_TRANS_ENABLED, 0), | ||
69 | WCN36XX_CFG_VAL(BA_THRESHOLD_HIGH, 128), | ||
70 | WCN36XX_CFG_VAL(MAX_BA_BUFFERS, 2560), | ||
71 | WCN36XX_CFG_VAL(DYNAMIC_PS_POLL_VALUE, 0), | ||
72 | WCN36XX_CFG_VAL(TX_PWR_CTRL_ENABLE, 1), | ||
73 | WCN36XX_CFG_VAL(ENABLE_CLOSE_LOOP, 1), | ||
74 | WCN36XX_CFG_VAL(ENABLE_LPWR_IMG_TRANSITION, 0), | ||
75 | WCN36XX_CFG_VAL(MAX_ASSOC_LIMIT, 10), | ||
76 | WCN36XX_CFG_VAL(ENABLE_MCC_ADAPTIVE_SCHEDULER, 0), | ||
77 | }; | ||
78 | |||
24 | static int put_cfg_tlv_u32(struct wcn36xx *wcn, size_t *len, u32 id, u32 value) | 79 | static int put_cfg_tlv_u32(struct wcn36xx *wcn, size_t *len, u32 id, u32 value) |
25 | { | 80 | { |
26 | struct wcn36xx_hal_cfg *entry; | 81 | struct wcn36xx_hal_cfg *entry; |
@@ -357,8 +412,10 @@ static int wcn36xx_smd_start_rsp(struct wcn36xx *wcn, void *buf, size_t len) | |||
357 | 412 | ||
358 | int wcn36xx_smd_start(struct wcn36xx *wcn) | 413 | int wcn36xx_smd_start(struct wcn36xx *wcn) |
359 | { | 414 | { |
360 | struct wcn36xx_hal_mac_start_req_msg msg_body; | 415 | struct wcn36xx_hal_mac_start_req_msg msg_body, *body; |
361 | int ret = 0; | 416 | int ret = 0; |
417 | int i; | ||
418 | size_t len; | ||
362 | 419 | ||
363 | mutex_lock(&wcn->hal_mutex); | 420 | mutex_lock(&wcn->hal_mutex); |
364 | INIT_HAL_MSG(msg_body, WCN36XX_HAL_START_REQ); | 421 | INIT_HAL_MSG(msg_body, WCN36XX_HAL_START_REQ); |
@@ -368,10 +425,22 @@ int wcn36xx_smd_start(struct wcn36xx *wcn) | |||
368 | 425 | ||
369 | PREPARE_HAL_BUF(wcn->hal_buf, msg_body); | 426 | PREPARE_HAL_BUF(wcn->hal_buf, msg_body); |
370 | 427 | ||
428 | body = (struct wcn36xx_hal_mac_start_req_msg *)wcn->hal_buf; | ||
429 | len = body->header.len; | ||
430 | |||
431 | for (i = 0; i < ARRAY_SIZE(wcn36xx_cfg_vals); i++) { | ||
432 | ret = put_cfg_tlv_u32(wcn, &len, wcn36xx_cfg_vals[i].cfg_id, | ||
433 | wcn36xx_cfg_vals[i].value); | ||
434 | if (ret) | ||
435 | goto out; | ||
436 | } | ||
437 | body->header.len = len; | ||
438 | body->params.len = len - sizeof(*body); | ||
439 | |||
371 | wcn36xx_dbg(WCN36XX_DBG_HAL, "hal start type %d\n", | 440 | wcn36xx_dbg(WCN36XX_DBG_HAL, "hal start type %d\n", |
372 | msg_body.params.type); | 441 | msg_body.params.type); |
373 | 442 | ||
374 | ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); | 443 | ret = wcn36xx_smd_send_and_wait(wcn, body->header.len); |
375 | if (ret) { | 444 | if (ret) { |
376 | wcn36xx_err("Sending hal_start failed\n"); | 445 | wcn36xx_err("Sending hal_start failed\n"); |
377 | goto out; | 446 | goto out; |