Skip to content

Commit 0c0b8fb

Browse files
committed
wl18xx-R8.6_SP1
Signed-off-by: Robert Nelson <[email protected]>
1 parent a8c2409 commit 0c0b8fb

File tree

18 files changed

+468
-156
lines changed

18 files changed

+468
-156
lines changed

drivers/net/wireless/ti/wl18xx/debugfs.c

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,127 @@ static const struct file_operations radar_detection_ops = {
296296
.llseek = default_llseek,
297297
};
298298

299+
static ssize_t radar_debug_mode_write(struct file *file,
300+
const char __user *user_buf,
301+
size_t count, loff_t *ppos)
302+
{
303+
struct wl1271 *wl = file->private_data;
304+
struct wl12xx_vif *wlvif;
305+
unsigned long value;
306+
int ret;
307+
308+
ret = kstrtoul_from_user(user_buf, count, 10, &value);
309+
if (ret < 0) {
310+
wl1271_warning("illegal value in radar_debug_mode!");
311+
return -EINVAL;
312+
}
313+
314+
/* valid values: 0/1 */
315+
if (!(value == 0 || value == 1)) {
316+
wl1271_warning("value is not in valid!");
317+
return -EINVAL;
318+
}
319+
320+
mutex_lock(&wl->mutex);
321+
322+
wl->radar_debug_mode = value;
323+
324+
if (unlikely(wl->state != WLCORE_STATE_ON))
325+
goto out;
326+
327+
ret = wl1271_ps_elp_wakeup(wl);
328+
if (ret < 0)
329+
goto out;
330+
331+
wl12xx_for_each_wlvif_ap(wl, wlvif) {
332+
wlcore_cmd_generic_cfg(wl, wlvif,
333+
WLCORE_CFG_FEATURE_RADAR_DEBUG,
334+
wl->radar_debug_mode, 0);
335+
}
336+
337+
wl1271_ps_elp_sleep(wl);
338+
out:
339+
mutex_unlock(&wl->mutex);
340+
return count;
341+
}
342+
343+
static ssize_t radar_debug_mode_read(struct file *file,
344+
char __user *userbuf,
345+
size_t count, loff_t *ppos)
346+
{
347+
struct wl1271 *wl = file->private_data;
348+
return wl1271_format_buffer(userbuf, count, ppos,
349+
"%d\n", wl->radar_debug_mode);
350+
}
351+
352+
static const struct file_operations radar_debug_mode_ops = {
353+
.write = radar_debug_mode_write,
354+
.read = radar_debug_mode_read,
355+
.open = simple_open,
356+
.llseek = default_llseek,
357+
};
358+
359+
static ssize_t diversity_mode_write(struct file *file,
360+
const char __user *user_buf,
361+
size_t count, loff_t *ppos)
362+
{
363+
struct wl1271 *wl = file->private_data;
364+
struct wl12xx_vif *wlvif;
365+
unsigned long value;
366+
int ret;
367+
368+
ret = kstrtoul_from_user(user_buf, count, 10, &value);
369+
if (ret < 0) {
370+
wl1271_warning("illegal value in diversity mode!");
371+
return -EINVAL;
372+
}
373+
374+
/* valid values: 0/1 */
375+
if (!(value == 0 || value == 1)) {
376+
wl1271_warning("value is not in valid!");
377+
return -EINVAL;
378+
}
379+
380+
mutex_lock(&wl->mutex);
381+
382+
wl->diversity_mode = value;
383+
384+
if (unlikely(wl->state != WLCORE_STATE_ON))
385+
goto out;
386+
387+
ret = wl1271_ps_elp_wakeup(wl);
388+
if (ret < 0)
389+
goto out;
390+
391+
wl12xx_for_each_wlvif(wl, wlvif) {
392+
wlcore_cmd_generic_cfg(wl, wlvif,
393+
WLCORE_CFG_FEATURE_DIVERSITY_MODE,
394+
wl->diversity_mode, 0);
395+
}
396+
397+
wl1271_ps_elp_sleep(wl);
398+
out:
399+
mutex_unlock(&wl->mutex);
400+
return count;
401+
}
402+
403+
static ssize_t diversity_mode_read(struct file *file,
404+
char __user *userbuf,
405+
size_t count, loff_t *ppos)
406+
{
407+
struct wl1271 *wl = file->private_data;
408+
409+
return wl1271_format_buffer(userbuf, count, ppos,
410+
"%d\n", wl->diversity_mode);
411+
}
412+
413+
static const struct file_operations diversity_mode_ops = {
414+
.write = diversity_mode_write,
415+
.read = diversity_mode_read,
416+
.open = simple_open,
417+
.llseek = default_llseek,
418+
};
419+
299420
static ssize_t dynamic_fw_traces_write(struct file *file,
300421
const char __user *user_buf,
301422
size_t count, loff_t *ppos)
@@ -511,7 +632,9 @@ int wl18xx_debugfs_add_files(struct wl1271 *wl,
511632

512633
DEBUGFS_ADD(conf, moddir);
513634
DEBUGFS_ADD(radar_detection, moddir);
635+
DEBUGFS_ADD(radar_debug_mode, moddir);
514636
DEBUGFS_ADD(dynamic_fw_traces, moddir);
637+
DEBUGFS_ADD(diversity_mode, moddir);
515638

516639
return 0;
517640

drivers/net/wireless/ti/wl18xx/event.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
146146
mbox->radar_channel,
147147
wl18xx_radar_type_decode(mbox->radar_type));
148148

149-
ieee80211_radar_detected(wl->hw);
149+
if (!wl->radar_debug_mode)
150+
ieee80211_radar_detected(wl->hw);
150151
}
151152

152153
if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) {
@@ -264,6 +265,9 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
264265
wl->links[link_id].addr),
265266
win_size);
266267
}
268+
if (vector & FW_LOGGER_INDICATION)
269+
wlcore_event_fw_logger(wl);
270+
267271

268272
out_event:
269273

drivers/net/wireless/ti/wl18xx/event.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ enum {
4242
SMART_CONFIG_SYNC_EVENT_ID = BIT(22),
4343
SMART_CONFIG_DECODE_EVENT_ID = BIT(23),
4444
TIME_SYNC_EVENT_ID = BIT(24),
45+
FW_LOGGER_INDICATION = BIT(25),
4546
};
4647

4748
enum wl18xx_radar_types {

drivers/net/wireless/ti/wl18xx/main.c

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static struct wlcore_conf wl18xx_conf = {
461461
},
462462
.fwlog = {
463463
.mode = WL12XX_FWLOG_CONTINUOUS,
464-
.mem_blocks = 2,
464+
.mem_blocks = 0,
465465
.severity = 0,
466466
.timestamp = WL12XX_FWLOG_TIMESTAMP_DISABLED,
467467
.output = WL12XX_FWLOG_OUTPUT_DBG_PINS,
@@ -584,7 +584,7 @@ static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = {
584584
.mem = { .start = 0x00A00000, .size = 0x00012000 },
585585
.reg = { .start = 0x00807000, .size = 0x00005000 },
586586
.mem2 = { .start = 0x00800000, .size = 0x0000B000 },
587-
.mem3 = { .start = 0x00000000, .size = 0x00000000 },
587+
.mem3 = { .start = 0x00401594, .size = 0x00001020 },
588588
},
589589
[PART_DOWN] = {
590590
.mem = { .start = 0x00000000, .size = 0x00014000 },
@@ -602,7 +602,7 @@ static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = {
602602
.mem = { .start = 0x00800000, .size = 0x000050FC },
603603
.reg = { .start = 0x00B00404, .size = 0x00001000 },
604604
.mem2 = { .start = 0x00C00000, .size = 0x00000400 },
605-
.mem3 = { .start = 0x00000000, .size = 0x00000000 },
605+
.mem3 = { .start = 0x00401594, .size = 0x00001020 },
606606
},
607607
[PART_PHY_INIT] = {
608608
.mem = { .start = WL18XX_PHY_INIT_MEM_ADDR,
@@ -1030,7 +1030,8 @@ static int wl18xx_boot(struct wl1271 *wl)
10301030
SMART_CONFIG_SYNC_EVENT_ID |
10311031
SMART_CONFIG_DECODE_EVENT_ID |
10321032
RX_BA_WIN_SIZE_CHANGE_EVENT_ID |
1033-
TIME_SYNC_EVENT_ID;
1033+
TIME_SYNC_EVENT_ID |
1034+
FW_LOGGER_INDICATION;
10341035

10351036
wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID;
10361037

@@ -1176,6 +1177,13 @@ static int wl18xx_hw_init(struct wl1271 *wl)
11761177
return ret;
11771178
}
11781179

1180+
static int wl18xx_init_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1181+
{
1182+
return wlcore_cmd_generic_cfg(wl, wlvif,
1183+
WLCORE_CFG_FEATURE_DIVERSITY_MODE,
1184+
wl->diversity_mode, 0);
1185+
}
1186+
11791187
static void wl18xx_convert_fw_status(struct wl1271 *wl, void *raw_fw_status,
11801188
struct wl_fw_status *fw_status)
11811189
{
@@ -1384,24 +1392,24 @@ static int wl18xx_get_pg_ver(struct wl1271 *wl, s8 *ver)
13841392

13851393
#define WL18XX_CONF_FILE_NAME "ti-connectivity/wl18xx-conf.bin"
13861394

1387-
static int wl18xx_load_conf_file(struct device *dev, struct wlcore_conf *conf,
1388-
struct wl18xx_priv_conf *priv_conf)
1395+
static struct wlcore_conf_file *
1396+
wl18xx_load_conf_file(struct device *dev, const struct firmware **_fw)
13891397
{
13901398
struct wlcore_conf_file *conf_file;
13911399
const struct firmware *fw;
13921400
int ret;
13931401

1394-
ret = request_firmware(&fw, WL18XX_CONF_FILE_NAME, dev);
1402+
ret = request_firmware(_fw, WL18XX_CONF_FILE_NAME, dev);
13951403
if (ret < 0) {
1396-
wl1271_error("could not get configuration binary %s: %d",
1404+
wl1271_info("could not get configuration binary %s: %d",
13971405
WL18XX_CONF_FILE_NAME, ret);
1398-
return ret;
1406+
return NULL;
13991407
}
14001408

1409+
fw = *_fw;
14011410
if (fw->size != WL18XX_CONF_SIZE) {
1402-
wl1271_error("configuration binary file size is wrong, expected %zu got %zu",
1411+
wl1271_info("configuration binary file size is wrong, expected %zu got %zu",
14031412
WL18XX_CONF_SIZE, fw->size);
1404-
ret = -EINVAL;
14051413
goto out_release;
14061414
}
14071415

@@ -1411,35 +1419,39 @@ static int wl18xx_load_conf_file(struct device *dev, struct wlcore_conf *conf,
14111419
wl1271_error("configuration binary file magic number mismatch, "
14121420
"expected 0x%0x got 0x%0x", WL18XX_CONF_MAGIC,
14131421
conf_file->header.magic);
1414-
ret = -EINVAL;
14151422
goto out_release;
14161423
}
14171424

14181425
if (conf_file->header.version != cpu_to_le32(WL18XX_CONF_VERSION)) {
14191426
wl1271_error("configuration binary file version not supported, "
14201427
"expected 0x%08x got 0x%08x",
14211428
WL18XX_CONF_VERSION, conf_file->header.version);
1422-
ret = -EINVAL;
14231429
goto out_release;
14241430
}
14251431

1426-
memcpy(conf, &conf_file->core, sizeof(*conf));
1427-
memcpy(priv_conf, &conf_file->priv, sizeof(*priv_conf));
1432+
return conf_file;
14281433

14291434
out_release:
14301435
release_firmware(fw);
1431-
return ret;
1436+
return NULL;
14321437
}
14331438

14341439
static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev)
14351440
{
14361441
struct wl18xx_priv *priv = wl->priv;
1442+
struct wlcore_conf_file *conf_file;
1443+
const struct firmware *fw;
14371444

1438-
if (wl18xx_load_conf_file(dev, &wl->conf, &priv->conf) < 0) {
1445+
conf_file = wl18xx_load_conf_file(dev, &fw);
1446+
if (conf_file) {
1447+
memcpy(&wl->conf, &conf_file->core, sizeof(wl18xx_conf));
1448+
memcpy(&priv->conf, &conf_file->priv, sizeof(priv->conf));
1449+
release_firmware(fw);
1450+
} else {
14391451
wl1271_warning("falling back to default config");
14401452

14411453
/* apply driver default configuration */
1442-
memcpy(&wl->conf, &wl18xx_conf, sizeof(wl->conf));
1454+
memcpy(&wl->conf, &wl18xx_conf, sizeof(wl18xx_conf));
14431455
/* apply default private configuration */
14441456
memcpy(&priv->conf, &wl18xx_default_priv_conf,
14451457
sizeof(priv->conf));
@@ -1713,6 +1725,7 @@ static struct wlcore_ops wl18xx_ops = {
17131725
.tx_immediate_compl = wl18xx_tx_immediate_completion,
17141726
.tx_delayed_compl = NULL,
17151727
.hw_init = wl18xx_hw_init,
1728+
.init_vif = wl18xx_init_vif,
17161729
.convert_fw_status = wl18xx_convert_fw_status,
17171730
.set_tx_desc_csum = wl18xx_set_tx_desc_csum,
17181731
.get_pg_ver = wl18xx_get_pg_ver,
@@ -1886,6 +1899,28 @@ wl18xx_iface_combinations[] = {
18861899
BIT(NL80211_CHAN_HT20) |
18871900
BIT(NL80211_CHAN_HT40MINUS) |
18881901
BIT(NL80211_CHAN_HT40PLUS),
1902+
},
1903+
{
1904+
.max_interfaces = 3,
1905+
.limits = wl18xx_iface_ap_cl_limits,
1906+
.n_limits = ARRAY_SIZE(wl18xx_iface_ap_cl_limits),
1907+
.num_different_channels = 2,
1908+
},
1909+
{
1910+
.max_interfaces = 3,
1911+
.limits = wl18xx_iface_ap_cl_limits,
1912+
.n_limits = ARRAY_SIZE(wl18xx_iface_ap_cl_limits),
1913+
.num_different_channels = 1,
1914+
.radar_detect_widths = BIT(NL80211_CHAN_NO_HT) |
1915+
BIT(NL80211_CHAN_HT20) |
1916+
BIT(NL80211_CHAN_HT40MINUS) |
1917+
BIT(NL80211_CHAN_HT40PLUS),
1918+
},
1919+
{
1920+
.max_interfaces = 3,
1921+
.limits = wl18xx_iface_ap_go_limits,
1922+
.n_limits = ARRAY_SIZE(wl18xx_iface_ap_go_limits),
1923+
.num_different_channels = 1,
18891924
}
18901925
};
18911926

@@ -2005,10 +2040,8 @@ static int wl18xx_setup(struct wl1271 *wl)
20052040
&wl18xx_siso20_ht_cap);
20062041
}
20072042

2008-
if (!checksum_param) {
2043+
if (!checksum_param)
20092044
wl18xx_ops.set_rx_csum = NULL;
2010-
wl18xx_ops.init_vif = NULL;
2011-
}
20122045

20132046
/* Enable 11a Band only if we have 5G antennas */
20142047
wl->enable_11a = (priv->conf.phy.number_of_assembled_ant5 != 0);

drivers/net/wireless/ti/wlcore/cmd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ struct wl12xx_cmd_remove_peer {
626626
*/
627627
enum wl12xx_fwlogger_log_mode {
628628
WL12XX_FWLOG_CONTINUOUS,
629-
WL12XX_FWLOG_ON_DEMAND
630629
};
631630

632631
/* Include/exclude timestamps from the log messages */
@@ -655,6 +654,7 @@ struct wl12xx_cmd_regdomain_dfs_config {
655654
} __packed;
656655

657656
enum wlcore_generic_cfg_feature {
657+
WLCORE_CFG_FEATURE_DIVERSITY_MODE = 1,
658658
WLCORE_CFG_FEATURE_RADAR_DEBUG = 2,
659659
};
660660

0 commit comments

Comments
 (0)