18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * This file is part of wl18xx 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Texas Instruments 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/module.h> 98c2ecf20Sopenharmony_ci#include <linux/mod_devicetable.h> 108c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 118c2ecf20Sopenharmony_ci#include <linux/ip.h> 128c2ecf20Sopenharmony_ci#include <linux/firmware.h> 138c2ecf20Sopenharmony_ci#include <linux/etherdevice.h> 148c2ecf20Sopenharmony_ci#include <linux/irq.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include "../wlcore/wlcore.h" 178c2ecf20Sopenharmony_ci#include "../wlcore/debug.h" 188c2ecf20Sopenharmony_ci#include "../wlcore/io.h" 198c2ecf20Sopenharmony_ci#include "../wlcore/acx.h" 208c2ecf20Sopenharmony_ci#include "../wlcore/tx.h" 218c2ecf20Sopenharmony_ci#include "../wlcore/rx.h" 228c2ecf20Sopenharmony_ci#include "../wlcore/boot.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#include "reg.h" 258c2ecf20Sopenharmony_ci#include "conf.h" 268c2ecf20Sopenharmony_ci#include "cmd.h" 278c2ecf20Sopenharmony_ci#include "acx.h" 288c2ecf20Sopenharmony_ci#include "tx.h" 298c2ecf20Sopenharmony_ci#include "wl18xx.h" 308c2ecf20Sopenharmony_ci#include "io.h" 318c2ecf20Sopenharmony_ci#include "scan.h" 328c2ecf20Sopenharmony_ci#include "event.h" 338c2ecf20Sopenharmony_ci#include "debugfs.h" 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define WL18XX_RX_CHECKSUM_MASK 0x40 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistatic char *ht_mode_param = NULL; 388c2ecf20Sopenharmony_cistatic char *board_type_param = NULL; 398c2ecf20Sopenharmony_cistatic bool checksum_param = false; 408c2ecf20Sopenharmony_cistatic int num_rx_desc_param = -1; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/* phy paramters */ 438c2ecf20Sopenharmony_cistatic int dc2dc_param = -1; 448c2ecf20Sopenharmony_cistatic int n_antennas_2_param = -1; 458c2ecf20Sopenharmony_cistatic int n_antennas_5_param = -1; 468c2ecf20Sopenharmony_cistatic int low_band_component_param = -1; 478c2ecf20Sopenharmony_cistatic int low_band_component_type_param = -1; 488c2ecf20Sopenharmony_cistatic int high_band_component_param = -1; 498c2ecf20Sopenharmony_cistatic int high_band_component_type_param = -1; 508c2ecf20Sopenharmony_cistatic int pwr_limit_reference_11_abg_param = -1; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_cistatic const u8 wl18xx_rate_to_idx_2ghz[] = { 538c2ecf20Sopenharmony_ci /* MCS rates are used only with 11n */ 548c2ecf20Sopenharmony_ci 15, /* WL18XX_CONF_HW_RXTX_RATE_MCS15 */ 558c2ecf20Sopenharmony_ci 14, /* WL18XX_CONF_HW_RXTX_RATE_MCS14 */ 568c2ecf20Sopenharmony_ci 13, /* WL18XX_CONF_HW_RXTX_RATE_MCS13 */ 578c2ecf20Sopenharmony_ci 12, /* WL18XX_CONF_HW_RXTX_RATE_MCS12 */ 588c2ecf20Sopenharmony_ci 11, /* WL18XX_CONF_HW_RXTX_RATE_MCS11 */ 598c2ecf20Sopenharmony_ci 10, /* WL18XX_CONF_HW_RXTX_RATE_MCS10 */ 608c2ecf20Sopenharmony_ci 9, /* WL18XX_CONF_HW_RXTX_RATE_MCS9 */ 618c2ecf20Sopenharmony_ci 8, /* WL18XX_CONF_HW_RXTX_RATE_MCS8 */ 628c2ecf20Sopenharmony_ci 7, /* WL18XX_CONF_HW_RXTX_RATE_MCS7 */ 638c2ecf20Sopenharmony_ci 6, /* WL18XX_CONF_HW_RXTX_RATE_MCS6 */ 648c2ecf20Sopenharmony_ci 5, /* WL18XX_CONF_HW_RXTX_RATE_MCS5 */ 658c2ecf20Sopenharmony_ci 4, /* WL18XX_CONF_HW_RXTX_RATE_MCS4 */ 668c2ecf20Sopenharmony_ci 3, /* WL18XX_CONF_HW_RXTX_RATE_MCS3 */ 678c2ecf20Sopenharmony_ci 2, /* WL18XX_CONF_HW_RXTX_RATE_MCS2 */ 688c2ecf20Sopenharmony_ci 1, /* WL18XX_CONF_HW_RXTX_RATE_MCS1 */ 698c2ecf20Sopenharmony_ci 0, /* WL18XX_CONF_HW_RXTX_RATE_MCS0 */ 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci 11, /* WL18XX_CONF_HW_RXTX_RATE_54 */ 728c2ecf20Sopenharmony_ci 10, /* WL18XX_CONF_HW_RXTX_RATE_48 */ 738c2ecf20Sopenharmony_ci 9, /* WL18XX_CONF_HW_RXTX_RATE_36 */ 748c2ecf20Sopenharmony_ci 8, /* WL18XX_CONF_HW_RXTX_RATE_24 */ 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci /* TI-specific rate */ 778c2ecf20Sopenharmony_ci CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_22 */ 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci 7, /* WL18XX_CONF_HW_RXTX_RATE_18 */ 808c2ecf20Sopenharmony_ci 6, /* WL18XX_CONF_HW_RXTX_RATE_12 */ 818c2ecf20Sopenharmony_ci 3, /* WL18XX_CONF_HW_RXTX_RATE_11 */ 828c2ecf20Sopenharmony_ci 5, /* WL18XX_CONF_HW_RXTX_RATE_9 */ 838c2ecf20Sopenharmony_ci 4, /* WL18XX_CONF_HW_RXTX_RATE_6 */ 848c2ecf20Sopenharmony_ci 2, /* WL18XX_CONF_HW_RXTX_RATE_5_5 */ 858c2ecf20Sopenharmony_ci 1, /* WL18XX_CONF_HW_RXTX_RATE_2 */ 868c2ecf20Sopenharmony_ci 0 /* WL18XX_CONF_HW_RXTX_RATE_1 */ 878c2ecf20Sopenharmony_ci}; 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_cistatic const u8 wl18xx_rate_to_idx_5ghz[] = { 908c2ecf20Sopenharmony_ci /* MCS rates are used only with 11n */ 918c2ecf20Sopenharmony_ci 15, /* WL18XX_CONF_HW_RXTX_RATE_MCS15 */ 928c2ecf20Sopenharmony_ci 14, /* WL18XX_CONF_HW_RXTX_RATE_MCS14 */ 938c2ecf20Sopenharmony_ci 13, /* WL18XX_CONF_HW_RXTX_RATE_MCS13 */ 948c2ecf20Sopenharmony_ci 12, /* WL18XX_CONF_HW_RXTX_RATE_MCS12 */ 958c2ecf20Sopenharmony_ci 11, /* WL18XX_CONF_HW_RXTX_RATE_MCS11 */ 968c2ecf20Sopenharmony_ci 10, /* WL18XX_CONF_HW_RXTX_RATE_MCS10 */ 978c2ecf20Sopenharmony_ci 9, /* WL18XX_CONF_HW_RXTX_RATE_MCS9 */ 988c2ecf20Sopenharmony_ci 8, /* WL18XX_CONF_HW_RXTX_RATE_MCS8 */ 998c2ecf20Sopenharmony_ci 7, /* WL18XX_CONF_HW_RXTX_RATE_MCS7 */ 1008c2ecf20Sopenharmony_ci 6, /* WL18XX_CONF_HW_RXTX_RATE_MCS6 */ 1018c2ecf20Sopenharmony_ci 5, /* WL18XX_CONF_HW_RXTX_RATE_MCS5 */ 1028c2ecf20Sopenharmony_ci 4, /* WL18XX_CONF_HW_RXTX_RATE_MCS4 */ 1038c2ecf20Sopenharmony_ci 3, /* WL18XX_CONF_HW_RXTX_RATE_MCS3 */ 1048c2ecf20Sopenharmony_ci 2, /* WL18XX_CONF_HW_RXTX_RATE_MCS2 */ 1058c2ecf20Sopenharmony_ci 1, /* WL18XX_CONF_HW_RXTX_RATE_MCS1 */ 1068c2ecf20Sopenharmony_ci 0, /* WL18XX_CONF_HW_RXTX_RATE_MCS0 */ 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci 7, /* WL18XX_CONF_HW_RXTX_RATE_54 */ 1098c2ecf20Sopenharmony_ci 6, /* WL18XX_CONF_HW_RXTX_RATE_48 */ 1108c2ecf20Sopenharmony_ci 5, /* WL18XX_CONF_HW_RXTX_RATE_36 */ 1118c2ecf20Sopenharmony_ci 4, /* WL18XX_CONF_HW_RXTX_RATE_24 */ 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci /* TI-specific rate */ 1148c2ecf20Sopenharmony_ci CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_22 */ 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci 3, /* WL18XX_CONF_HW_RXTX_RATE_18 */ 1178c2ecf20Sopenharmony_ci 2, /* WL18XX_CONF_HW_RXTX_RATE_12 */ 1188c2ecf20Sopenharmony_ci CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_11 */ 1198c2ecf20Sopenharmony_ci 1, /* WL18XX_CONF_HW_RXTX_RATE_9 */ 1208c2ecf20Sopenharmony_ci 0, /* WL18XX_CONF_HW_RXTX_RATE_6 */ 1218c2ecf20Sopenharmony_ci CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_5_5 */ 1228c2ecf20Sopenharmony_ci CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_2 */ 1238c2ecf20Sopenharmony_ci CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_1 */ 1248c2ecf20Sopenharmony_ci}; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_cistatic const u8 *wl18xx_band_rate_to_idx[] = { 1278c2ecf20Sopenharmony_ci [NL80211_BAND_2GHZ] = wl18xx_rate_to_idx_2ghz, 1288c2ecf20Sopenharmony_ci [NL80211_BAND_5GHZ] = wl18xx_rate_to_idx_5ghz 1298c2ecf20Sopenharmony_ci}; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_cienum wl18xx_hw_rates { 1328c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS15 = 0, 1338c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS14, 1348c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS13, 1358c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS12, 1368c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS11, 1378c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS10, 1388c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS9, 1398c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS8, 1408c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS7, 1418c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS6, 1428c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS5, 1438c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS4, 1448c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS3, 1458c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS2, 1468c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS1, 1478c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MCS0, 1488c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_54, 1498c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_48, 1508c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_36, 1518c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_24, 1528c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_22, 1538c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_18, 1548c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_12, 1558c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_11, 1568c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_9, 1578c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_6, 1588c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_5_5, 1598c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_2, 1608c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_1, 1618c2ecf20Sopenharmony_ci WL18XX_CONF_HW_RXTX_RATE_MAX, 1628c2ecf20Sopenharmony_ci}; 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_cistatic struct wlcore_conf wl18xx_conf = { 1658c2ecf20Sopenharmony_ci .sg = { 1668c2ecf20Sopenharmony_ci .params = { 1678c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_0] = 0, 1688c2ecf20Sopenharmony_ci /* Configuration Parameters */ 1698c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_ANTENNA_CONFIGURATION] = 0, 1708c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_ZIGBEE_COEX] = 0, 1718c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TIME_SYNC] = 0, 1728c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_4] = 0, 1738c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_5] = 0, 1748c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_6] = 0, 1758c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_7] = 0, 1768c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_8] = 0, 1778c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_9] = 0, 1788c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_10] = 0, 1798c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_11] = 0, 1808c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_12] = 0, 1818c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_13] = 0, 1828c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_14] = 0, 1838c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_15] = 0, 1848c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_16] = 0, 1858c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_17] = 0, 1868c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_18] = 0, 1878c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_19] = 0, 1888c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_20] = 0, 1898c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_21] = 0, 1908c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_22] = 0, 1918c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_23] = 0, 1928c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_24] = 0, 1938c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_25] = 0, 1948c2ecf20Sopenharmony_ci /* Active Scan Parameters */ 1958c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_AUTO_SCAN_PROBE_REQ] = 170, 1968c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_HV3] = 50, 1978c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_28] = 0, 1988c2ecf20Sopenharmony_ci /* Passive Scan Parameters */ 1998c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_29] = 0, 2008c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_30] = 0, 2018c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_HV3] = 200, 2028c2ecf20Sopenharmony_ci /* Passive Scan in Dual Antenna Parameters */ 2038c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_CONSECUTIVE_HV3_IN_PASSIVE_SCAN] = 0, 2048c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_BEACON_HV3_COLL_TH_IN_PASSIVE_SCAN] = 0, 2058c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TX_RX_PROTECT_BW_IN_PASSIVE_SCAN] = 0, 2068c2ecf20Sopenharmony_ci /* General Parameters */ 2078c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_STA_FORCE_PS_IN_BT_SCO] = 1, 2088c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_36] = 0, 2098c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_BEACON_MISS_PERCENT] = 60, 2108c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_38] = 0, 2118c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_RXT] = 1200, 2128c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_UNUSED] = 0, 2138c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_ADAPTIVE_RXT_TXT] = 1, 2148c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_GENERAL_USAGE_BIT_MAP] = 3, 2158c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_HV3_MAX_SERVED] = 6, 2168c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_44] = 0, 2178c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_45] = 0, 2188c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_CONSECUTIVE_CTS_THRESHOLD] = 2, 2198c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_GEMINI_PARAM_47] = 0, 2208c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_STA_CONNECTION_PROTECTION_TIME] = 0, 2218c2ecf20Sopenharmony_ci /* AP Parameters */ 2228c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_AP_BEACON_MISS_TX] = 3, 2238c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_50] = 0, 2248c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_AP_BEACON_WINDOW_INTERVAL] = 2, 2258c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_AP_CONNECTION_PROTECTION_TIME] = 30, 2268c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_53] = 0, 2278c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_PARAM_54] = 0, 2288c2ecf20Sopenharmony_ci /* CTS Diluting Parameters */ 2298c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_CTS_DILUTED_BAD_RX_PACKETS_TH] = 0, 2308c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_CTS_CHOP_IN_DUAL_ANT_SCO_MASTER] = 0, 2318c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_1] = 0, 2328c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_2] = 0, 2338c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_3] = 0, 2348c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_4] = 0, 2358c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_5] = 0, 2368c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_6] = 0, 2378c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_7] = 0, 2388c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_8] = 0, 2398c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_9] = 0, 2408c2ecf20Sopenharmony_ci [WL18XX_CONF_SG_TEMP_PARAM_10] = 0, 2418c2ecf20Sopenharmony_ci }, 2428c2ecf20Sopenharmony_ci .state = CONF_SG_PROTECTIVE, 2438c2ecf20Sopenharmony_ci }, 2448c2ecf20Sopenharmony_ci .rx = { 2458c2ecf20Sopenharmony_ci .rx_msdu_life_time = 512000, 2468c2ecf20Sopenharmony_ci .packet_detection_threshold = 0, 2478c2ecf20Sopenharmony_ci .ps_poll_timeout = 15, 2488c2ecf20Sopenharmony_ci .upsd_timeout = 15, 2498c2ecf20Sopenharmony_ci .rts_threshold = IEEE80211_MAX_RTS_THRESHOLD, 2508c2ecf20Sopenharmony_ci .rx_cca_threshold = 0, 2518c2ecf20Sopenharmony_ci .irq_blk_threshold = 0xFFFF, 2528c2ecf20Sopenharmony_ci .irq_pkt_threshold = 0, 2538c2ecf20Sopenharmony_ci .irq_timeout = 600, 2548c2ecf20Sopenharmony_ci .queue_type = CONF_RX_QUEUE_TYPE_LOW_PRIORITY, 2558c2ecf20Sopenharmony_ci }, 2568c2ecf20Sopenharmony_ci .tx = { 2578c2ecf20Sopenharmony_ci .tx_energy_detection = 0, 2588c2ecf20Sopenharmony_ci .sta_rc_conf = { 2598c2ecf20Sopenharmony_ci .enabled_rates = 0, 2608c2ecf20Sopenharmony_ci .short_retry_limit = 10, 2618c2ecf20Sopenharmony_ci .long_retry_limit = 10, 2628c2ecf20Sopenharmony_ci .aflags = 0, 2638c2ecf20Sopenharmony_ci }, 2648c2ecf20Sopenharmony_ci .ac_conf_count = 4, 2658c2ecf20Sopenharmony_ci .ac_conf = { 2668c2ecf20Sopenharmony_ci [CONF_TX_AC_BE] = { 2678c2ecf20Sopenharmony_ci .ac = CONF_TX_AC_BE, 2688c2ecf20Sopenharmony_ci .cw_min = 15, 2698c2ecf20Sopenharmony_ci .cw_max = 63, 2708c2ecf20Sopenharmony_ci .aifsn = 3, 2718c2ecf20Sopenharmony_ci .tx_op_limit = 0, 2728c2ecf20Sopenharmony_ci }, 2738c2ecf20Sopenharmony_ci [CONF_TX_AC_BK] = { 2748c2ecf20Sopenharmony_ci .ac = CONF_TX_AC_BK, 2758c2ecf20Sopenharmony_ci .cw_min = 15, 2768c2ecf20Sopenharmony_ci .cw_max = 63, 2778c2ecf20Sopenharmony_ci .aifsn = 7, 2788c2ecf20Sopenharmony_ci .tx_op_limit = 0, 2798c2ecf20Sopenharmony_ci }, 2808c2ecf20Sopenharmony_ci [CONF_TX_AC_VI] = { 2818c2ecf20Sopenharmony_ci .ac = CONF_TX_AC_VI, 2828c2ecf20Sopenharmony_ci .cw_min = 15, 2838c2ecf20Sopenharmony_ci .cw_max = 63, 2848c2ecf20Sopenharmony_ci .aifsn = CONF_TX_AIFS_PIFS, 2858c2ecf20Sopenharmony_ci .tx_op_limit = 3008, 2868c2ecf20Sopenharmony_ci }, 2878c2ecf20Sopenharmony_ci [CONF_TX_AC_VO] = { 2888c2ecf20Sopenharmony_ci .ac = CONF_TX_AC_VO, 2898c2ecf20Sopenharmony_ci .cw_min = 15, 2908c2ecf20Sopenharmony_ci .cw_max = 63, 2918c2ecf20Sopenharmony_ci .aifsn = CONF_TX_AIFS_PIFS, 2928c2ecf20Sopenharmony_ci .tx_op_limit = 1504, 2938c2ecf20Sopenharmony_ci }, 2948c2ecf20Sopenharmony_ci }, 2958c2ecf20Sopenharmony_ci .max_tx_retries = 100, 2968c2ecf20Sopenharmony_ci .ap_aging_period = 300, 2978c2ecf20Sopenharmony_ci .tid_conf_count = 4, 2988c2ecf20Sopenharmony_ci .tid_conf = { 2998c2ecf20Sopenharmony_ci [CONF_TX_AC_BE] = { 3008c2ecf20Sopenharmony_ci .queue_id = CONF_TX_AC_BE, 3018c2ecf20Sopenharmony_ci .channel_type = CONF_CHANNEL_TYPE_EDCF, 3028c2ecf20Sopenharmony_ci .tsid = CONF_TX_AC_BE, 3038c2ecf20Sopenharmony_ci .ps_scheme = CONF_PS_SCHEME_LEGACY, 3048c2ecf20Sopenharmony_ci .ack_policy = CONF_ACK_POLICY_LEGACY, 3058c2ecf20Sopenharmony_ci .apsd_conf = {0, 0}, 3068c2ecf20Sopenharmony_ci }, 3078c2ecf20Sopenharmony_ci [CONF_TX_AC_BK] = { 3088c2ecf20Sopenharmony_ci .queue_id = CONF_TX_AC_BK, 3098c2ecf20Sopenharmony_ci .channel_type = CONF_CHANNEL_TYPE_EDCF, 3108c2ecf20Sopenharmony_ci .tsid = CONF_TX_AC_BK, 3118c2ecf20Sopenharmony_ci .ps_scheme = CONF_PS_SCHEME_LEGACY, 3128c2ecf20Sopenharmony_ci .ack_policy = CONF_ACK_POLICY_LEGACY, 3138c2ecf20Sopenharmony_ci .apsd_conf = {0, 0}, 3148c2ecf20Sopenharmony_ci }, 3158c2ecf20Sopenharmony_ci [CONF_TX_AC_VI] = { 3168c2ecf20Sopenharmony_ci .queue_id = CONF_TX_AC_VI, 3178c2ecf20Sopenharmony_ci .channel_type = CONF_CHANNEL_TYPE_EDCF, 3188c2ecf20Sopenharmony_ci .tsid = CONF_TX_AC_VI, 3198c2ecf20Sopenharmony_ci .ps_scheme = CONF_PS_SCHEME_LEGACY, 3208c2ecf20Sopenharmony_ci .ack_policy = CONF_ACK_POLICY_LEGACY, 3218c2ecf20Sopenharmony_ci .apsd_conf = {0, 0}, 3228c2ecf20Sopenharmony_ci }, 3238c2ecf20Sopenharmony_ci [CONF_TX_AC_VO] = { 3248c2ecf20Sopenharmony_ci .queue_id = CONF_TX_AC_VO, 3258c2ecf20Sopenharmony_ci .channel_type = CONF_CHANNEL_TYPE_EDCF, 3268c2ecf20Sopenharmony_ci .tsid = CONF_TX_AC_VO, 3278c2ecf20Sopenharmony_ci .ps_scheme = CONF_PS_SCHEME_LEGACY, 3288c2ecf20Sopenharmony_ci .ack_policy = CONF_ACK_POLICY_LEGACY, 3298c2ecf20Sopenharmony_ci .apsd_conf = {0, 0}, 3308c2ecf20Sopenharmony_ci }, 3318c2ecf20Sopenharmony_ci }, 3328c2ecf20Sopenharmony_ci .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD, 3338c2ecf20Sopenharmony_ci .tx_compl_timeout = 350, 3348c2ecf20Sopenharmony_ci .tx_compl_threshold = 10, 3358c2ecf20Sopenharmony_ci .basic_rate = CONF_HW_BIT_RATE_1MBPS, 3368c2ecf20Sopenharmony_ci .basic_rate_5 = CONF_HW_BIT_RATE_6MBPS, 3378c2ecf20Sopenharmony_ci .tmpl_short_retry_limit = 10, 3388c2ecf20Sopenharmony_ci .tmpl_long_retry_limit = 10, 3398c2ecf20Sopenharmony_ci .tx_watchdog_timeout = 5000, 3408c2ecf20Sopenharmony_ci .slow_link_thold = 3, 3418c2ecf20Sopenharmony_ci .fast_link_thold = 30, 3428c2ecf20Sopenharmony_ci }, 3438c2ecf20Sopenharmony_ci .conn = { 3448c2ecf20Sopenharmony_ci .wake_up_event = CONF_WAKE_UP_EVENT_DTIM, 3458c2ecf20Sopenharmony_ci .listen_interval = 1, 3468c2ecf20Sopenharmony_ci .suspend_wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM, 3478c2ecf20Sopenharmony_ci .suspend_listen_interval = 3, 3488c2ecf20Sopenharmony_ci .bcn_filt_mode = CONF_BCN_FILT_MODE_ENABLED, 3498c2ecf20Sopenharmony_ci .bcn_filt_ie_count = 3, 3508c2ecf20Sopenharmony_ci .bcn_filt_ie = { 3518c2ecf20Sopenharmony_ci [0] = { 3528c2ecf20Sopenharmony_ci .ie = WLAN_EID_CHANNEL_SWITCH, 3538c2ecf20Sopenharmony_ci .rule = CONF_BCN_RULE_PASS_ON_APPEARANCE, 3548c2ecf20Sopenharmony_ci }, 3558c2ecf20Sopenharmony_ci [1] = { 3568c2ecf20Sopenharmony_ci .ie = WLAN_EID_HT_OPERATION, 3578c2ecf20Sopenharmony_ci .rule = CONF_BCN_RULE_PASS_ON_CHANGE, 3588c2ecf20Sopenharmony_ci }, 3598c2ecf20Sopenharmony_ci [2] = { 3608c2ecf20Sopenharmony_ci .ie = WLAN_EID_ERP_INFO, 3618c2ecf20Sopenharmony_ci .rule = CONF_BCN_RULE_PASS_ON_CHANGE, 3628c2ecf20Sopenharmony_ci }, 3638c2ecf20Sopenharmony_ci }, 3648c2ecf20Sopenharmony_ci .synch_fail_thold = 12, 3658c2ecf20Sopenharmony_ci .bss_lose_timeout = 400, 3668c2ecf20Sopenharmony_ci .beacon_rx_timeout = 10000, 3678c2ecf20Sopenharmony_ci .broadcast_timeout = 20000, 3688c2ecf20Sopenharmony_ci .rx_broadcast_in_ps = 1, 3698c2ecf20Sopenharmony_ci .ps_poll_threshold = 10, 3708c2ecf20Sopenharmony_ci .bet_enable = CONF_BET_MODE_ENABLE, 3718c2ecf20Sopenharmony_ci .bet_max_consecutive = 50, 3728c2ecf20Sopenharmony_ci .psm_entry_retries = 8, 3738c2ecf20Sopenharmony_ci .psm_exit_retries = 16, 3748c2ecf20Sopenharmony_ci .psm_entry_nullfunc_retries = 3, 3758c2ecf20Sopenharmony_ci .dynamic_ps_timeout = 1500, 3768c2ecf20Sopenharmony_ci .forced_ps = false, 3778c2ecf20Sopenharmony_ci .keep_alive_interval = 55000, 3788c2ecf20Sopenharmony_ci .max_listen_interval = 20, 3798c2ecf20Sopenharmony_ci .sta_sleep_auth = WL1271_PSM_ILLEGAL, 3808c2ecf20Sopenharmony_ci .suspend_rx_ba_activity = 0, 3818c2ecf20Sopenharmony_ci }, 3828c2ecf20Sopenharmony_ci .itrim = { 3838c2ecf20Sopenharmony_ci .enable = false, 3848c2ecf20Sopenharmony_ci .timeout = 50000, 3858c2ecf20Sopenharmony_ci }, 3868c2ecf20Sopenharmony_ci .pm_config = { 3878c2ecf20Sopenharmony_ci .host_clk_settling_time = 5000, 3888c2ecf20Sopenharmony_ci .host_fast_wakeup_support = CONF_FAST_WAKEUP_DISABLE, 3898c2ecf20Sopenharmony_ci }, 3908c2ecf20Sopenharmony_ci .roam_trigger = { 3918c2ecf20Sopenharmony_ci .trigger_pacing = 1, 3928c2ecf20Sopenharmony_ci .avg_weight_rssi_beacon = 20, 3938c2ecf20Sopenharmony_ci .avg_weight_rssi_data = 10, 3948c2ecf20Sopenharmony_ci .avg_weight_snr_beacon = 20, 3958c2ecf20Sopenharmony_ci .avg_weight_snr_data = 10, 3968c2ecf20Sopenharmony_ci }, 3978c2ecf20Sopenharmony_ci .scan = { 3988c2ecf20Sopenharmony_ci .min_dwell_time_active = 7500, 3998c2ecf20Sopenharmony_ci .max_dwell_time_active = 30000, 4008c2ecf20Sopenharmony_ci .min_dwell_time_active_long = 25000, 4018c2ecf20Sopenharmony_ci .max_dwell_time_active_long = 50000, 4028c2ecf20Sopenharmony_ci .dwell_time_passive = 100000, 4038c2ecf20Sopenharmony_ci .dwell_time_dfs = 150000, 4048c2ecf20Sopenharmony_ci .num_probe_reqs = 2, 4058c2ecf20Sopenharmony_ci .split_scan_timeout = 50000, 4068c2ecf20Sopenharmony_ci }, 4078c2ecf20Sopenharmony_ci .sched_scan = { 4088c2ecf20Sopenharmony_ci /* 4098c2ecf20Sopenharmony_ci * Values are in TU/1000 but since sched scan FW command 4108c2ecf20Sopenharmony_ci * params are in TUs rounding up may occur. 4118c2ecf20Sopenharmony_ci */ 4128c2ecf20Sopenharmony_ci .base_dwell_time = 7500, 4138c2ecf20Sopenharmony_ci .max_dwell_time_delta = 22500, 4148c2ecf20Sopenharmony_ci /* based on 250bits per probe @1Mbps */ 4158c2ecf20Sopenharmony_ci .dwell_time_delta_per_probe = 2000, 4168c2ecf20Sopenharmony_ci /* based on 250bits per probe @6Mbps (plus a bit more) */ 4178c2ecf20Sopenharmony_ci .dwell_time_delta_per_probe_5 = 350, 4188c2ecf20Sopenharmony_ci .dwell_time_passive = 100000, 4198c2ecf20Sopenharmony_ci .dwell_time_dfs = 150000, 4208c2ecf20Sopenharmony_ci .num_probe_reqs = 2, 4218c2ecf20Sopenharmony_ci .rssi_threshold = -90, 4228c2ecf20Sopenharmony_ci .snr_threshold = 0, 4238c2ecf20Sopenharmony_ci .num_short_intervals = SCAN_MAX_SHORT_INTERVALS, 4248c2ecf20Sopenharmony_ci .long_interval = 30000, 4258c2ecf20Sopenharmony_ci }, 4268c2ecf20Sopenharmony_ci .ht = { 4278c2ecf20Sopenharmony_ci .rx_ba_win_size = 32, 4288c2ecf20Sopenharmony_ci .tx_ba_win_size = 64, 4298c2ecf20Sopenharmony_ci .inactivity_timeout = 10000, 4308c2ecf20Sopenharmony_ci .tx_ba_tid_bitmap = CONF_TX_BA_ENABLED_TID_BITMAP, 4318c2ecf20Sopenharmony_ci }, 4328c2ecf20Sopenharmony_ci .mem = { 4338c2ecf20Sopenharmony_ci .num_stations = 1, 4348c2ecf20Sopenharmony_ci .ssid_profiles = 1, 4358c2ecf20Sopenharmony_ci .rx_block_num = 40, 4368c2ecf20Sopenharmony_ci .tx_min_block_num = 40, 4378c2ecf20Sopenharmony_ci .dynamic_memory = 1, 4388c2ecf20Sopenharmony_ci .min_req_tx_blocks = 45, 4398c2ecf20Sopenharmony_ci .min_req_rx_blocks = 22, 4408c2ecf20Sopenharmony_ci .tx_min = 27, 4418c2ecf20Sopenharmony_ci }, 4428c2ecf20Sopenharmony_ci .fm_coex = { 4438c2ecf20Sopenharmony_ci .enable = true, 4448c2ecf20Sopenharmony_ci .swallow_period = 5, 4458c2ecf20Sopenharmony_ci .n_divider_fref_set_1 = 0xff, /* default */ 4468c2ecf20Sopenharmony_ci .n_divider_fref_set_2 = 12, 4478c2ecf20Sopenharmony_ci .m_divider_fref_set_1 = 0xffff, 4488c2ecf20Sopenharmony_ci .m_divider_fref_set_2 = 148, /* default */ 4498c2ecf20Sopenharmony_ci .coex_pll_stabilization_time = 0xffffffff, /* default */ 4508c2ecf20Sopenharmony_ci .ldo_stabilization_time = 0xffff, /* default */ 4518c2ecf20Sopenharmony_ci .fm_disturbed_band_margin = 0xff, /* default */ 4528c2ecf20Sopenharmony_ci .swallow_clk_diff = 0xff, /* default */ 4538c2ecf20Sopenharmony_ci }, 4548c2ecf20Sopenharmony_ci .rx_streaming = { 4558c2ecf20Sopenharmony_ci .duration = 150, 4568c2ecf20Sopenharmony_ci .queues = 0x1, 4578c2ecf20Sopenharmony_ci .interval = 20, 4588c2ecf20Sopenharmony_ci .always = 0, 4598c2ecf20Sopenharmony_ci }, 4608c2ecf20Sopenharmony_ci .fwlog = { 4618c2ecf20Sopenharmony_ci .mode = WL12XX_FWLOG_CONTINUOUS, 4628c2ecf20Sopenharmony_ci .mem_blocks = 0, 4638c2ecf20Sopenharmony_ci .severity = 0, 4648c2ecf20Sopenharmony_ci .timestamp = WL12XX_FWLOG_TIMESTAMP_DISABLED, 4658c2ecf20Sopenharmony_ci .output = WL12XX_FWLOG_OUTPUT_DBG_PINS, 4668c2ecf20Sopenharmony_ci .threshold = 0, 4678c2ecf20Sopenharmony_ci }, 4688c2ecf20Sopenharmony_ci .rate = { 4698c2ecf20Sopenharmony_ci .rate_retry_score = 32000, 4708c2ecf20Sopenharmony_ci .per_add = 8192, 4718c2ecf20Sopenharmony_ci .per_th1 = 2048, 4728c2ecf20Sopenharmony_ci .per_th2 = 4096, 4738c2ecf20Sopenharmony_ci .max_per = 8100, 4748c2ecf20Sopenharmony_ci .inverse_curiosity_factor = 5, 4758c2ecf20Sopenharmony_ci .tx_fail_low_th = 4, 4768c2ecf20Sopenharmony_ci .tx_fail_high_th = 10, 4778c2ecf20Sopenharmony_ci .per_alpha_shift = 4, 4788c2ecf20Sopenharmony_ci .per_add_shift = 13, 4798c2ecf20Sopenharmony_ci .per_beta1_shift = 10, 4808c2ecf20Sopenharmony_ci .per_beta2_shift = 8, 4818c2ecf20Sopenharmony_ci .rate_check_up = 2, 4828c2ecf20Sopenharmony_ci .rate_check_down = 12, 4838c2ecf20Sopenharmony_ci .rate_retry_policy = { 4848c2ecf20Sopenharmony_ci 0x00, 0x00, 0x00, 0x00, 0x00, 4858c2ecf20Sopenharmony_ci 0x00, 0x00, 0x00, 0x00, 0x00, 4868c2ecf20Sopenharmony_ci 0x00, 0x00, 0x00, 4878c2ecf20Sopenharmony_ci }, 4888c2ecf20Sopenharmony_ci }, 4898c2ecf20Sopenharmony_ci .hangover = { 4908c2ecf20Sopenharmony_ci .recover_time = 0, 4918c2ecf20Sopenharmony_ci .hangover_period = 20, 4928c2ecf20Sopenharmony_ci .dynamic_mode = 1, 4938c2ecf20Sopenharmony_ci .early_termination_mode = 1, 4948c2ecf20Sopenharmony_ci .max_period = 20, 4958c2ecf20Sopenharmony_ci .min_period = 1, 4968c2ecf20Sopenharmony_ci .increase_delta = 1, 4978c2ecf20Sopenharmony_ci .decrease_delta = 2, 4988c2ecf20Sopenharmony_ci .quiet_time = 4, 4998c2ecf20Sopenharmony_ci .increase_time = 1, 5008c2ecf20Sopenharmony_ci .window_size = 16, 5018c2ecf20Sopenharmony_ci }, 5028c2ecf20Sopenharmony_ci .recovery = { 5038c2ecf20Sopenharmony_ci .bug_on_recovery = 0, 5048c2ecf20Sopenharmony_ci .no_recovery = 0, 5058c2ecf20Sopenharmony_ci }, 5068c2ecf20Sopenharmony_ci}; 5078c2ecf20Sopenharmony_ci 5088c2ecf20Sopenharmony_cistatic struct wl18xx_priv_conf wl18xx_default_priv_conf = { 5098c2ecf20Sopenharmony_ci .ht = { 5108c2ecf20Sopenharmony_ci .mode = HT_MODE_WIDE, 5118c2ecf20Sopenharmony_ci }, 5128c2ecf20Sopenharmony_ci .phy = { 5138c2ecf20Sopenharmony_ci .phy_standalone = 0x00, 5148c2ecf20Sopenharmony_ci .primary_clock_setting_time = 0x05, 5158c2ecf20Sopenharmony_ci .clock_valid_on_wake_up = 0x00, 5168c2ecf20Sopenharmony_ci .secondary_clock_setting_time = 0x05, 5178c2ecf20Sopenharmony_ci .board_type = BOARD_TYPE_HDK_18XX, 5188c2ecf20Sopenharmony_ci .auto_detect = 0x00, 5198c2ecf20Sopenharmony_ci .dedicated_fem = FEM_NONE, 5208c2ecf20Sopenharmony_ci .low_band_component = COMPONENT_3_WAY_SWITCH, 5218c2ecf20Sopenharmony_ci .low_band_component_type = 0x05, 5228c2ecf20Sopenharmony_ci .high_band_component = COMPONENT_2_WAY_SWITCH, 5238c2ecf20Sopenharmony_ci .high_band_component_type = 0x09, 5248c2ecf20Sopenharmony_ci .tcxo_ldo_voltage = 0x00, 5258c2ecf20Sopenharmony_ci .xtal_itrim_val = 0x04, 5268c2ecf20Sopenharmony_ci .srf_state = 0x00, 5278c2ecf20Sopenharmony_ci .io_configuration = 0x01, 5288c2ecf20Sopenharmony_ci .sdio_configuration = 0x00, 5298c2ecf20Sopenharmony_ci .settings = 0x00, 5308c2ecf20Sopenharmony_ci .enable_clpc = 0x00, 5318c2ecf20Sopenharmony_ci .enable_tx_low_pwr_on_siso_rdl = 0x00, 5328c2ecf20Sopenharmony_ci .rx_profile = 0x00, 5338c2ecf20Sopenharmony_ci .pwr_limit_reference_11_abg = 0x64, 5348c2ecf20Sopenharmony_ci .per_chan_pwr_limit_arr_11abg = { 5358c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5368c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5378c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5388c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5398c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5408c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5418c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5428c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5438c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5448c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5458c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5468c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5478c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5488c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5498c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5508c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5518c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, 5528c2ecf20Sopenharmony_ci .pwr_limit_reference_11p = 0x64, 5538c2ecf20Sopenharmony_ci .per_chan_bo_mode_11_abg = { 0x00, 0x00, 0x00, 0x00, 5548c2ecf20Sopenharmony_ci 0x00, 0x00, 0x00, 0x00, 5558c2ecf20Sopenharmony_ci 0x00, 0x00, 0x00, 0x00, 5568c2ecf20Sopenharmony_ci 0x00 }, 5578c2ecf20Sopenharmony_ci .per_chan_bo_mode_11_p = { 0x00, 0x00, 0x00, 0x00 }, 5588c2ecf20Sopenharmony_ci .per_chan_pwr_limit_arr_11p = { 0xff, 0xff, 0xff, 0xff, 5598c2ecf20Sopenharmony_ci 0xff, 0xff, 0xff }, 5608c2ecf20Sopenharmony_ci .psat = 0, 5618c2ecf20Sopenharmony_ci .external_pa_dc2dc = 0, 5628c2ecf20Sopenharmony_ci .number_of_assembled_ant2_4 = 2, 5638c2ecf20Sopenharmony_ci .number_of_assembled_ant5 = 1, 5648c2ecf20Sopenharmony_ci .low_power_val = 0xff, 5658c2ecf20Sopenharmony_ci .med_power_val = 0xff, 5668c2ecf20Sopenharmony_ci .high_power_val = 0xff, 5678c2ecf20Sopenharmony_ci .low_power_val_2nd = 0xff, 5688c2ecf20Sopenharmony_ci .med_power_val_2nd = 0xff, 5698c2ecf20Sopenharmony_ci .high_power_val_2nd = 0xff, 5708c2ecf20Sopenharmony_ci .tx_rf_margin = 1, 5718c2ecf20Sopenharmony_ci }, 5728c2ecf20Sopenharmony_ci .ap_sleep = { /* disabled by default */ 5738c2ecf20Sopenharmony_ci .idle_duty_cycle = 0, 5748c2ecf20Sopenharmony_ci .connected_duty_cycle = 0, 5758c2ecf20Sopenharmony_ci .max_stations_thresh = 0, 5768c2ecf20Sopenharmony_ci .idle_conn_thresh = 0, 5778c2ecf20Sopenharmony_ci }, 5788c2ecf20Sopenharmony_ci}; 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_cistatic const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = { 5818c2ecf20Sopenharmony_ci [PART_TOP_PRCM_ELP_SOC] = { 5828c2ecf20Sopenharmony_ci .mem = { .start = 0x00A00000, .size = 0x00012000 }, 5838c2ecf20Sopenharmony_ci .reg = { .start = 0x00807000, .size = 0x00005000 }, 5848c2ecf20Sopenharmony_ci .mem2 = { .start = 0x00800000, .size = 0x0000B000 }, 5858c2ecf20Sopenharmony_ci .mem3 = { .start = 0x00401594, .size = 0x00001020 }, 5868c2ecf20Sopenharmony_ci }, 5878c2ecf20Sopenharmony_ci [PART_DOWN] = { 5888c2ecf20Sopenharmony_ci .mem = { .start = 0x00000000, .size = 0x00014000 }, 5898c2ecf20Sopenharmony_ci .reg = { .start = 0x00810000, .size = 0x0000BFFF }, 5908c2ecf20Sopenharmony_ci .mem2 = { .start = 0x00000000, .size = 0x00000000 }, 5918c2ecf20Sopenharmony_ci .mem3 = { .start = 0x00000000, .size = 0x00000000 }, 5928c2ecf20Sopenharmony_ci }, 5938c2ecf20Sopenharmony_ci [PART_BOOT] = { 5948c2ecf20Sopenharmony_ci .mem = { .start = 0x00700000, .size = 0x0000030c }, 5958c2ecf20Sopenharmony_ci .reg = { .start = 0x00802000, .size = 0x00014578 }, 5968c2ecf20Sopenharmony_ci .mem2 = { .start = 0x00B00404, .size = 0x00001000 }, 5978c2ecf20Sopenharmony_ci .mem3 = { .start = 0x00C00000, .size = 0x00000400 }, 5988c2ecf20Sopenharmony_ci }, 5998c2ecf20Sopenharmony_ci [PART_WORK] = { 6008c2ecf20Sopenharmony_ci .mem = { .start = 0x00800000, .size = 0x000050FC }, 6018c2ecf20Sopenharmony_ci .reg = { .start = 0x00B00404, .size = 0x00001000 }, 6028c2ecf20Sopenharmony_ci .mem2 = { .start = 0x00C00000, .size = 0x00000400 }, 6038c2ecf20Sopenharmony_ci .mem3 = { .start = 0x00401594, .size = 0x00001020 }, 6048c2ecf20Sopenharmony_ci }, 6058c2ecf20Sopenharmony_ci [PART_PHY_INIT] = { 6068c2ecf20Sopenharmony_ci .mem = { .start = WL18XX_PHY_INIT_MEM_ADDR, 6078c2ecf20Sopenharmony_ci .size = WL18XX_PHY_INIT_MEM_SIZE }, 6088c2ecf20Sopenharmony_ci .reg = { .start = 0x00000000, .size = 0x00000000 }, 6098c2ecf20Sopenharmony_ci .mem2 = { .start = 0x00000000, .size = 0x00000000 }, 6108c2ecf20Sopenharmony_ci .mem3 = { .start = 0x00000000, .size = 0x00000000 }, 6118c2ecf20Sopenharmony_ci }, 6128c2ecf20Sopenharmony_ci}; 6138c2ecf20Sopenharmony_ci 6148c2ecf20Sopenharmony_cistatic const int wl18xx_rtable[REG_TABLE_LEN] = { 6158c2ecf20Sopenharmony_ci [REG_ECPU_CONTROL] = WL18XX_REG_ECPU_CONTROL, 6168c2ecf20Sopenharmony_ci [REG_INTERRUPT_NO_CLEAR] = WL18XX_REG_INTERRUPT_NO_CLEAR, 6178c2ecf20Sopenharmony_ci [REG_INTERRUPT_ACK] = WL18XX_REG_INTERRUPT_ACK, 6188c2ecf20Sopenharmony_ci [REG_COMMAND_MAILBOX_PTR] = WL18XX_REG_COMMAND_MAILBOX_PTR, 6198c2ecf20Sopenharmony_ci [REG_EVENT_MAILBOX_PTR] = WL18XX_REG_EVENT_MAILBOX_PTR, 6208c2ecf20Sopenharmony_ci [REG_INTERRUPT_TRIG] = WL18XX_REG_INTERRUPT_TRIG_H, 6218c2ecf20Sopenharmony_ci [REG_INTERRUPT_MASK] = WL18XX_REG_INTERRUPT_MASK, 6228c2ecf20Sopenharmony_ci [REG_PC_ON_RECOVERY] = WL18XX_SCR_PAD4, 6238c2ecf20Sopenharmony_ci [REG_CHIP_ID_B] = WL18XX_REG_CHIP_ID_B, 6248c2ecf20Sopenharmony_ci [REG_CMD_MBOX_ADDRESS] = WL18XX_CMD_MBOX_ADDRESS, 6258c2ecf20Sopenharmony_ci 6268c2ecf20Sopenharmony_ci /* data access memory addresses, used with partition translation */ 6278c2ecf20Sopenharmony_ci [REG_SLV_MEM_DATA] = WL18XX_SLV_MEM_DATA, 6288c2ecf20Sopenharmony_ci [REG_SLV_REG_DATA] = WL18XX_SLV_REG_DATA, 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_ci /* raw data access memory addresses */ 6318c2ecf20Sopenharmony_ci [REG_RAW_FW_STATUS_ADDR] = WL18XX_FW_STATUS_ADDR, 6328c2ecf20Sopenharmony_ci}; 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_cistatic const struct wl18xx_clk_cfg wl18xx_clk_table_coex[NUM_CLOCK_CONFIGS] = { 6358c2ecf20Sopenharmony_ci [CLOCK_CONFIG_16_2_M] = { 8, 121, 0, 0, false }, 6368c2ecf20Sopenharmony_ci [CLOCK_CONFIG_16_368_M] = { 8, 120, 0, 0, false }, 6378c2ecf20Sopenharmony_ci [CLOCK_CONFIG_16_8_M] = { 8, 117, 0, 0, false }, 6388c2ecf20Sopenharmony_ci [CLOCK_CONFIG_19_2_M] = { 10, 128, 0, 0, false }, 6398c2ecf20Sopenharmony_ci [CLOCK_CONFIG_26_M] = { 11, 104, 0, 0, false }, 6408c2ecf20Sopenharmony_ci [CLOCK_CONFIG_32_736_M] = { 8, 120, 0, 0, false }, 6418c2ecf20Sopenharmony_ci [CLOCK_CONFIG_33_6_M] = { 8, 117, 0, 0, false }, 6428c2ecf20Sopenharmony_ci [CLOCK_CONFIG_38_468_M] = { 10, 128, 0, 0, false }, 6438c2ecf20Sopenharmony_ci [CLOCK_CONFIG_52_M] = { 11, 104, 0, 0, false }, 6448c2ecf20Sopenharmony_ci}; 6458c2ecf20Sopenharmony_ci 6468c2ecf20Sopenharmony_cistatic const struct wl18xx_clk_cfg wl18xx_clk_table[NUM_CLOCK_CONFIGS] = { 6478c2ecf20Sopenharmony_ci [CLOCK_CONFIG_16_2_M] = { 7, 104, 801, 4, true }, 6488c2ecf20Sopenharmony_ci [CLOCK_CONFIG_16_368_M] = { 9, 132, 3751, 4, true }, 6498c2ecf20Sopenharmony_ci [CLOCK_CONFIG_16_8_M] = { 7, 100, 0, 0, false }, 6508c2ecf20Sopenharmony_ci [CLOCK_CONFIG_19_2_M] = { 8, 100, 0, 0, false }, 6518c2ecf20Sopenharmony_ci [CLOCK_CONFIG_26_M] = { 13, 120, 0, 0, false }, 6528c2ecf20Sopenharmony_ci [CLOCK_CONFIG_32_736_M] = { 9, 132, 3751, 4, true }, 6538c2ecf20Sopenharmony_ci [CLOCK_CONFIG_33_6_M] = { 7, 100, 0, 0, false }, 6548c2ecf20Sopenharmony_ci [CLOCK_CONFIG_38_468_M] = { 8, 100, 0, 0, false }, 6558c2ecf20Sopenharmony_ci [CLOCK_CONFIG_52_M] = { 13, 120, 0, 0, false }, 6568c2ecf20Sopenharmony_ci}; 6578c2ecf20Sopenharmony_ci 6588c2ecf20Sopenharmony_ci/* TODO: maybe move to a new header file? */ 6598c2ecf20Sopenharmony_ci#define WL18XX_FW_NAME "ti-connectivity/wl18xx-fw-4.bin" 6608c2ecf20Sopenharmony_ci 6618c2ecf20Sopenharmony_cistatic int wl18xx_identify_chip(struct wl1271 *wl) 6628c2ecf20Sopenharmony_ci{ 6638c2ecf20Sopenharmony_ci int ret = 0; 6648c2ecf20Sopenharmony_ci 6658c2ecf20Sopenharmony_ci switch (wl->chip.id) { 6668c2ecf20Sopenharmony_ci case CHIP_ID_185x_PG20: 6678c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_BOOT, "chip id 0x%x (185x PG20)", 6688c2ecf20Sopenharmony_ci wl->chip.id); 6698c2ecf20Sopenharmony_ci wl->sr_fw_name = WL18XX_FW_NAME; 6708c2ecf20Sopenharmony_ci /* wl18xx uses the same firmware for PLT */ 6718c2ecf20Sopenharmony_ci wl->plt_fw_name = WL18XX_FW_NAME; 6728c2ecf20Sopenharmony_ci wl->quirks |= WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN | 6738c2ecf20Sopenharmony_ci WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN | 6748c2ecf20Sopenharmony_ci WLCORE_QUIRK_NO_SCHED_SCAN_WHILE_CONN | 6758c2ecf20Sopenharmony_ci WLCORE_QUIRK_TX_PAD_LAST_FRAME | 6768c2ecf20Sopenharmony_ci WLCORE_QUIRK_REGDOMAIN_CONF | 6778c2ecf20Sopenharmony_ci WLCORE_QUIRK_DUAL_PROBE_TMPL; 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_ci wlcore_set_min_fw_ver(wl, WL18XX_CHIP_VER, 6808c2ecf20Sopenharmony_ci WL18XX_IFTYPE_VER, WL18XX_MAJOR_VER, 6818c2ecf20Sopenharmony_ci WL18XX_SUBTYPE_VER, WL18XX_MINOR_VER, 6828c2ecf20Sopenharmony_ci /* there's no separate multi-role FW */ 6838c2ecf20Sopenharmony_ci 0, 0, 0, 0); 6848c2ecf20Sopenharmony_ci break; 6858c2ecf20Sopenharmony_ci case CHIP_ID_185x_PG10: 6868c2ecf20Sopenharmony_ci wl1271_warning("chip id 0x%x (185x PG10) is deprecated", 6878c2ecf20Sopenharmony_ci wl->chip.id); 6888c2ecf20Sopenharmony_ci ret = -ENODEV; 6898c2ecf20Sopenharmony_ci goto out; 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_ci default: 6928c2ecf20Sopenharmony_ci wl1271_warning("unsupported chip id: 0x%x", wl->chip.id); 6938c2ecf20Sopenharmony_ci ret = -ENODEV; 6948c2ecf20Sopenharmony_ci goto out; 6958c2ecf20Sopenharmony_ci } 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_ci wl->fw_mem_block_size = 272; 6988c2ecf20Sopenharmony_ci wl->fwlog_end = 0x40000000; 6998c2ecf20Sopenharmony_ci 7008c2ecf20Sopenharmony_ci wl->scan_templ_id_2_4 = CMD_TEMPL_CFG_PROBE_REQ_2_4; 7018c2ecf20Sopenharmony_ci wl->scan_templ_id_5 = CMD_TEMPL_CFG_PROBE_REQ_5; 7028c2ecf20Sopenharmony_ci wl->sched_scan_templ_id_2_4 = CMD_TEMPL_PROBE_REQ_2_4_PERIODIC; 7038c2ecf20Sopenharmony_ci wl->sched_scan_templ_id_5 = CMD_TEMPL_PROBE_REQ_5_PERIODIC; 7048c2ecf20Sopenharmony_ci wl->max_channels_5 = WL18XX_MAX_CHANNELS_5GHZ; 7058c2ecf20Sopenharmony_ci wl->ba_rx_session_count_max = WL18XX_RX_BA_MAX_SESSIONS; 7068c2ecf20Sopenharmony_ciout: 7078c2ecf20Sopenharmony_ci return ret; 7088c2ecf20Sopenharmony_ci} 7098c2ecf20Sopenharmony_ci 7108c2ecf20Sopenharmony_cistatic int wl18xx_set_clk(struct wl1271 *wl) 7118c2ecf20Sopenharmony_ci{ 7128c2ecf20Sopenharmony_ci u16 clk_freq; 7138c2ecf20Sopenharmony_ci int ret; 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); 7168c2ecf20Sopenharmony_ci if (ret < 0) 7178c2ecf20Sopenharmony_ci goto out; 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_ci /* TODO: PG2: apparently we need to read the clk type */ 7208c2ecf20Sopenharmony_ci 7218c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_read(wl, PRIMARY_CLK_DETECT, &clk_freq); 7228c2ecf20Sopenharmony_ci if (ret < 0) 7238c2ecf20Sopenharmony_ci goto out; 7248c2ecf20Sopenharmony_ci 7258c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_BOOT, "clock freq %d (%d, %d, %d, %d, %s)", clk_freq, 7268c2ecf20Sopenharmony_ci wl18xx_clk_table[clk_freq].n, wl18xx_clk_table[clk_freq].m, 7278c2ecf20Sopenharmony_ci wl18xx_clk_table[clk_freq].p, wl18xx_clk_table[clk_freq].q, 7288c2ecf20Sopenharmony_ci wl18xx_clk_table[clk_freq].swallow ? "swallow" : "spit"); 7298c2ecf20Sopenharmony_ci 7308c2ecf20Sopenharmony_ci /* coex PLL configuration */ 7318c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_COEX_PLL_N, 7328c2ecf20Sopenharmony_ci wl18xx_clk_table_coex[clk_freq].n); 7338c2ecf20Sopenharmony_ci if (ret < 0) 7348c2ecf20Sopenharmony_ci goto out; 7358c2ecf20Sopenharmony_ci 7368c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_COEX_PLL_M, 7378c2ecf20Sopenharmony_ci wl18xx_clk_table_coex[clk_freq].m); 7388c2ecf20Sopenharmony_ci if (ret < 0) 7398c2ecf20Sopenharmony_ci goto out; 7408c2ecf20Sopenharmony_ci 7418c2ecf20Sopenharmony_ci /* bypass the swallowing logic */ 7428c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_COEX_PLL_SWALLOW_EN, 7438c2ecf20Sopenharmony_ci PLLSH_COEX_PLL_SWALLOW_EN_VAL1); 7448c2ecf20Sopenharmony_ci if (ret < 0) 7458c2ecf20Sopenharmony_ci goto out; 7468c2ecf20Sopenharmony_ci 7478c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_N, 7488c2ecf20Sopenharmony_ci wl18xx_clk_table[clk_freq].n); 7498c2ecf20Sopenharmony_ci if (ret < 0) 7508c2ecf20Sopenharmony_ci goto out; 7518c2ecf20Sopenharmony_ci 7528c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_M, 7538c2ecf20Sopenharmony_ci wl18xx_clk_table[clk_freq].m); 7548c2ecf20Sopenharmony_ci if (ret < 0) 7558c2ecf20Sopenharmony_ci goto out; 7568c2ecf20Sopenharmony_ci 7578c2ecf20Sopenharmony_ci if (wl18xx_clk_table[clk_freq].swallow) { 7588c2ecf20Sopenharmony_ci /* first the 16 lower bits */ 7598c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_1, 7608c2ecf20Sopenharmony_ci wl18xx_clk_table[clk_freq].q & 7618c2ecf20Sopenharmony_ci PLLSH_WCS_PLL_Q_FACTOR_CFG_1_MASK); 7628c2ecf20Sopenharmony_ci if (ret < 0) 7638c2ecf20Sopenharmony_ci goto out; 7648c2ecf20Sopenharmony_ci 7658c2ecf20Sopenharmony_ci /* then the 16 higher bits, masked out */ 7668c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_2, 7678c2ecf20Sopenharmony_ci (wl18xx_clk_table[clk_freq].q >> 16) & 7688c2ecf20Sopenharmony_ci PLLSH_WCS_PLL_Q_FACTOR_CFG_2_MASK); 7698c2ecf20Sopenharmony_ci if (ret < 0) 7708c2ecf20Sopenharmony_ci goto out; 7718c2ecf20Sopenharmony_ci 7728c2ecf20Sopenharmony_ci /* first the 16 lower bits */ 7738c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_1, 7748c2ecf20Sopenharmony_ci wl18xx_clk_table[clk_freq].p & 7758c2ecf20Sopenharmony_ci PLLSH_WCS_PLL_P_FACTOR_CFG_1_MASK); 7768c2ecf20Sopenharmony_ci if (ret < 0) 7778c2ecf20Sopenharmony_ci goto out; 7788c2ecf20Sopenharmony_ci 7798c2ecf20Sopenharmony_ci /* then the 16 higher bits, masked out */ 7808c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_2, 7818c2ecf20Sopenharmony_ci (wl18xx_clk_table[clk_freq].p >> 16) & 7828c2ecf20Sopenharmony_ci PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK); 7838c2ecf20Sopenharmony_ci if (ret < 0) 7848c2ecf20Sopenharmony_ci goto out; 7858c2ecf20Sopenharmony_ci } else { 7868c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_SWALLOW_EN, 7878c2ecf20Sopenharmony_ci PLLSH_WCS_PLL_SWALLOW_EN_VAL2); 7888c2ecf20Sopenharmony_ci if (ret < 0) 7898c2ecf20Sopenharmony_ci goto out; 7908c2ecf20Sopenharmony_ci } 7918c2ecf20Sopenharmony_ci 7928c2ecf20Sopenharmony_ci /* choose WCS PLL */ 7938c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WL_PLL_SEL, 7948c2ecf20Sopenharmony_ci PLLSH_WL_PLL_SEL_WCS_PLL); 7958c2ecf20Sopenharmony_ci if (ret < 0) 7968c2ecf20Sopenharmony_ci goto out; 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_ci /* enable both PLLs */ 7998c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WL_PLL_EN, PLLSH_WL_PLL_EN_VAL1); 8008c2ecf20Sopenharmony_ci if (ret < 0) 8018c2ecf20Sopenharmony_ci goto out; 8028c2ecf20Sopenharmony_ci 8038c2ecf20Sopenharmony_ci udelay(1000); 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_ci /* disable coex PLL */ 8068c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_WL_PLL_EN, PLLSH_WL_PLL_EN_VAL2); 8078c2ecf20Sopenharmony_ci if (ret < 0) 8088c2ecf20Sopenharmony_ci goto out; 8098c2ecf20Sopenharmony_ci 8108c2ecf20Sopenharmony_ci /* reset the swallowing logic */ 8118c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, PLLSH_COEX_PLL_SWALLOW_EN, 8128c2ecf20Sopenharmony_ci PLLSH_COEX_PLL_SWALLOW_EN_VAL2); 8138c2ecf20Sopenharmony_ci 8148c2ecf20Sopenharmony_ciout: 8158c2ecf20Sopenharmony_ci return ret; 8168c2ecf20Sopenharmony_ci} 8178c2ecf20Sopenharmony_ci 8188c2ecf20Sopenharmony_cistatic int wl18xx_boot_soft_reset(struct wl1271 *wl) 8198c2ecf20Sopenharmony_ci{ 8208c2ecf20Sopenharmony_ci int ret; 8218c2ecf20Sopenharmony_ci 8228c2ecf20Sopenharmony_ci /* disable Rx/Tx */ 8238c2ecf20Sopenharmony_ci ret = wlcore_write32(wl, WL18XX_ENABLE, 0x0); 8248c2ecf20Sopenharmony_ci if (ret < 0) 8258c2ecf20Sopenharmony_ci goto out; 8268c2ecf20Sopenharmony_ci 8278c2ecf20Sopenharmony_ci /* disable auto calibration on start*/ 8288c2ecf20Sopenharmony_ci ret = wlcore_write32(wl, WL18XX_SPARE_A2, 0xffff); 8298c2ecf20Sopenharmony_ci 8308c2ecf20Sopenharmony_ciout: 8318c2ecf20Sopenharmony_ci return ret; 8328c2ecf20Sopenharmony_ci} 8338c2ecf20Sopenharmony_ci 8348c2ecf20Sopenharmony_cistatic int wl18xx_pre_boot(struct wl1271 *wl) 8358c2ecf20Sopenharmony_ci{ 8368c2ecf20Sopenharmony_ci int ret; 8378c2ecf20Sopenharmony_ci 8388c2ecf20Sopenharmony_ci ret = wl18xx_set_clk(wl); 8398c2ecf20Sopenharmony_ci if (ret < 0) 8408c2ecf20Sopenharmony_ci goto out; 8418c2ecf20Sopenharmony_ci 8428c2ecf20Sopenharmony_ci /* Continue the ELP wake up sequence */ 8438c2ecf20Sopenharmony_ci ret = wlcore_write32(wl, WL18XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); 8448c2ecf20Sopenharmony_ci if (ret < 0) 8458c2ecf20Sopenharmony_ci goto out; 8468c2ecf20Sopenharmony_ci 8478c2ecf20Sopenharmony_ci udelay(500); 8488c2ecf20Sopenharmony_ci 8498c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); 8508c2ecf20Sopenharmony_ci if (ret < 0) 8518c2ecf20Sopenharmony_ci goto out; 8528c2ecf20Sopenharmony_ci 8538c2ecf20Sopenharmony_ci /* Disable interrupts */ 8548c2ecf20Sopenharmony_ci ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); 8558c2ecf20Sopenharmony_ci if (ret < 0) 8568c2ecf20Sopenharmony_ci goto out; 8578c2ecf20Sopenharmony_ci 8588c2ecf20Sopenharmony_ci ret = wl18xx_boot_soft_reset(wl); 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_ciout: 8618c2ecf20Sopenharmony_ci return ret; 8628c2ecf20Sopenharmony_ci} 8638c2ecf20Sopenharmony_ci 8648c2ecf20Sopenharmony_cistatic int wl18xx_pre_upload(struct wl1271 *wl) 8658c2ecf20Sopenharmony_ci{ 8668c2ecf20Sopenharmony_ci u32 tmp; 8678c2ecf20Sopenharmony_ci int ret; 8688c2ecf20Sopenharmony_ci u16 irq_invert; 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_ci BUILD_BUG_ON(sizeof(struct wl18xx_mac_and_phy_params) > 8718c2ecf20Sopenharmony_ci WL18XX_PHY_INIT_MEM_SIZE); 8728c2ecf20Sopenharmony_ci 8738c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); 8748c2ecf20Sopenharmony_ci if (ret < 0) 8758c2ecf20Sopenharmony_ci goto out; 8768c2ecf20Sopenharmony_ci 8778c2ecf20Sopenharmony_ci /* TODO: check if this is all needed */ 8788c2ecf20Sopenharmony_ci ret = wlcore_write32(wl, WL18XX_EEPROMLESS_IND, WL18XX_EEPROMLESS_IND); 8798c2ecf20Sopenharmony_ci if (ret < 0) 8808c2ecf20Sopenharmony_ci goto out; 8818c2ecf20Sopenharmony_ci 8828c2ecf20Sopenharmony_ci ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &tmp); 8838c2ecf20Sopenharmony_ci if (ret < 0) 8848c2ecf20Sopenharmony_ci goto out; 8858c2ecf20Sopenharmony_ci 8868c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); 8878c2ecf20Sopenharmony_ci 8888c2ecf20Sopenharmony_ci ret = wlcore_read32(wl, WL18XX_SCR_PAD2, &tmp); 8898c2ecf20Sopenharmony_ci if (ret < 0) 8908c2ecf20Sopenharmony_ci goto out; 8918c2ecf20Sopenharmony_ci 8928c2ecf20Sopenharmony_ci /* 8938c2ecf20Sopenharmony_ci * Workaround for FDSP code RAM corruption (needed for PG2.1 8948c2ecf20Sopenharmony_ci * and newer; for older chips it's a NOP). Change FDSP clock 8958c2ecf20Sopenharmony_ci * settings so that it's muxed to the ATGP clock instead of 8968c2ecf20Sopenharmony_ci * its own clock. 8978c2ecf20Sopenharmony_ci */ 8988c2ecf20Sopenharmony_ci 8998c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); 9008c2ecf20Sopenharmony_ci if (ret < 0) 9018c2ecf20Sopenharmony_ci goto out; 9028c2ecf20Sopenharmony_ci 9038c2ecf20Sopenharmony_ci /* disable FDSP clock */ 9048c2ecf20Sopenharmony_ci ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, 9058c2ecf20Sopenharmony_ci MEM_FDSP_CLK_120_DISABLE); 9068c2ecf20Sopenharmony_ci if (ret < 0) 9078c2ecf20Sopenharmony_ci goto out; 9088c2ecf20Sopenharmony_ci 9098c2ecf20Sopenharmony_ci /* set ATPG clock toward FDSP Code RAM rather than its own clock */ 9108c2ecf20Sopenharmony_ci ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, 9118c2ecf20Sopenharmony_ci MEM_FDSP_CODERAM_FUNC_CLK_SEL); 9128c2ecf20Sopenharmony_ci if (ret < 0) 9138c2ecf20Sopenharmony_ci goto out; 9148c2ecf20Sopenharmony_ci 9158c2ecf20Sopenharmony_ci /* re-enable FDSP clock */ 9168c2ecf20Sopenharmony_ci ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, 9178c2ecf20Sopenharmony_ci MEM_FDSP_CLK_120_ENABLE); 9188c2ecf20Sopenharmony_ci if (ret < 0) 9198c2ecf20Sopenharmony_ci goto out; 9208c2ecf20Sopenharmony_ci 9218c2ecf20Sopenharmony_ci ret = irq_get_trigger_type(wl->irq); 9228c2ecf20Sopenharmony_ci if ((ret == IRQ_TYPE_LEVEL_LOW) || (ret == IRQ_TYPE_EDGE_FALLING)) { 9238c2ecf20Sopenharmony_ci wl1271_info("using inverted interrupt logic: %d", ret); 9248c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, 9258c2ecf20Sopenharmony_ci &wl->ptable[PART_TOP_PRCM_ELP_SOC]); 9268c2ecf20Sopenharmony_ci if (ret < 0) 9278c2ecf20Sopenharmony_ci goto out; 9288c2ecf20Sopenharmony_ci 9298c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_read(wl, TOP_FN0_CCCR_REG_32, &irq_invert); 9308c2ecf20Sopenharmony_ci if (ret < 0) 9318c2ecf20Sopenharmony_ci goto out; 9328c2ecf20Sopenharmony_ci 9338c2ecf20Sopenharmony_ci irq_invert |= BIT(1); 9348c2ecf20Sopenharmony_ci ret = wl18xx_top_reg_write(wl, TOP_FN0_CCCR_REG_32, irq_invert); 9358c2ecf20Sopenharmony_ci if (ret < 0) 9368c2ecf20Sopenharmony_ci goto out; 9378c2ecf20Sopenharmony_ci 9388c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); 9398c2ecf20Sopenharmony_ci } 9408c2ecf20Sopenharmony_ci 9418c2ecf20Sopenharmony_ciout: 9428c2ecf20Sopenharmony_ci return ret; 9438c2ecf20Sopenharmony_ci} 9448c2ecf20Sopenharmony_ci 9458c2ecf20Sopenharmony_cistatic int wl18xx_set_mac_and_phy(struct wl1271 *wl) 9468c2ecf20Sopenharmony_ci{ 9478c2ecf20Sopenharmony_ci struct wl18xx_priv *priv = wl->priv; 9488c2ecf20Sopenharmony_ci struct wl18xx_mac_and_phy_params *params; 9498c2ecf20Sopenharmony_ci int ret; 9508c2ecf20Sopenharmony_ci 9518c2ecf20Sopenharmony_ci params = kmemdup(&priv->conf.phy, sizeof(*params), GFP_KERNEL); 9528c2ecf20Sopenharmony_ci if (!params) { 9538c2ecf20Sopenharmony_ci ret = -ENOMEM; 9548c2ecf20Sopenharmony_ci goto out; 9558c2ecf20Sopenharmony_ci } 9568c2ecf20Sopenharmony_ci 9578c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); 9588c2ecf20Sopenharmony_ci if (ret < 0) 9598c2ecf20Sopenharmony_ci goto out; 9608c2ecf20Sopenharmony_ci 9618c2ecf20Sopenharmony_ci ret = wlcore_write(wl, WL18XX_PHY_INIT_MEM_ADDR, params, 9628c2ecf20Sopenharmony_ci sizeof(*params), false); 9638c2ecf20Sopenharmony_ci 9648c2ecf20Sopenharmony_ciout: 9658c2ecf20Sopenharmony_ci kfree(params); 9668c2ecf20Sopenharmony_ci return ret; 9678c2ecf20Sopenharmony_ci} 9688c2ecf20Sopenharmony_ci 9698c2ecf20Sopenharmony_cistatic int wl18xx_enable_interrupts(struct wl1271 *wl) 9708c2ecf20Sopenharmony_ci{ 9718c2ecf20Sopenharmony_ci u32 event_mask, intr_mask; 9728c2ecf20Sopenharmony_ci int ret; 9738c2ecf20Sopenharmony_ci 9748c2ecf20Sopenharmony_ci event_mask = WL18XX_ACX_EVENTS_VECTOR; 9758c2ecf20Sopenharmony_ci intr_mask = WL18XX_INTR_MASK; 9768c2ecf20Sopenharmony_ci 9778c2ecf20Sopenharmony_ci ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, event_mask); 9788c2ecf20Sopenharmony_ci if (ret < 0) 9798c2ecf20Sopenharmony_ci goto out; 9808c2ecf20Sopenharmony_ci 9818c2ecf20Sopenharmony_ci wlcore_enable_interrupts(wl); 9828c2ecf20Sopenharmony_ci 9838c2ecf20Sopenharmony_ci ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, 9848c2ecf20Sopenharmony_ci WL1271_ACX_INTR_ALL & ~intr_mask); 9858c2ecf20Sopenharmony_ci if (ret < 0) 9868c2ecf20Sopenharmony_ci goto disable_interrupts; 9878c2ecf20Sopenharmony_ci 9888c2ecf20Sopenharmony_ci return ret; 9898c2ecf20Sopenharmony_ci 9908c2ecf20Sopenharmony_cidisable_interrupts: 9918c2ecf20Sopenharmony_ci wlcore_disable_interrupts(wl); 9928c2ecf20Sopenharmony_ci 9938c2ecf20Sopenharmony_ciout: 9948c2ecf20Sopenharmony_ci return ret; 9958c2ecf20Sopenharmony_ci} 9968c2ecf20Sopenharmony_ci 9978c2ecf20Sopenharmony_cistatic int wl18xx_boot(struct wl1271 *wl) 9988c2ecf20Sopenharmony_ci{ 9998c2ecf20Sopenharmony_ci int ret; 10008c2ecf20Sopenharmony_ci 10018c2ecf20Sopenharmony_ci ret = wl18xx_pre_boot(wl); 10028c2ecf20Sopenharmony_ci if (ret < 0) 10038c2ecf20Sopenharmony_ci goto out; 10048c2ecf20Sopenharmony_ci 10058c2ecf20Sopenharmony_ci ret = wl18xx_pre_upload(wl); 10068c2ecf20Sopenharmony_ci if (ret < 0) 10078c2ecf20Sopenharmony_ci goto out; 10088c2ecf20Sopenharmony_ci 10098c2ecf20Sopenharmony_ci ret = wlcore_boot_upload_firmware(wl); 10108c2ecf20Sopenharmony_ci if (ret < 0) 10118c2ecf20Sopenharmony_ci goto out; 10128c2ecf20Sopenharmony_ci 10138c2ecf20Sopenharmony_ci ret = wl18xx_set_mac_and_phy(wl); 10148c2ecf20Sopenharmony_ci if (ret < 0) 10158c2ecf20Sopenharmony_ci goto out; 10168c2ecf20Sopenharmony_ci 10178c2ecf20Sopenharmony_ci wl->event_mask = BSS_LOSS_EVENT_ID | 10188c2ecf20Sopenharmony_ci SCAN_COMPLETE_EVENT_ID | 10198c2ecf20Sopenharmony_ci RADAR_DETECTED_EVENT_ID | 10208c2ecf20Sopenharmony_ci RSSI_SNR_TRIGGER_0_EVENT_ID | 10218c2ecf20Sopenharmony_ci PERIODIC_SCAN_COMPLETE_EVENT_ID | 10228c2ecf20Sopenharmony_ci PERIODIC_SCAN_REPORT_EVENT_ID | 10238c2ecf20Sopenharmony_ci DUMMY_PACKET_EVENT_ID | 10248c2ecf20Sopenharmony_ci PEER_REMOVE_COMPLETE_EVENT_ID | 10258c2ecf20Sopenharmony_ci BA_SESSION_RX_CONSTRAINT_EVENT_ID | 10268c2ecf20Sopenharmony_ci REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID | 10278c2ecf20Sopenharmony_ci INACTIVE_STA_EVENT_ID | 10288c2ecf20Sopenharmony_ci CHANNEL_SWITCH_COMPLETE_EVENT_ID | 10298c2ecf20Sopenharmony_ci DFS_CHANNELS_CONFIG_COMPLETE_EVENT | 10308c2ecf20Sopenharmony_ci SMART_CONFIG_SYNC_EVENT_ID | 10318c2ecf20Sopenharmony_ci SMART_CONFIG_DECODE_EVENT_ID | 10328c2ecf20Sopenharmony_ci TIME_SYNC_EVENT_ID | 10338c2ecf20Sopenharmony_ci FW_LOGGER_INDICATION | 10348c2ecf20Sopenharmony_ci RX_BA_WIN_SIZE_CHANGE_EVENT_ID; 10358c2ecf20Sopenharmony_ci 10368c2ecf20Sopenharmony_ci wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID; 10378c2ecf20Sopenharmony_ci 10388c2ecf20Sopenharmony_ci ret = wlcore_boot_run_firmware(wl); 10398c2ecf20Sopenharmony_ci if (ret < 0) 10408c2ecf20Sopenharmony_ci goto out; 10418c2ecf20Sopenharmony_ci 10428c2ecf20Sopenharmony_ci ret = wl18xx_enable_interrupts(wl); 10438c2ecf20Sopenharmony_ci 10448c2ecf20Sopenharmony_ciout: 10458c2ecf20Sopenharmony_ci return ret; 10468c2ecf20Sopenharmony_ci} 10478c2ecf20Sopenharmony_ci 10488c2ecf20Sopenharmony_cistatic int wl18xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, 10498c2ecf20Sopenharmony_ci void *buf, size_t len) 10508c2ecf20Sopenharmony_ci{ 10518c2ecf20Sopenharmony_ci struct wl18xx_priv *priv = wl->priv; 10528c2ecf20Sopenharmony_ci 10538c2ecf20Sopenharmony_ci memcpy(priv->cmd_buf, buf, len); 10548c2ecf20Sopenharmony_ci memset(priv->cmd_buf + len, 0, WL18XX_CMD_MAX_SIZE - len); 10558c2ecf20Sopenharmony_ci 10568c2ecf20Sopenharmony_ci return wlcore_write(wl, cmd_box_addr, priv->cmd_buf, 10578c2ecf20Sopenharmony_ci WL18XX_CMD_MAX_SIZE, false); 10588c2ecf20Sopenharmony_ci} 10598c2ecf20Sopenharmony_ci 10608c2ecf20Sopenharmony_cistatic int wl18xx_ack_event(struct wl1271 *wl) 10618c2ecf20Sopenharmony_ci{ 10628c2ecf20Sopenharmony_ci return wlcore_write_reg(wl, REG_INTERRUPT_TRIG, 10638c2ecf20Sopenharmony_ci WL18XX_INTR_TRIG_EVENT_ACK); 10648c2ecf20Sopenharmony_ci} 10658c2ecf20Sopenharmony_ci 10668c2ecf20Sopenharmony_cistatic u32 wl18xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) 10678c2ecf20Sopenharmony_ci{ 10688c2ecf20Sopenharmony_ci u32 blk_size = WL18XX_TX_HW_BLOCK_SIZE; 10698c2ecf20Sopenharmony_ci return (len + blk_size - 1) / blk_size + spare_blks; 10708c2ecf20Sopenharmony_ci} 10718c2ecf20Sopenharmony_ci 10728c2ecf20Sopenharmony_cistatic void 10738c2ecf20Sopenharmony_ciwl18xx_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, 10748c2ecf20Sopenharmony_ci u32 blks, u32 spare_blks) 10758c2ecf20Sopenharmony_ci{ 10768c2ecf20Sopenharmony_ci desc->wl18xx_mem.total_mem_blocks = blks; 10778c2ecf20Sopenharmony_ci} 10788c2ecf20Sopenharmony_ci 10798c2ecf20Sopenharmony_cistatic void 10808c2ecf20Sopenharmony_ciwl18xx_set_tx_desc_data_len(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, 10818c2ecf20Sopenharmony_ci struct sk_buff *skb) 10828c2ecf20Sopenharmony_ci{ 10838c2ecf20Sopenharmony_ci desc->length = cpu_to_le16(skb->len); 10848c2ecf20Sopenharmony_ci 10858c2ecf20Sopenharmony_ci /* if only the last frame is to be padded, we unset this bit on Tx */ 10868c2ecf20Sopenharmony_ci if (wl->quirks & WLCORE_QUIRK_TX_PAD_LAST_FRAME) 10878c2ecf20Sopenharmony_ci desc->wl18xx_mem.ctrl = WL18XX_TX_CTRL_NOT_PADDED; 10888c2ecf20Sopenharmony_ci else 10898c2ecf20Sopenharmony_ci desc->wl18xx_mem.ctrl = 0; 10908c2ecf20Sopenharmony_ci 10918c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_TX, "tx_fill_hdr: hlid: %d " 10928c2ecf20Sopenharmony_ci "len: %d life: %d mem: %d", desc->hlid, 10938c2ecf20Sopenharmony_ci le16_to_cpu(desc->length), 10948c2ecf20Sopenharmony_ci le16_to_cpu(desc->life_time), 10958c2ecf20Sopenharmony_ci desc->wl18xx_mem.total_mem_blocks); 10968c2ecf20Sopenharmony_ci} 10978c2ecf20Sopenharmony_ci 10988c2ecf20Sopenharmony_cistatic enum wl_rx_buf_align 10998c2ecf20Sopenharmony_ciwl18xx_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc) 11008c2ecf20Sopenharmony_ci{ 11018c2ecf20Sopenharmony_ci if (rx_desc & RX_BUF_PADDED_PAYLOAD) 11028c2ecf20Sopenharmony_ci return WLCORE_RX_BUF_PADDED; 11038c2ecf20Sopenharmony_ci 11048c2ecf20Sopenharmony_ci return WLCORE_RX_BUF_ALIGNED; 11058c2ecf20Sopenharmony_ci} 11068c2ecf20Sopenharmony_ci 11078c2ecf20Sopenharmony_cistatic u32 wl18xx_get_rx_packet_len(struct wl1271 *wl, void *rx_data, 11088c2ecf20Sopenharmony_ci u32 data_len) 11098c2ecf20Sopenharmony_ci{ 11108c2ecf20Sopenharmony_ci struct wl1271_rx_descriptor *desc = rx_data; 11118c2ecf20Sopenharmony_ci 11128c2ecf20Sopenharmony_ci /* invalid packet */ 11138c2ecf20Sopenharmony_ci if (data_len < sizeof(*desc)) 11148c2ecf20Sopenharmony_ci return 0; 11158c2ecf20Sopenharmony_ci 11168c2ecf20Sopenharmony_ci return data_len - sizeof(*desc); 11178c2ecf20Sopenharmony_ci} 11188c2ecf20Sopenharmony_ci 11198c2ecf20Sopenharmony_cistatic void wl18xx_tx_immediate_completion(struct wl1271 *wl) 11208c2ecf20Sopenharmony_ci{ 11218c2ecf20Sopenharmony_ci wl18xx_tx_immediate_complete(wl); 11228c2ecf20Sopenharmony_ci} 11238c2ecf20Sopenharmony_ci 11248c2ecf20Sopenharmony_cistatic int wl18xx_set_host_cfg_bitmap(struct wl1271 *wl, u32 extra_mem_blk) 11258c2ecf20Sopenharmony_ci{ 11268c2ecf20Sopenharmony_ci int ret; 11278c2ecf20Sopenharmony_ci u32 sdio_align_size = 0; 11288c2ecf20Sopenharmony_ci u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE | 11298c2ecf20Sopenharmony_ci HOST_IF_CFG_ADD_RX_ALIGNMENT; 11308c2ecf20Sopenharmony_ci 11318c2ecf20Sopenharmony_ci /* Enable Tx SDIO padding */ 11328c2ecf20Sopenharmony_ci if (wl->quirks & WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN) { 11338c2ecf20Sopenharmony_ci host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK; 11348c2ecf20Sopenharmony_ci sdio_align_size = WL12XX_BUS_BLOCK_SIZE; 11358c2ecf20Sopenharmony_ci } 11368c2ecf20Sopenharmony_ci 11378c2ecf20Sopenharmony_ci /* Enable Rx SDIO padding */ 11388c2ecf20Sopenharmony_ci if (wl->quirks & WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN) { 11398c2ecf20Sopenharmony_ci host_cfg_bitmap |= HOST_IF_CFG_RX_PAD_TO_SDIO_BLK; 11408c2ecf20Sopenharmony_ci sdio_align_size = WL12XX_BUS_BLOCK_SIZE; 11418c2ecf20Sopenharmony_ci } 11428c2ecf20Sopenharmony_ci 11438c2ecf20Sopenharmony_ci ret = wl18xx_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap, 11448c2ecf20Sopenharmony_ci sdio_align_size, extra_mem_blk, 11458c2ecf20Sopenharmony_ci WL18XX_HOST_IF_LEN_SIZE_FIELD); 11468c2ecf20Sopenharmony_ci if (ret < 0) 11478c2ecf20Sopenharmony_ci return ret; 11488c2ecf20Sopenharmony_ci 11498c2ecf20Sopenharmony_ci return 0; 11508c2ecf20Sopenharmony_ci} 11518c2ecf20Sopenharmony_ci 11528c2ecf20Sopenharmony_cistatic int wl18xx_hw_init(struct wl1271 *wl) 11538c2ecf20Sopenharmony_ci{ 11548c2ecf20Sopenharmony_ci int ret; 11558c2ecf20Sopenharmony_ci struct wl18xx_priv *priv = wl->priv; 11568c2ecf20Sopenharmony_ci 11578c2ecf20Sopenharmony_ci /* (re)init private structures. Relevant on recovery as well. */ 11588c2ecf20Sopenharmony_ci priv->last_fw_rls_idx = 0; 11598c2ecf20Sopenharmony_ci priv->extra_spare_key_count = 0; 11608c2ecf20Sopenharmony_ci 11618c2ecf20Sopenharmony_ci /* set the default amount of spare blocks in the bitmap */ 11628c2ecf20Sopenharmony_ci ret = wl18xx_set_host_cfg_bitmap(wl, WL18XX_TX_HW_BLOCK_SPARE); 11638c2ecf20Sopenharmony_ci if (ret < 0) 11648c2ecf20Sopenharmony_ci return ret; 11658c2ecf20Sopenharmony_ci 11668c2ecf20Sopenharmony_ci /* set the dynamic fw traces bitmap */ 11678c2ecf20Sopenharmony_ci ret = wl18xx_acx_dynamic_fw_traces(wl); 11688c2ecf20Sopenharmony_ci if (ret < 0) 11698c2ecf20Sopenharmony_ci return ret; 11708c2ecf20Sopenharmony_ci 11718c2ecf20Sopenharmony_ci if (checksum_param) { 11728c2ecf20Sopenharmony_ci ret = wl18xx_acx_set_checksum_state(wl); 11738c2ecf20Sopenharmony_ci if (ret != 0) 11748c2ecf20Sopenharmony_ci return ret; 11758c2ecf20Sopenharmony_ci } 11768c2ecf20Sopenharmony_ci 11778c2ecf20Sopenharmony_ci return ret; 11788c2ecf20Sopenharmony_ci} 11798c2ecf20Sopenharmony_ci 11808c2ecf20Sopenharmony_cistatic void wl18xx_convert_fw_status(struct wl1271 *wl, void *raw_fw_status, 11818c2ecf20Sopenharmony_ci struct wl_fw_status *fw_status) 11828c2ecf20Sopenharmony_ci{ 11838c2ecf20Sopenharmony_ci struct wl18xx_fw_status *int_fw_status = raw_fw_status; 11848c2ecf20Sopenharmony_ci 11858c2ecf20Sopenharmony_ci fw_status->intr = le32_to_cpu(int_fw_status->intr); 11868c2ecf20Sopenharmony_ci fw_status->fw_rx_counter = int_fw_status->fw_rx_counter; 11878c2ecf20Sopenharmony_ci fw_status->drv_rx_counter = int_fw_status->drv_rx_counter; 11888c2ecf20Sopenharmony_ci fw_status->tx_results_counter = int_fw_status->tx_results_counter; 11898c2ecf20Sopenharmony_ci fw_status->rx_pkt_descs = int_fw_status->rx_pkt_descs; 11908c2ecf20Sopenharmony_ci 11918c2ecf20Sopenharmony_ci fw_status->fw_localtime = le32_to_cpu(int_fw_status->fw_localtime); 11928c2ecf20Sopenharmony_ci fw_status->link_ps_bitmap = le32_to_cpu(int_fw_status->link_ps_bitmap); 11938c2ecf20Sopenharmony_ci fw_status->link_fast_bitmap = 11948c2ecf20Sopenharmony_ci le32_to_cpu(int_fw_status->link_fast_bitmap); 11958c2ecf20Sopenharmony_ci fw_status->total_released_blks = 11968c2ecf20Sopenharmony_ci le32_to_cpu(int_fw_status->total_released_blks); 11978c2ecf20Sopenharmony_ci fw_status->tx_total = le32_to_cpu(int_fw_status->tx_total); 11988c2ecf20Sopenharmony_ci 11998c2ecf20Sopenharmony_ci fw_status->counters.tx_released_pkts = 12008c2ecf20Sopenharmony_ci int_fw_status->counters.tx_released_pkts; 12018c2ecf20Sopenharmony_ci fw_status->counters.tx_lnk_free_pkts = 12028c2ecf20Sopenharmony_ci int_fw_status->counters.tx_lnk_free_pkts; 12038c2ecf20Sopenharmony_ci fw_status->counters.tx_voice_released_blks = 12048c2ecf20Sopenharmony_ci int_fw_status->counters.tx_voice_released_blks; 12058c2ecf20Sopenharmony_ci fw_status->counters.tx_last_rate = 12068c2ecf20Sopenharmony_ci int_fw_status->counters.tx_last_rate; 12078c2ecf20Sopenharmony_ci fw_status->counters.tx_last_rate_mbps = 12088c2ecf20Sopenharmony_ci int_fw_status->counters.tx_last_rate_mbps; 12098c2ecf20Sopenharmony_ci fw_status->counters.hlid = 12108c2ecf20Sopenharmony_ci int_fw_status->counters.hlid; 12118c2ecf20Sopenharmony_ci 12128c2ecf20Sopenharmony_ci fw_status->log_start_addr = le32_to_cpu(int_fw_status->log_start_addr); 12138c2ecf20Sopenharmony_ci 12148c2ecf20Sopenharmony_ci fw_status->priv = &int_fw_status->priv; 12158c2ecf20Sopenharmony_ci} 12168c2ecf20Sopenharmony_ci 12178c2ecf20Sopenharmony_cistatic void wl18xx_set_tx_desc_csum(struct wl1271 *wl, 12188c2ecf20Sopenharmony_ci struct wl1271_tx_hw_descr *desc, 12198c2ecf20Sopenharmony_ci struct sk_buff *skb) 12208c2ecf20Sopenharmony_ci{ 12218c2ecf20Sopenharmony_ci u32 ip_hdr_offset; 12228c2ecf20Sopenharmony_ci struct iphdr *ip_hdr; 12238c2ecf20Sopenharmony_ci 12248c2ecf20Sopenharmony_ci if (!checksum_param) { 12258c2ecf20Sopenharmony_ci desc->wl18xx_checksum_data = 0; 12268c2ecf20Sopenharmony_ci return; 12278c2ecf20Sopenharmony_ci } 12288c2ecf20Sopenharmony_ci 12298c2ecf20Sopenharmony_ci if (skb->ip_summed != CHECKSUM_PARTIAL) { 12308c2ecf20Sopenharmony_ci desc->wl18xx_checksum_data = 0; 12318c2ecf20Sopenharmony_ci return; 12328c2ecf20Sopenharmony_ci } 12338c2ecf20Sopenharmony_ci 12348c2ecf20Sopenharmony_ci ip_hdr_offset = skb_network_header(skb) - skb_mac_header(skb); 12358c2ecf20Sopenharmony_ci if (WARN_ON(ip_hdr_offset >= (1<<7))) { 12368c2ecf20Sopenharmony_ci desc->wl18xx_checksum_data = 0; 12378c2ecf20Sopenharmony_ci return; 12388c2ecf20Sopenharmony_ci } 12398c2ecf20Sopenharmony_ci 12408c2ecf20Sopenharmony_ci desc->wl18xx_checksum_data = ip_hdr_offset << 1; 12418c2ecf20Sopenharmony_ci 12428c2ecf20Sopenharmony_ci /* FW is interested only in the LSB of the protocol TCP=0 UDP=1 */ 12438c2ecf20Sopenharmony_ci ip_hdr = (void *)skb_network_header(skb); 12448c2ecf20Sopenharmony_ci desc->wl18xx_checksum_data |= (ip_hdr->protocol & 0x01); 12458c2ecf20Sopenharmony_ci} 12468c2ecf20Sopenharmony_ci 12478c2ecf20Sopenharmony_cistatic void wl18xx_set_rx_csum(struct wl1271 *wl, 12488c2ecf20Sopenharmony_ci struct wl1271_rx_descriptor *desc, 12498c2ecf20Sopenharmony_ci struct sk_buff *skb) 12508c2ecf20Sopenharmony_ci{ 12518c2ecf20Sopenharmony_ci if (desc->status & WL18XX_RX_CHECKSUM_MASK) 12528c2ecf20Sopenharmony_ci skb->ip_summed = CHECKSUM_UNNECESSARY; 12538c2ecf20Sopenharmony_ci} 12548c2ecf20Sopenharmony_ci 12558c2ecf20Sopenharmony_cistatic bool wl18xx_is_mimo_supported(struct wl1271 *wl) 12568c2ecf20Sopenharmony_ci{ 12578c2ecf20Sopenharmony_ci struct wl18xx_priv *priv = wl->priv; 12588c2ecf20Sopenharmony_ci 12598c2ecf20Sopenharmony_ci /* only support MIMO with multiple antennas, and when SISO 12608c2ecf20Sopenharmony_ci * is not forced through config 12618c2ecf20Sopenharmony_ci */ 12628c2ecf20Sopenharmony_ci return (priv->conf.phy.number_of_assembled_ant2_4 >= 2) && 12638c2ecf20Sopenharmony_ci (priv->conf.ht.mode != HT_MODE_WIDE) && 12648c2ecf20Sopenharmony_ci (priv->conf.ht.mode != HT_MODE_SISO20); 12658c2ecf20Sopenharmony_ci} 12668c2ecf20Sopenharmony_ci 12678c2ecf20Sopenharmony_ci/* 12688c2ecf20Sopenharmony_ci * TODO: instead of having these two functions to get the rate mask, 12698c2ecf20Sopenharmony_ci * we should modify the wlvif->rate_set instead 12708c2ecf20Sopenharmony_ci */ 12718c2ecf20Sopenharmony_cistatic u32 wl18xx_sta_get_ap_rate_mask(struct wl1271 *wl, 12728c2ecf20Sopenharmony_ci struct wl12xx_vif *wlvif) 12738c2ecf20Sopenharmony_ci{ 12748c2ecf20Sopenharmony_ci u32 hw_rate_set = wlvif->rate_set; 12758c2ecf20Sopenharmony_ci 12768c2ecf20Sopenharmony_ci if (wlvif->channel_type == NL80211_CHAN_HT40MINUS || 12778c2ecf20Sopenharmony_ci wlvif->channel_type == NL80211_CHAN_HT40PLUS) { 12788c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_ACX, "using wide channel rate mask"); 12798c2ecf20Sopenharmony_ci hw_rate_set |= CONF_TX_RATE_USE_WIDE_CHAN; 12808c2ecf20Sopenharmony_ci 12818c2ecf20Sopenharmony_ci /* we don't support MIMO in wide-channel mode */ 12828c2ecf20Sopenharmony_ci hw_rate_set &= ~CONF_TX_MIMO_RATES; 12838c2ecf20Sopenharmony_ci } else if (wl18xx_is_mimo_supported(wl)) { 12848c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_ACX, "using MIMO channel rate mask"); 12858c2ecf20Sopenharmony_ci hw_rate_set |= CONF_TX_MIMO_RATES; 12868c2ecf20Sopenharmony_ci } 12878c2ecf20Sopenharmony_ci 12888c2ecf20Sopenharmony_ci return hw_rate_set; 12898c2ecf20Sopenharmony_ci} 12908c2ecf20Sopenharmony_ci 12918c2ecf20Sopenharmony_cistatic u32 wl18xx_ap_get_mimo_wide_rate_mask(struct wl1271 *wl, 12928c2ecf20Sopenharmony_ci struct wl12xx_vif *wlvif) 12938c2ecf20Sopenharmony_ci{ 12948c2ecf20Sopenharmony_ci if (wlvif->channel_type == NL80211_CHAN_HT40MINUS || 12958c2ecf20Sopenharmony_ci wlvif->channel_type == NL80211_CHAN_HT40PLUS) { 12968c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_ACX, "using wide channel rate mask"); 12978c2ecf20Sopenharmony_ci 12988c2ecf20Sopenharmony_ci /* sanity check - we don't support this */ 12998c2ecf20Sopenharmony_ci if (WARN_ON(wlvif->band != NL80211_BAND_5GHZ)) 13008c2ecf20Sopenharmony_ci return 0; 13018c2ecf20Sopenharmony_ci 13028c2ecf20Sopenharmony_ci return CONF_TX_RATE_USE_WIDE_CHAN; 13038c2ecf20Sopenharmony_ci } else if (wl18xx_is_mimo_supported(wl) && 13048c2ecf20Sopenharmony_ci wlvif->band == NL80211_BAND_2GHZ) { 13058c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_ACX, "using MIMO rate mask"); 13068c2ecf20Sopenharmony_ci /* 13078c2ecf20Sopenharmony_ci * we don't care about HT channel here - if a peer doesn't 13088c2ecf20Sopenharmony_ci * support MIMO, we won't enable it in its rates 13098c2ecf20Sopenharmony_ci */ 13108c2ecf20Sopenharmony_ci return CONF_TX_MIMO_RATES; 13118c2ecf20Sopenharmony_ci } else { 13128c2ecf20Sopenharmony_ci return 0; 13138c2ecf20Sopenharmony_ci } 13148c2ecf20Sopenharmony_ci} 13158c2ecf20Sopenharmony_ci 13168c2ecf20Sopenharmony_cistatic const char *wl18xx_rdl_name(enum wl18xx_rdl_num rdl_num) 13178c2ecf20Sopenharmony_ci{ 13188c2ecf20Sopenharmony_ci switch (rdl_num) { 13198c2ecf20Sopenharmony_ci case RDL_1_HP: 13208c2ecf20Sopenharmony_ci return "183xH"; 13218c2ecf20Sopenharmony_ci case RDL_2_SP: 13228c2ecf20Sopenharmony_ci return "183x or 180x"; 13238c2ecf20Sopenharmony_ci case RDL_3_HP: 13248c2ecf20Sopenharmony_ci return "187xH"; 13258c2ecf20Sopenharmony_ci case RDL_4_SP: 13268c2ecf20Sopenharmony_ci return "187x"; 13278c2ecf20Sopenharmony_ci case RDL_5_SP: 13288c2ecf20Sopenharmony_ci return "RDL11 - Not Supported"; 13298c2ecf20Sopenharmony_ci case RDL_6_SP: 13308c2ecf20Sopenharmony_ci return "180xD"; 13318c2ecf20Sopenharmony_ci case RDL_7_SP: 13328c2ecf20Sopenharmony_ci return "RDL13 - Not Supported (1893Q)"; 13338c2ecf20Sopenharmony_ci case RDL_8_SP: 13348c2ecf20Sopenharmony_ci return "18xxQ"; 13358c2ecf20Sopenharmony_ci case RDL_NONE: 13368c2ecf20Sopenharmony_ci return "UNTRIMMED"; 13378c2ecf20Sopenharmony_ci default: 13388c2ecf20Sopenharmony_ci return "UNKNOWN"; 13398c2ecf20Sopenharmony_ci } 13408c2ecf20Sopenharmony_ci} 13418c2ecf20Sopenharmony_ci 13428c2ecf20Sopenharmony_cistatic int wl18xx_get_pg_ver(struct wl1271 *wl, s8 *ver) 13438c2ecf20Sopenharmony_ci{ 13448c2ecf20Sopenharmony_ci u32 fuse; 13458c2ecf20Sopenharmony_ci s8 rom = 0, metal = 0, pg_ver = 0, rdl_ver = 0, package_type = 0; 13468c2ecf20Sopenharmony_ci int ret; 13478c2ecf20Sopenharmony_ci 13488c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); 13498c2ecf20Sopenharmony_ci if (ret < 0) 13508c2ecf20Sopenharmony_ci goto out; 13518c2ecf20Sopenharmony_ci 13528c2ecf20Sopenharmony_ci ret = wlcore_read32(wl, WL18XX_REG_FUSE_DATA_2_3, &fuse); 13538c2ecf20Sopenharmony_ci if (ret < 0) 13548c2ecf20Sopenharmony_ci goto out; 13558c2ecf20Sopenharmony_ci 13568c2ecf20Sopenharmony_ci package_type = (fuse >> WL18XX_PACKAGE_TYPE_OFFSET) & 1; 13578c2ecf20Sopenharmony_ci 13588c2ecf20Sopenharmony_ci ret = wlcore_read32(wl, WL18XX_REG_FUSE_DATA_1_3, &fuse); 13598c2ecf20Sopenharmony_ci if (ret < 0) 13608c2ecf20Sopenharmony_ci goto out; 13618c2ecf20Sopenharmony_ci 13628c2ecf20Sopenharmony_ci pg_ver = (fuse & WL18XX_PG_VER_MASK) >> WL18XX_PG_VER_OFFSET; 13638c2ecf20Sopenharmony_ci rom = (fuse & WL18XX_ROM_VER_MASK) >> WL18XX_ROM_VER_OFFSET; 13648c2ecf20Sopenharmony_ci 13658c2ecf20Sopenharmony_ci if ((rom <= 0xE) && (package_type == WL18XX_PACKAGE_TYPE_WSP)) 13668c2ecf20Sopenharmony_ci metal = (fuse & WL18XX_METAL_VER_MASK) >> 13678c2ecf20Sopenharmony_ci WL18XX_METAL_VER_OFFSET; 13688c2ecf20Sopenharmony_ci else 13698c2ecf20Sopenharmony_ci metal = (fuse & WL18XX_NEW_METAL_VER_MASK) >> 13708c2ecf20Sopenharmony_ci WL18XX_NEW_METAL_VER_OFFSET; 13718c2ecf20Sopenharmony_ci 13728c2ecf20Sopenharmony_ci ret = wlcore_read32(wl, WL18XX_REG_FUSE_DATA_2_3, &fuse); 13738c2ecf20Sopenharmony_ci if (ret < 0) 13748c2ecf20Sopenharmony_ci goto out; 13758c2ecf20Sopenharmony_ci 13768c2ecf20Sopenharmony_ci rdl_ver = (fuse & WL18XX_RDL_VER_MASK) >> WL18XX_RDL_VER_OFFSET; 13778c2ecf20Sopenharmony_ci 13788c2ecf20Sopenharmony_ci wl1271_info("wl18xx HW: %s, PG %d.%d (ROM 0x%x)", 13798c2ecf20Sopenharmony_ci wl18xx_rdl_name(rdl_ver), pg_ver, metal, rom); 13808c2ecf20Sopenharmony_ci 13818c2ecf20Sopenharmony_ci if (ver) 13828c2ecf20Sopenharmony_ci *ver = pg_ver; 13838c2ecf20Sopenharmony_ci 13848c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); 13858c2ecf20Sopenharmony_ci 13868c2ecf20Sopenharmony_ciout: 13878c2ecf20Sopenharmony_ci return ret; 13888c2ecf20Sopenharmony_ci} 13898c2ecf20Sopenharmony_ci 13908c2ecf20Sopenharmony_cistatic int wl18xx_load_conf_file(struct device *dev, struct wlcore_conf *conf, 13918c2ecf20Sopenharmony_ci struct wl18xx_priv_conf *priv_conf, 13928c2ecf20Sopenharmony_ci const char *file) 13938c2ecf20Sopenharmony_ci{ 13948c2ecf20Sopenharmony_ci struct wlcore_conf_file *conf_file; 13958c2ecf20Sopenharmony_ci const struct firmware *fw; 13968c2ecf20Sopenharmony_ci int ret; 13978c2ecf20Sopenharmony_ci 13988c2ecf20Sopenharmony_ci ret = request_firmware(&fw, file, dev); 13998c2ecf20Sopenharmony_ci if (ret < 0) { 14008c2ecf20Sopenharmony_ci wl1271_error("could not get configuration binary %s: %d", 14018c2ecf20Sopenharmony_ci file, ret); 14028c2ecf20Sopenharmony_ci return ret; 14038c2ecf20Sopenharmony_ci } 14048c2ecf20Sopenharmony_ci 14058c2ecf20Sopenharmony_ci if (fw->size != WL18XX_CONF_SIZE) { 14068c2ecf20Sopenharmony_ci wl1271_error("%s configuration binary size is wrong, expected %zu got %zu", 14078c2ecf20Sopenharmony_ci file, WL18XX_CONF_SIZE, fw->size); 14088c2ecf20Sopenharmony_ci ret = -EINVAL; 14098c2ecf20Sopenharmony_ci goto out_release; 14108c2ecf20Sopenharmony_ci } 14118c2ecf20Sopenharmony_ci 14128c2ecf20Sopenharmony_ci conf_file = (struct wlcore_conf_file *) fw->data; 14138c2ecf20Sopenharmony_ci 14148c2ecf20Sopenharmony_ci if (conf_file->header.magic != cpu_to_le32(WL18XX_CONF_MAGIC)) { 14158c2ecf20Sopenharmony_ci wl1271_error("configuration binary file magic number mismatch, " 14168c2ecf20Sopenharmony_ci "expected 0x%0x got 0x%0x", WL18XX_CONF_MAGIC, 14178c2ecf20Sopenharmony_ci conf_file->header.magic); 14188c2ecf20Sopenharmony_ci ret = -EINVAL; 14198c2ecf20Sopenharmony_ci goto out_release; 14208c2ecf20Sopenharmony_ci } 14218c2ecf20Sopenharmony_ci 14228c2ecf20Sopenharmony_ci if (conf_file->header.version != cpu_to_le32(WL18XX_CONF_VERSION)) { 14238c2ecf20Sopenharmony_ci wl1271_error("configuration binary file version not supported, " 14248c2ecf20Sopenharmony_ci "expected 0x%08x got 0x%08x", 14258c2ecf20Sopenharmony_ci WL18XX_CONF_VERSION, conf_file->header.version); 14268c2ecf20Sopenharmony_ci ret = -EINVAL; 14278c2ecf20Sopenharmony_ci goto out_release; 14288c2ecf20Sopenharmony_ci } 14298c2ecf20Sopenharmony_ci 14308c2ecf20Sopenharmony_ci memcpy(conf, &conf_file->core, sizeof(*conf)); 14318c2ecf20Sopenharmony_ci memcpy(priv_conf, &conf_file->priv, sizeof(*priv_conf)); 14328c2ecf20Sopenharmony_ci 14338c2ecf20Sopenharmony_ciout_release: 14348c2ecf20Sopenharmony_ci release_firmware(fw); 14358c2ecf20Sopenharmony_ci return ret; 14368c2ecf20Sopenharmony_ci} 14378c2ecf20Sopenharmony_ci 14388c2ecf20Sopenharmony_cistatic int wl18xx_conf_init(struct wl1271 *wl, struct device *dev) 14398c2ecf20Sopenharmony_ci{ 14408c2ecf20Sopenharmony_ci struct platform_device *pdev = wl->pdev; 14418c2ecf20Sopenharmony_ci struct wlcore_platdev_data *pdata = dev_get_platdata(&pdev->dev); 14428c2ecf20Sopenharmony_ci struct wl18xx_priv *priv = wl->priv; 14438c2ecf20Sopenharmony_ci 14448c2ecf20Sopenharmony_ci if (wl18xx_load_conf_file(dev, &wl->conf, &priv->conf, 14458c2ecf20Sopenharmony_ci pdata->family->cfg_name) < 0) { 14468c2ecf20Sopenharmony_ci wl1271_warning("falling back to default config"); 14478c2ecf20Sopenharmony_ci 14488c2ecf20Sopenharmony_ci /* apply driver default configuration */ 14498c2ecf20Sopenharmony_ci memcpy(&wl->conf, &wl18xx_conf, sizeof(wl->conf)); 14508c2ecf20Sopenharmony_ci /* apply default private configuration */ 14518c2ecf20Sopenharmony_ci memcpy(&priv->conf, &wl18xx_default_priv_conf, 14528c2ecf20Sopenharmony_ci sizeof(priv->conf)); 14538c2ecf20Sopenharmony_ci } 14548c2ecf20Sopenharmony_ci 14558c2ecf20Sopenharmony_ci return 0; 14568c2ecf20Sopenharmony_ci} 14578c2ecf20Sopenharmony_ci 14588c2ecf20Sopenharmony_cistatic int wl18xx_plt_init(struct wl1271 *wl) 14598c2ecf20Sopenharmony_ci{ 14608c2ecf20Sopenharmony_ci int ret; 14618c2ecf20Sopenharmony_ci 14628c2ecf20Sopenharmony_ci /* calibrator based auto/fem detect not supported for 18xx */ 14638c2ecf20Sopenharmony_ci if (wl->plt_mode == PLT_FEM_DETECT) { 14648c2ecf20Sopenharmony_ci wl1271_error("wl18xx_plt_init: PLT FEM_DETECT not supported"); 14658c2ecf20Sopenharmony_ci return -EINVAL; 14668c2ecf20Sopenharmony_ci } 14678c2ecf20Sopenharmony_ci 14688c2ecf20Sopenharmony_ci ret = wlcore_write32(wl, WL18XX_SCR_PAD8, WL18XX_SCR_PAD8_PLT); 14698c2ecf20Sopenharmony_ci if (ret < 0) 14708c2ecf20Sopenharmony_ci return ret; 14718c2ecf20Sopenharmony_ci 14728c2ecf20Sopenharmony_ci return wl->ops->boot(wl); 14738c2ecf20Sopenharmony_ci} 14748c2ecf20Sopenharmony_ci 14758c2ecf20Sopenharmony_cistatic int wl18xx_get_mac(struct wl1271 *wl) 14768c2ecf20Sopenharmony_ci{ 14778c2ecf20Sopenharmony_ci u32 mac1, mac2; 14788c2ecf20Sopenharmony_ci int ret; 14798c2ecf20Sopenharmony_ci 14808c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); 14818c2ecf20Sopenharmony_ci if (ret < 0) 14828c2ecf20Sopenharmony_ci goto out; 14838c2ecf20Sopenharmony_ci 14848c2ecf20Sopenharmony_ci ret = wlcore_read32(wl, WL18XX_REG_FUSE_BD_ADDR_1, &mac1); 14858c2ecf20Sopenharmony_ci if (ret < 0) 14868c2ecf20Sopenharmony_ci goto out; 14878c2ecf20Sopenharmony_ci 14888c2ecf20Sopenharmony_ci ret = wlcore_read32(wl, WL18XX_REG_FUSE_BD_ADDR_2, &mac2); 14898c2ecf20Sopenharmony_ci if (ret < 0) 14908c2ecf20Sopenharmony_ci goto out; 14918c2ecf20Sopenharmony_ci 14928c2ecf20Sopenharmony_ci /* these are the two parts of the BD_ADDR */ 14938c2ecf20Sopenharmony_ci wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + 14948c2ecf20Sopenharmony_ci ((mac1 & 0xff000000) >> 24); 14958c2ecf20Sopenharmony_ci wl->fuse_nic_addr = (mac1 & 0xffffff); 14968c2ecf20Sopenharmony_ci 14978c2ecf20Sopenharmony_ci if (!wl->fuse_oui_addr && !wl->fuse_nic_addr) { 14988c2ecf20Sopenharmony_ci u8 mac[ETH_ALEN]; 14998c2ecf20Sopenharmony_ci 15008c2ecf20Sopenharmony_ci eth_random_addr(mac); 15018c2ecf20Sopenharmony_ci 15028c2ecf20Sopenharmony_ci wl->fuse_oui_addr = (mac[0] << 16) + (mac[1] << 8) + mac[2]; 15038c2ecf20Sopenharmony_ci wl->fuse_nic_addr = (mac[3] << 16) + (mac[4] << 8) + mac[5]; 15048c2ecf20Sopenharmony_ci wl1271_warning("MAC address from fuse not available, using random locally administered addresses."); 15058c2ecf20Sopenharmony_ci } 15068c2ecf20Sopenharmony_ci 15078c2ecf20Sopenharmony_ci ret = wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); 15088c2ecf20Sopenharmony_ci 15098c2ecf20Sopenharmony_ciout: 15108c2ecf20Sopenharmony_ci return ret; 15118c2ecf20Sopenharmony_ci} 15128c2ecf20Sopenharmony_ci 15138c2ecf20Sopenharmony_cistatic int wl18xx_handle_static_data(struct wl1271 *wl, 15148c2ecf20Sopenharmony_ci struct wl1271_static_data *static_data) 15158c2ecf20Sopenharmony_ci{ 15168c2ecf20Sopenharmony_ci struct wl18xx_static_data_priv *static_data_priv = 15178c2ecf20Sopenharmony_ci (struct wl18xx_static_data_priv *) static_data->priv; 15188c2ecf20Sopenharmony_ci 15198c2ecf20Sopenharmony_ci strncpy(wl->chip.phy_fw_ver_str, static_data_priv->phy_version, 15208c2ecf20Sopenharmony_ci sizeof(wl->chip.phy_fw_ver_str)); 15218c2ecf20Sopenharmony_ci 15228c2ecf20Sopenharmony_ci /* make sure the string is NULL-terminated */ 15238c2ecf20Sopenharmony_ci wl->chip.phy_fw_ver_str[sizeof(wl->chip.phy_fw_ver_str) - 1] = '\0'; 15248c2ecf20Sopenharmony_ci 15258c2ecf20Sopenharmony_ci wl1271_info("PHY firmware version: %s", static_data_priv->phy_version); 15268c2ecf20Sopenharmony_ci 15278c2ecf20Sopenharmony_ci return 0; 15288c2ecf20Sopenharmony_ci} 15298c2ecf20Sopenharmony_ci 15308c2ecf20Sopenharmony_cistatic int wl18xx_get_spare_blocks(struct wl1271 *wl, bool is_gem) 15318c2ecf20Sopenharmony_ci{ 15328c2ecf20Sopenharmony_ci struct wl18xx_priv *priv = wl->priv; 15338c2ecf20Sopenharmony_ci 15348c2ecf20Sopenharmony_ci /* If we have keys requiring extra spare, indulge them */ 15358c2ecf20Sopenharmony_ci if (priv->extra_spare_key_count) 15368c2ecf20Sopenharmony_ci return WL18XX_TX_HW_EXTRA_BLOCK_SPARE; 15378c2ecf20Sopenharmony_ci 15388c2ecf20Sopenharmony_ci return WL18XX_TX_HW_BLOCK_SPARE; 15398c2ecf20Sopenharmony_ci} 15408c2ecf20Sopenharmony_ci 15418c2ecf20Sopenharmony_cistatic int wl18xx_set_key(struct wl1271 *wl, enum set_key_cmd cmd, 15428c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 15438c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, 15448c2ecf20Sopenharmony_ci struct ieee80211_key_conf *key_conf) 15458c2ecf20Sopenharmony_ci{ 15468c2ecf20Sopenharmony_ci struct wl18xx_priv *priv = wl->priv; 15478c2ecf20Sopenharmony_ci bool change_spare = false, special_enc; 15488c2ecf20Sopenharmony_ci int ret; 15498c2ecf20Sopenharmony_ci 15508c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_CRYPT, "extra spare keys before: %d", 15518c2ecf20Sopenharmony_ci priv->extra_spare_key_count); 15528c2ecf20Sopenharmony_ci 15538c2ecf20Sopenharmony_ci special_enc = key_conf->cipher == WL1271_CIPHER_SUITE_GEM || 15548c2ecf20Sopenharmony_ci key_conf->cipher == WLAN_CIPHER_SUITE_TKIP; 15558c2ecf20Sopenharmony_ci 15568c2ecf20Sopenharmony_ci ret = wlcore_set_key(wl, cmd, vif, sta, key_conf); 15578c2ecf20Sopenharmony_ci if (ret < 0) 15588c2ecf20Sopenharmony_ci goto out; 15598c2ecf20Sopenharmony_ci 15608c2ecf20Sopenharmony_ci /* 15618c2ecf20Sopenharmony_ci * when adding the first or removing the last GEM/TKIP key, 15628c2ecf20Sopenharmony_ci * we have to adjust the number of spare blocks. 15638c2ecf20Sopenharmony_ci */ 15648c2ecf20Sopenharmony_ci if (special_enc) { 15658c2ecf20Sopenharmony_ci if (cmd == SET_KEY) { 15668c2ecf20Sopenharmony_ci /* first key */ 15678c2ecf20Sopenharmony_ci change_spare = (priv->extra_spare_key_count == 0); 15688c2ecf20Sopenharmony_ci priv->extra_spare_key_count++; 15698c2ecf20Sopenharmony_ci } else if (cmd == DISABLE_KEY) { 15708c2ecf20Sopenharmony_ci /* last key */ 15718c2ecf20Sopenharmony_ci change_spare = (priv->extra_spare_key_count == 1); 15728c2ecf20Sopenharmony_ci priv->extra_spare_key_count--; 15738c2ecf20Sopenharmony_ci } 15748c2ecf20Sopenharmony_ci } 15758c2ecf20Sopenharmony_ci 15768c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_CRYPT, "extra spare keys after: %d", 15778c2ecf20Sopenharmony_ci priv->extra_spare_key_count); 15788c2ecf20Sopenharmony_ci 15798c2ecf20Sopenharmony_ci if (!change_spare) 15808c2ecf20Sopenharmony_ci goto out; 15818c2ecf20Sopenharmony_ci 15828c2ecf20Sopenharmony_ci /* key is now set, change the spare blocks */ 15838c2ecf20Sopenharmony_ci if (priv->extra_spare_key_count) 15848c2ecf20Sopenharmony_ci ret = wl18xx_set_host_cfg_bitmap(wl, 15858c2ecf20Sopenharmony_ci WL18XX_TX_HW_EXTRA_BLOCK_SPARE); 15868c2ecf20Sopenharmony_ci else 15878c2ecf20Sopenharmony_ci ret = wl18xx_set_host_cfg_bitmap(wl, 15888c2ecf20Sopenharmony_ci WL18XX_TX_HW_BLOCK_SPARE); 15898c2ecf20Sopenharmony_ci 15908c2ecf20Sopenharmony_ciout: 15918c2ecf20Sopenharmony_ci return ret; 15928c2ecf20Sopenharmony_ci} 15938c2ecf20Sopenharmony_ci 15948c2ecf20Sopenharmony_cistatic u32 wl18xx_pre_pkt_send(struct wl1271 *wl, 15958c2ecf20Sopenharmony_ci u32 buf_offset, u32 last_len) 15968c2ecf20Sopenharmony_ci{ 15978c2ecf20Sopenharmony_ci if (wl->quirks & WLCORE_QUIRK_TX_PAD_LAST_FRAME) { 15988c2ecf20Sopenharmony_ci struct wl1271_tx_hw_descr *last_desc; 15998c2ecf20Sopenharmony_ci 16008c2ecf20Sopenharmony_ci /* get the last TX HW descriptor written to the aggr buf */ 16018c2ecf20Sopenharmony_ci last_desc = (struct wl1271_tx_hw_descr *)(wl->aggr_buf + 16028c2ecf20Sopenharmony_ci buf_offset - last_len); 16038c2ecf20Sopenharmony_ci 16048c2ecf20Sopenharmony_ci /* the last frame is padded up to an SDIO block */ 16058c2ecf20Sopenharmony_ci last_desc->wl18xx_mem.ctrl &= ~WL18XX_TX_CTRL_NOT_PADDED; 16068c2ecf20Sopenharmony_ci return ALIGN(buf_offset, WL12XX_BUS_BLOCK_SIZE); 16078c2ecf20Sopenharmony_ci } 16088c2ecf20Sopenharmony_ci 16098c2ecf20Sopenharmony_ci /* no modifications */ 16108c2ecf20Sopenharmony_ci return buf_offset; 16118c2ecf20Sopenharmony_ci} 16128c2ecf20Sopenharmony_ci 16138c2ecf20Sopenharmony_cistatic void wl18xx_sta_rc_update(struct wl1271 *wl, 16148c2ecf20Sopenharmony_ci struct wl12xx_vif *wlvif) 16158c2ecf20Sopenharmony_ci{ 16168c2ecf20Sopenharmony_ci bool wide = wlvif->rc_update_bw >= IEEE80211_STA_RX_BW_40; 16178c2ecf20Sopenharmony_ci 16188c2ecf20Sopenharmony_ci wl1271_debug(DEBUG_MAC80211, "mac80211 sta_rc_update wide %d", wide); 16198c2ecf20Sopenharmony_ci 16208c2ecf20Sopenharmony_ci /* sanity */ 16218c2ecf20Sopenharmony_ci if (WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS)) 16228c2ecf20Sopenharmony_ci return; 16238c2ecf20Sopenharmony_ci 16248c2ecf20Sopenharmony_ci /* ignore the change before association */ 16258c2ecf20Sopenharmony_ci if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) 16268c2ecf20Sopenharmony_ci return; 16278c2ecf20Sopenharmony_ci 16288c2ecf20Sopenharmony_ci /* 16298c2ecf20Sopenharmony_ci * If we started out as wide, we can change the operation mode. If we 16308c2ecf20Sopenharmony_ci * thought this was a 20mhz AP, we have to reconnect 16318c2ecf20Sopenharmony_ci */ 16328c2ecf20Sopenharmony_ci if (wlvif->sta.role_chan_type == NL80211_CHAN_HT40MINUS || 16338c2ecf20Sopenharmony_ci wlvif->sta.role_chan_type == NL80211_CHAN_HT40PLUS) 16348c2ecf20Sopenharmony_ci wl18xx_acx_peer_ht_operation_mode(wl, wlvif->sta.hlid, wide); 16358c2ecf20Sopenharmony_ci else 16368c2ecf20Sopenharmony_ci ieee80211_connection_loss(wl12xx_wlvif_to_vif(wlvif)); 16378c2ecf20Sopenharmony_ci} 16388c2ecf20Sopenharmony_ci 16398c2ecf20Sopenharmony_cistatic int wl18xx_set_peer_cap(struct wl1271 *wl, 16408c2ecf20Sopenharmony_ci struct ieee80211_sta_ht_cap *ht_cap, 16418c2ecf20Sopenharmony_ci bool allow_ht_operation, 16428c2ecf20Sopenharmony_ci u32 rate_set, u8 hlid) 16438c2ecf20Sopenharmony_ci{ 16448c2ecf20Sopenharmony_ci return wl18xx_acx_set_peer_cap(wl, ht_cap, allow_ht_operation, 16458c2ecf20Sopenharmony_ci rate_set, hlid); 16468c2ecf20Sopenharmony_ci} 16478c2ecf20Sopenharmony_ci 16488c2ecf20Sopenharmony_cistatic bool wl18xx_lnk_high_prio(struct wl1271 *wl, u8 hlid, 16498c2ecf20Sopenharmony_ci struct wl1271_link *lnk) 16508c2ecf20Sopenharmony_ci{ 16518c2ecf20Sopenharmony_ci u8 thold; 16528c2ecf20Sopenharmony_ci struct wl18xx_fw_status_priv *status_priv = 16538c2ecf20Sopenharmony_ci (struct wl18xx_fw_status_priv *)wl->fw_status->priv; 16548c2ecf20Sopenharmony_ci unsigned long suspend_bitmap; 16558c2ecf20Sopenharmony_ci 16568c2ecf20Sopenharmony_ci /* if we don't have the link map yet, assume they all low prio */ 16578c2ecf20Sopenharmony_ci if (!status_priv) 16588c2ecf20Sopenharmony_ci return false; 16598c2ecf20Sopenharmony_ci 16608c2ecf20Sopenharmony_ci /* suspended links are never high priority */ 16618c2ecf20Sopenharmony_ci suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); 16628c2ecf20Sopenharmony_ci if (test_bit(hlid, &suspend_bitmap)) 16638c2ecf20Sopenharmony_ci return false; 16648c2ecf20Sopenharmony_ci 16658c2ecf20Sopenharmony_ci /* the priority thresholds are taken from FW */ 16668c2ecf20Sopenharmony_ci if (test_bit(hlid, &wl->fw_fast_lnk_map) && 16678c2ecf20Sopenharmony_ci !test_bit(hlid, &wl->ap_fw_ps_map)) 16688c2ecf20Sopenharmony_ci thold = status_priv->tx_fast_link_prio_threshold; 16698c2ecf20Sopenharmony_ci else 16708c2ecf20Sopenharmony_ci thold = status_priv->tx_slow_link_prio_threshold; 16718c2ecf20Sopenharmony_ci 16728c2ecf20Sopenharmony_ci return lnk->allocated_pkts < thold; 16738c2ecf20Sopenharmony_ci} 16748c2ecf20Sopenharmony_ci 16758c2ecf20Sopenharmony_cistatic bool wl18xx_lnk_low_prio(struct wl1271 *wl, u8 hlid, 16768c2ecf20Sopenharmony_ci struct wl1271_link *lnk) 16778c2ecf20Sopenharmony_ci{ 16788c2ecf20Sopenharmony_ci u8 thold; 16798c2ecf20Sopenharmony_ci struct wl18xx_fw_status_priv *status_priv = 16808c2ecf20Sopenharmony_ci (struct wl18xx_fw_status_priv *)wl->fw_status->priv; 16818c2ecf20Sopenharmony_ci unsigned long suspend_bitmap; 16828c2ecf20Sopenharmony_ci 16838c2ecf20Sopenharmony_ci /* if we don't have the link map yet, assume they all low prio */ 16848c2ecf20Sopenharmony_ci if (!status_priv) 16858c2ecf20Sopenharmony_ci return true; 16868c2ecf20Sopenharmony_ci 16878c2ecf20Sopenharmony_ci suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); 16888c2ecf20Sopenharmony_ci if (test_bit(hlid, &suspend_bitmap)) 16898c2ecf20Sopenharmony_ci thold = status_priv->tx_suspend_threshold; 16908c2ecf20Sopenharmony_ci else if (test_bit(hlid, &wl->fw_fast_lnk_map) && 16918c2ecf20Sopenharmony_ci !test_bit(hlid, &wl->ap_fw_ps_map)) 16928c2ecf20Sopenharmony_ci thold = status_priv->tx_fast_stop_threshold; 16938c2ecf20Sopenharmony_ci else 16948c2ecf20Sopenharmony_ci thold = status_priv->tx_slow_stop_threshold; 16958c2ecf20Sopenharmony_ci 16968c2ecf20Sopenharmony_ci return lnk->allocated_pkts < thold; 16978c2ecf20Sopenharmony_ci} 16988c2ecf20Sopenharmony_ci 16998c2ecf20Sopenharmony_cistatic u32 wl18xx_convert_hwaddr(struct wl1271 *wl, u32 hwaddr) 17008c2ecf20Sopenharmony_ci{ 17018c2ecf20Sopenharmony_ci return hwaddr & ~0x80000000; 17028c2ecf20Sopenharmony_ci} 17038c2ecf20Sopenharmony_ci 17048c2ecf20Sopenharmony_cistatic int wl18xx_setup(struct wl1271 *wl); 17058c2ecf20Sopenharmony_ci 17068c2ecf20Sopenharmony_cistatic struct wlcore_ops wl18xx_ops = { 17078c2ecf20Sopenharmony_ci .setup = wl18xx_setup, 17088c2ecf20Sopenharmony_ci .identify_chip = wl18xx_identify_chip, 17098c2ecf20Sopenharmony_ci .boot = wl18xx_boot, 17108c2ecf20Sopenharmony_ci .plt_init = wl18xx_plt_init, 17118c2ecf20Sopenharmony_ci .trigger_cmd = wl18xx_trigger_cmd, 17128c2ecf20Sopenharmony_ci .ack_event = wl18xx_ack_event, 17138c2ecf20Sopenharmony_ci .wait_for_event = wl18xx_wait_for_event, 17148c2ecf20Sopenharmony_ci .process_mailbox_events = wl18xx_process_mailbox_events, 17158c2ecf20Sopenharmony_ci .calc_tx_blocks = wl18xx_calc_tx_blocks, 17168c2ecf20Sopenharmony_ci .set_tx_desc_blocks = wl18xx_set_tx_desc_blocks, 17178c2ecf20Sopenharmony_ci .set_tx_desc_data_len = wl18xx_set_tx_desc_data_len, 17188c2ecf20Sopenharmony_ci .get_rx_buf_align = wl18xx_get_rx_buf_align, 17198c2ecf20Sopenharmony_ci .get_rx_packet_len = wl18xx_get_rx_packet_len, 17208c2ecf20Sopenharmony_ci .tx_immediate_compl = wl18xx_tx_immediate_completion, 17218c2ecf20Sopenharmony_ci .tx_delayed_compl = NULL, 17228c2ecf20Sopenharmony_ci .hw_init = wl18xx_hw_init, 17238c2ecf20Sopenharmony_ci .convert_fw_status = wl18xx_convert_fw_status, 17248c2ecf20Sopenharmony_ci .set_tx_desc_csum = wl18xx_set_tx_desc_csum, 17258c2ecf20Sopenharmony_ci .get_pg_ver = wl18xx_get_pg_ver, 17268c2ecf20Sopenharmony_ci .set_rx_csum = wl18xx_set_rx_csum, 17278c2ecf20Sopenharmony_ci .sta_get_ap_rate_mask = wl18xx_sta_get_ap_rate_mask, 17288c2ecf20Sopenharmony_ci .ap_get_mimo_wide_rate_mask = wl18xx_ap_get_mimo_wide_rate_mask, 17298c2ecf20Sopenharmony_ci .get_mac = wl18xx_get_mac, 17308c2ecf20Sopenharmony_ci .debugfs_init = wl18xx_debugfs_add_files, 17318c2ecf20Sopenharmony_ci .scan_start = wl18xx_scan_start, 17328c2ecf20Sopenharmony_ci .scan_stop = wl18xx_scan_stop, 17338c2ecf20Sopenharmony_ci .sched_scan_start = wl18xx_sched_scan_start, 17348c2ecf20Sopenharmony_ci .sched_scan_stop = wl18xx_scan_sched_scan_stop, 17358c2ecf20Sopenharmony_ci .handle_static_data = wl18xx_handle_static_data, 17368c2ecf20Sopenharmony_ci .get_spare_blocks = wl18xx_get_spare_blocks, 17378c2ecf20Sopenharmony_ci .set_key = wl18xx_set_key, 17388c2ecf20Sopenharmony_ci .channel_switch = wl18xx_cmd_channel_switch, 17398c2ecf20Sopenharmony_ci .pre_pkt_send = wl18xx_pre_pkt_send, 17408c2ecf20Sopenharmony_ci .sta_rc_update = wl18xx_sta_rc_update, 17418c2ecf20Sopenharmony_ci .set_peer_cap = wl18xx_set_peer_cap, 17428c2ecf20Sopenharmony_ci .convert_hwaddr = wl18xx_convert_hwaddr, 17438c2ecf20Sopenharmony_ci .lnk_high_prio = wl18xx_lnk_high_prio, 17448c2ecf20Sopenharmony_ci .lnk_low_prio = wl18xx_lnk_low_prio, 17458c2ecf20Sopenharmony_ci .smart_config_start = wl18xx_cmd_smart_config_start, 17468c2ecf20Sopenharmony_ci .smart_config_stop = wl18xx_cmd_smart_config_stop, 17478c2ecf20Sopenharmony_ci .smart_config_set_group_key = wl18xx_cmd_smart_config_set_group_key, 17488c2ecf20Sopenharmony_ci .interrupt_notify = wl18xx_acx_interrupt_notify_config, 17498c2ecf20Sopenharmony_ci .rx_ba_filter = wl18xx_acx_rx_ba_filter, 17508c2ecf20Sopenharmony_ci .ap_sleep = wl18xx_acx_ap_sleep, 17518c2ecf20Sopenharmony_ci .set_cac = wl18xx_cmd_set_cac, 17528c2ecf20Sopenharmony_ci .dfs_master_restart = wl18xx_cmd_dfs_master_restart, 17538c2ecf20Sopenharmony_ci}; 17548c2ecf20Sopenharmony_ci 17558c2ecf20Sopenharmony_ci/* HT cap appropriate for wide channels in 2Ghz */ 17568c2ecf20Sopenharmony_cistatic struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap_2ghz = { 17578c2ecf20Sopenharmony_ci .cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | 17588c2ecf20Sopenharmony_ci IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_DSSSCCK40 | 17598c2ecf20Sopenharmony_ci IEEE80211_HT_CAP_GRN_FLD, 17608c2ecf20Sopenharmony_ci .ht_supported = true, 17618c2ecf20Sopenharmony_ci .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, 17628c2ecf20Sopenharmony_ci .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, 17638c2ecf20Sopenharmony_ci .mcs = { 17648c2ecf20Sopenharmony_ci .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 17658c2ecf20Sopenharmony_ci .rx_highest = cpu_to_le16(150), 17668c2ecf20Sopenharmony_ci .tx_params = IEEE80211_HT_MCS_TX_DEFINED, 17678c2ecf20Sopenharmony_ci }, 17688c2ecf20Sopenharmony_ci}; 17698c2ecf20Sopenharmony_ci 17708c2ecf20Sopenharmony_ci/* HT cap appropriate for wide channels in 5Ghz */ 17718c2ecf20Sopenharmony_cistatic struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap_5ghz = { 17728c2ecf20Sopenharmony_ci .cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | 17738c2ecf20Sopenharmony_ci IEEE80211_HT_CAP_SUP_WIDTH_20_40 | 17748c2ecf20Sopenharmony_ci IEEE80211_HT_CAP_GRN_FLD, 17758c2ecf20Sopenharmony_ci .ht_supported = true, 17768c2ecf20Sopenharmony_ci .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, 17778c2ecf20Sopenharmony_ci .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, 17788c2ecf20Sopenharmony_ci .mcs = { 17798c2ecf20Sopenharmony_ci .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 17808c2ecf20Sopenharmony_ci .rx_highest = cpu_to_le16(150), 17818c2ecf20Sopenharmony_ci .tx_params = IEEE80211_HT_MCS_TX_DEFINED, 17828c2ecf20Sopenharmony_ci }, 17838c2ecf20Sopenharmony_ci}; 17848c2ecf20Sopenharmony_ci 17858c2ecf20Sopenharmony_ci/* HT cap appropriate for SISO 20 */ 17868c2ecf20Sopenharmony_cistatic struct ieee80211_sta_ht_cap wl18xx_siso20_ht_cap = { 17878c2ecf20Sopenharmony_ci .cap = IEEE80211_HT_CAP_SGI_20 | 17888c2ecf20Sopenharmony_ci IEEE80211_HT_CAP_GRN_FLD, 17898c2ecf20Sopenharmony_ci .ht_supported = true, 17908c2ecf20Sopenharmony_ci .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, 17918c2ecf20Sopenharmony_ci .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, 17928c2ecf20Sopenharmony_ci .mcs = { 17938c2ecf20Sopenharmony_ci .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 17948c2ecf20Sopenharmony_ci .rx_highest = cpu_to_le16(72), 17958c2ecf20Sopenharmony_ci .tx_params = IEEE80211_HT_MCS_TX_DEFINED, 17968c2ecf20Sopenharmony_ci }, 17978c2ecf20Sopenharmony_ci}; 17988c2ecf20Sopenharmony_ci 17998c2ecf20Sopenharmony_ci/* HT cap appropriate for MIMO rates in 20mhz channel */ 18008c2ecf20Sopenharmony_cistatic struct ieee80211_sta_ht_cap wl18xx_mimo_ht_cap_2ghz = { 18018c2ecf20Sopenharmony_ci .cap = IEEE80211_HT_CAP_SGI_20 | 18028c2ecf20Sopenharmony_ci IEEE80211_HT_CAP_GRN_FLD, 18038c2ecf20Sopenharmony_ci .ht_supported = true, 18048c2ecf20Sopenharmony_ci .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, 18058c2ecf20Sopenharmony_ci .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, 18068c2ecf20Sopenharmony_ci .mcs = { 18078c2ecf20Sopenharmony_ci .rx_mask = { 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, }, 18088c2ecf20Sopenharmony_ci .rx_highest = cpu_to_le16(144), 18098c2ecf20Sopenharmony_ci .tx_params = IEEE80211_HT_MCS_TX_DEFINED, 18108c2ecf20Sopenharmony_ci }, 18118c2ecf20Sopenharmony_ci}; 18128c2ecf20Sopenharmony_ci 18138c2ecf20Sopenharmony_cistatic const struct ieee80211_iface_limit wl18xx_iface_limits[] = { 18148c2ecf20Sopenharmony_ci { 18158c2ecf20Sopenharmony_ci .max = 2, 18168c2ecf20Sopenharmony_ci .types = BIT(NL80211_IFTYPE_STATION), 18178c2ecf20Sopenharmony_ci }, 18188c2ecf20Sopenharmony_ci { 18198c2ecf20Sopenharmony_ci .max = 1, 18208c2ecf20Sopenharmony_ci .types = BIT(NL80211_IFTYPE_AP) 18218c2ecf20Sopenharmony_ci | BIT(NL80211_IFTYPE_P2P_GO) 18228c2ecf20Sopenharmony_ci | BIT(NL80211_IFTYPE_P2P_CLIENT) 18238c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_MESH 18248c2ecf20Sopenharmony_ci | BIT(NL80211_IFTYPE_MESH_POINT) 18258c2ecf20Sopenharmony_ci#endif 18268c2ecf20Sopenharmony_ci }, 18278c2ecf20Sopenharmony_ci { 18288c2ecf20Sopenharmony_ci .max = 1, 18298c2ecf20Sopenharmony_ci .types = BIT(NL80211_IFTYPE_P2P_DEVICE), 18308c2ecf20Sopenharmony_ci }, 18318c2ecf20Sopenharmony_ci}; 18328c2ecf20Sopenharmony_ci 18338c2ecf20Sopenharmony_cistatic const struct ieee80211_iface_limit wl18xx_iface_ap_limits[] = { 18348c2ecf20Sopenharmony_ci { 18358c2ecf20Sopenharmony_ci .max = 2, 18368c2ecf20Sopenharmony_ci .types = BIT(NL80211_IFTYPE_AP), 18378c2ecf20Sopenharmony_ci }, 18388c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_MESH 18398c2ecf20Sopenharmony_ci { 18408c2ecf20Sopenharmony_ci .max = 1, 18418c2ecf20Sopenharmony_ci .types = BIT(NL80211_IFTYPE_MESH_POINT), 18428c2ecf20Sopenharmony_ci }, 18438c2ecf20Sopenharmony_ci#endif 18448c2ecf20Sopenharmony_ci { 18458c2ecf20Sopenharmony_ci .max = 1, 18468c2ecf20Sopenharmony_ci .types = BIT(NL80211_IFTYPE_P2P_DEVICE), 18478c2ecf20Sopenharmony_ci }, 18488c2ecf20Sopenharmony_ci}; 18498c2ecf20Sopenharmony_ci 18508c2ecf20Sopenharmony_cistatic const struct ieee80211_iface_combination 18518c2ecf20Sopenharmony_ciwl18xx_iface_combinations[] = { 18528c2ecf20Sopenharmony_ci { 18538c2ecf20Sopenharmony_ci .max_interfaces = 3, 18548c2ecf20Sopenharmony_ci .limits = wl18xx_iface_limits, 18558c2ecf20Sopenharmony_ci .n_limits = ARRAY_SIZE(wl18xx_iface_limits), 18568c2ecf20Sopenharmony_ci .num_different_channels = 2, 18578c2ecf20Sopenharmony_ci }, 18588c2ecf20Sopenharmony_ci { 18598c2ecf20Sopenharmony_ci .max_interfaces = 2, 18608c2ecf20Sopenharmony_ci .limits = wl18xx_iface_ap_limits, 18618c2ecf20Sopenharmony_ci .n_limits = ARRAY_SIZE(wl18xx_iface_ap_limits), 18628c2ecf20Sopenharmony_ci .num_different_channels = 1, 18638c2ecf20Sopenharmony_ci .radar_detect_widths = BIT(NL80211_CHAN_NO_HT) | 18648c2ecf20Sopenharmony_ci BIT(NL80211_CHAN_HT20) | 18658c2ecf20Sopenharmony_ci BIT(NL80211_CHAN_HT40MINUS) | 18668c2ecf20Sopenharmony_ci BIT(NL80211_CHAN_HT40PLUS), 18678c2ecf20Sopenharmony_ci } 18688c2ecf20Sopenharmony_ci}; 18698c2ecf20Sopenharmony_ci 18708c2ecf20Sopenharmony_cistatic int wl18xx_setup(struct wl1271 *wl) 18718c2ecf20Sopenharmony_ci{ 18728c2ecf20Sopenharmony_ci struct wl18xx_priv *priv = wl->priv; 18738c2ecf20Sopenharmony_ci int ret; 18748c2ecf20Sopenharmony_ci 18758c2ecf20Sopenharmony_ci BUILD_BUG_ON(WL18XX_MAX_LINKS > WLCORE_MAX_LINKS); 18768c2ecf20Sopenharmony_ci BUILD_BUG_ON(WL18XX_MAX_AP_STATIONS > WL18XX_MAX_LINKS); 18778c2ecf20Sopenharmony_ci BUILD_BUG_ON(WL18XX_CONF_SG_PARAMS_MAX > WLCORE_CONF_SG_PARAMS_MAX); 18788c2ecf20Sopenharmony_ci 18798c2ecf20Sopenharmony_ci wl->rtable = wl18xx_rtable; 18808c2ecf20Sopenharmony_ci wl->num_tx_desc = WL18XX_NUM_TX_DESCRIPTORS; 18818c2ecf20Sopenharmony_ci wl->num_rx_desc = WL18XX_NUM_RX_DESCRIPTORS; 18828c2ecf20Sopenharmony_ci wl->num_links = WL18XX_MAX_LINKS; 18838c2ecf20Sopenharmony_ci wl->max_ap_stations = WL18XX_MAX_AP_STATIONS; 18848c2ecf20Sopenharmony_ci wl->iface_combinations = wl18xx_iface_combinations; 18858c2ecf20Sopenharmony_ci wl->n_iface_combinations = ARRAY_SIZE(wl18xx_iface_combinations); 18868c2ecf20Sopenharmony_ci wl->num_mac_addr = WL18XX_NUM_MAC_ADDRESSES; 18878c2ecf20Sopenharmony_ci wl->band_rate_to_idx = wl18xx_band_rate_to_idx; 18888c2ecf20Sopenharmony_ci wl->hw_tx_rate_tbl_size = WL18XX_CONF_HW_RXTX_RATE_MAX; 18898c2ecf20Sopenharmony_ci wl->hw_min_ht_rate = WL18XX_CONF_HW_RXTX_RATE_MCS0; 18908c2ecf20Sopenharmony_ci wl->fw_status_len = sizeof(struct wl18xx_fw_status); 18918c2ecf20Sopenharmony_ci wl->fw_status_priv_len = sizeof(struct wl18xx_fw_status_priv); 18928c2ecf20Sopenharmony_ci wl->stats.fw_stats_len = sizeof(struct wl18xx_acx_statistics); 18938c2ecf20Sopenharmony_ci wl->static_data_priv_len = sizeof(struct wl18xx_static_data_priv); 18948c2ecf20Sopenharmony_ci 18958c2ecf20Sopenharmony_ci if (num_rx_desc_param != -1) 18968c2ecf20Sopenharmony_ci wl->num_rx_desc = num_rx_desc_param; 18978c2ecf20Sopenharmony_ci 18988c2ecf20Sopenharmony_ci ret = wl18xx_conf_init(wl, wl->dev); 18998c2ecf20Sopenharmony_ci if (ret < 0) 19008c2ecf20Sopenharmony_ci return ret; 19018c2ecf20Sopenharmony_ci 19028c2ecf20Sopenharmony_ci /* If the module param is set, update it in conf */ 19038c2ecf20Sopenharmony_ci if (board_type_param) { 19048c2ecf20Sopenharmony_ci if (!strcmp(board_type_param, "fpga")) { 19058c2ecf20Sopenharmony_ci priv->conf.phy.board_type = BOARD_TYPE_FPGA_18XX; 19068c2ecf20Sopenharmony_ci } else if (!strcmp(board_type_param, "hdk")) { 19078c2ecf20Sopenharmony_ci priv->conf.phy.board_type = BOARD_TYPE_HDK_18XX; 19088c2ecf20Sopenharmony_ci } else if (!strcmp(board_type_param, "dvp")) { 19098c2ecf20Sopenharmony_ci priv->conf.phy.board_type = BOARD_TYPE_DVP_18XX; 19108c2ecf20Sopenharmony_ci } else if (!strcmp(board_type_param, "evb")) { 19118c2ecf20Sopenharmony_ci priv->conf.phy.board_type = BOARD_TYPE_EVB_18XX; 19128c2ecf20Sopenharmony_ci } else if (!strcmp(board_type_param, "com8")) { 19138c2ecf20Sopenharmony_ci priv->conf.phy.board_type = BOARD_TYPE_COM8_18XX; 19148c2ecf20Sopenharmony_ci } else { 19158c2ecf20Sopenharmony_ci wl1271_error("invalid board type '%s'", 19168c2ecf20Sopenharmony_ci board_type_param); 19178c2ecf20Sopenharmony_ci return -EINVAL; 19188c2ecf20Sopenharmony_ci } 19198c2ecf20Sopenharmony_ci } 19208c2ecf20Sopenharmony_ci 19218c2ecf20Sopenharmony_ci if (priv->conf.phy.board_type >= NUM_BOARD_TYPES) { 19228c2ecf20Sopenharmony_ci wl1271_error("invalid board type '%d'", 19238c2ecf20Sopenharmony_ci priv->conf.phy.board_type); 19248c2ecf20Sopenharmony_ci return -EINVAL; 19258c2ecf20Sopenharmony_ci } 19268c2ecf20Sopenharmony_ci 19278c2ecf20Sopenharmony_ci if (low_band_component_param != -1) 19288c2ecf20Sopenharmony_ci priv->conf.phy.low_band_component = low_band_component_param; 19298c2ecf20Sopenharmony_ci if (low_band_component_type_param != -1) 19308c2ecf20Sopenharmony_ci priv->conf.phy.low_band_component_type = 19318c2ecf20Sopenharmony_ci low_band_component_type_param; 19328c2ecf20Sopenharmony_ci if (high_band_component_param != -1) 19338c2ecf20Sopenharmony_ci priv->conf.phy.high_band_component = high_band_component_param; 19348c2ecf20Sopenharmony_ci if (high_band_component_type_param != -1) 19358c2ecf20Sopenharmony_ci priv->conf.phy.high_band_component_type = 19368c2ecf20Sopenharmony_ci high_band_component_type_param; 19378c2ecf20Sopenharmony_ci if (pwr_limit_reference_11_abg_param != -1) 19388c2ecf20Sopenharmony_ci priv->conf.phy.pwr_limit_reference_11_abg = 19398c2ecf20Sopenharmony_ci pwr_limit_reference_11_abg_param; 19408c2ecf20Sopenharmony_ci if (n_antennas_2_param != -1) 19418c2ecf20Sopenharmony_ci priv->conf.phy.number_of_assembled_ant2_4 = n_antennas_2_param; 19428c2ecf20Sopenharmony_ci if (n_antennas_5_param != -1) 19438c2ecf20Sopenharmony_ci priv->conf.phy.number_of_assembled_ant5 = n_antennas_5_param; 19448c2ecf20Sopenharmony_ci if (dc2dc_param != -1) 19458c2ecf20Sopenharmony_ci priv->conf.phy.external_pa_dc2dc = dc2dc_param; 19468c2ecf20Sopenharmony_ci 19478c2ecf20Sopenharmony_ci if (ht_mode_param) { 19488c2ecf20Sopenharmony_ci if (!strcmp(ht_mode_param, "default")) 19498c2ecf20Sopenharmony_ci priv->conf.ht.mode = HT_MODE_DEFAULT; 19508c2ecf20Sopenharmony_ci else if (!strcmp(ht_mode_param, "wide")) 19518c2ecf20Sopenharmony_ci priv->conf.ht.mode = HT_MODE_WIDE; 19528c2ecf20Sopenharmony_ci else if (!strcmp(ht_mode_param, "siso20")) 19538c2ecf20Sopenharmony_ci priv->conf.ht.mode = HT_MODE_SISO20; 19548c2ecf20Sopenharmony_ci else { 19558c2ecf20Sopenharmony_ci wl1271_error("invalid ht_mode '%s'", ht_mode_param); 19568c2ecf20Sopenharmony_ci return -EINVAL; 19578c2ecf20Sopenharmony_ci } 19588c2ecf20Sopenharmony_ci } 19598c2ecf20Sopenharmony_ci 19608c2ecf20Sopenharmony_ci if (priv->conf.ht.mode == HT_MODE_DEFAULT) { 19618c2ecf20Sopenharmony_ci /* 19628c2ecf20Sopenharmony_ci * Only support mimo with multiple antennas. Fall back to 19638c2ecf20Sopenharmony_ci * siso40. 19648c2ecf20Sopenharmony_ci */ 19658c2ecf20Sopenharmony_ci if (wl18xx_is_mimo_supported(wl)) 19668c2ecf20Sopenharmony_ci wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, 19678c2ecf20Sopenharmony_ci &wl18xx_mimo_ht_cap_2ghz); 19688c2ecf20Sopenharmony_ci else 19698c2ecf20Sopenharmony_ci wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, 19708c2ecf20Sopenharmony_ci &wl18xx_siso40_ht_cap_2ghz); 19718c2ecf20Sopenharmony_ci 19728c2ecf20Sopenharmony_ci /* 5Ghz is always wide */ 19738c2ecf20Sopenharmony_ci wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ, 19748c2ecf20Sopenharmony_ci &wl18xx_siso40_ht_cap_5ghz); 19758c2ecf20Sopenharmony_ci } else if (priv->conf.ht.mode == HT_MODE_WIDE) { 19768c2ecf20Sopenharmony_ci wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, 19778c2ecf20Sopenharmony_ci &wl18xx_siso40_ht_cap_2ghz); 19788c2ecf20Sopenharmony_ci wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ, 19798c2ecf20Sopenharmony_ci &wl18xx_siso40_ht_cap_5ghz); 19808c2ecf20Sopenharmony_ci } else if (priv->conf.ht.mode == HT_MODE_SISO20) { 19818c2ecf20Sopenharmony_ci wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, 19828c2ecf20Sopenharmony_ci &wl18xx_siso20_ht_cap); 19838c2ecf20Sopenharmony_ci wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ, 19848c2ecf20Sopenharmony_ci &wl18xx_siso20_ht_cap); 19858c2ecf20Sopenharmony_ci } 19868c2ecf20Sopenharmony_ci 19878c2ecf20Sopenharmony_ci if (!checksum_param) { 19888c2ecf20Sopenharmony_ci wl18xx_ops.set_rx_csum = NULL; 19898c2ecf20Sopenharmony_ci wl18xx_ops.init_vif = NULL; 19908c2ecf20Sopenharmony_ci } 19918c2ecf20Sopenharmony_ci 19928c2ecf20Sopenharmony_ci /* Enable 11a Band only if we have 5G antennas */ 19938c2ecf20Sopenharmony_ci wl->enable_11a = (priv->conf.phy.number_of_assembled_ant5 != 0); 19948c2ecf20Sopenharmony_ci 19958c2ecf20Sopenharmony_ci return 0; 19968c2ecf20Sopenharmony_ci} 19978c2ecf20Sopenharmony_ci 19988c2ecf20Sopenharmony_cistatic int wl18xx_probe(struct platform_device *pdev) 19998c2ecf20Sopenharmony_ci{ 20008c2ecf20Sopenharmony_ci struct wl1271 *wl; 20018c2ecf20Sopenharmony_ci struct ieee80211_hw *hw; 20028c2ecf20Sopenharmony_ci int ret; 20038c2ecf20Sopenharmony_ci 20048c2ecf20Sopenharmony_ci hw = wlcore_alloc_hw(sizeof(struct wl18xx_priv), 20058c2ecf20Sopenharmony_ci WL18XX_AGGR_BUFFER_SIZE, 20068c2ecf20Sopenharmony_ci sizeof(struct wl18xx_event_mailbox)); 20078c2ecf20Sopenharmony_ci if (IS_ERR(hw)) { 20088c2ecf20Sopenharmony_ci wl1271_error("can't allocate hw"); 20098c2ecf20Sopenharmony_ci ret = PTR_ERR(hw); 20108c2ecf20Sopenharmony_ci goto out; 20118c2ecf20Sopenharmony_ci } 20128c2ecf20Sopenharmony_ci 20138c2ecf20Sopenharmony_ci wl = hw->priv; 20148c2ecf20Sopenharmony_ci wl->ops = &wl18xx_ops; 20158c2ecf20Sopenharmony_ci wl->ptable = wl18xx_ptable; 20168c2ecf20Sopenharmony_ci ret = wlcore_probe(wl, pdev); 20178c2ecf20Sopenharmony_ci if (ret) 20188c2ecf20Sopenharmony_ci goto out_free; 20198c2ecf20Sopenharmony_ci 20208c2ecf20Sopenharmony_ci return ret; 20218c2ecf20Sopenharmony_ci 20228c2ecf20Sopenharmony_ciout_free: 20238c2ecf20Sopenharmony_ci wlcore_free_hw(wl); 20248c2ecf20Sopenharmony_ciout: 20258c2ecf20Sopenharmony_ci return ret; 20268c2ecf20Sopenharmony_ci} 20278c2ecf20Sopenharmony_ci 20288c2ecf20Sopenharmony_cistatic const struct platform_device_id wl18xx_id_table[] = { 20298c2ecf20Sopenharmony_ci { "wl18xx", 0 }, 20308c2ecf20Sopenharmony_ci { } /* Terminating Entry */ 20318c2ecf20Sopenharmony_ci}; 20328c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(platform, wl18xx_id_table); 20338c2ecf20Sopenharmony_ci 20348c2ecf20Sopenharmony_cistatic struct platform_driver wl18xx_driver = { 20358c2ecf20Sopenharmony_ci .probe = wl18xx_probe, 20368c2ecf20Sopenharmony_ci .remove = wlcore_remove, 20378c2ecf20Sopenharmony_ci .id_table = wl18xx_id_table, 20388c2ecf20Sopenharmony_ci .driver = { 20398c2ecf20Sopenharmony_ci .name = "wl18xx_driver", 20408c2ecf20Sopenharmony_ci } 20418c2ecf20Sopenharmony_ci}; 20428c2ecf20Sopenharmony_ci 20438c2ecf20Sopenharmony_cimodule_platform_driver(wl18xx_driver); 20448c2ecf20Sopenharmony_cimodule_param_named(ht_mode, ht_mode_param, charp, 0400); 20458c2ecf20Sopenharmony_ciMODULE_PARM_DESC(ht_mode, "Force HT mode: wide or siso20"); 20468c2ecf20Sopenharmony_ci 20478c2ecf20Sopenharmony_cimodule_param_named(board_type, board_type_param, charp, 0400); 20488c2ecf20Sopenharmony_ciMODULE_PARM_DESC(board_type, "Board type: fpga, hdk (default), evb, com8 or " 20498c2ecf20Sopenharmony_ci "dvp"); 20508c2ecf20Sopenharmony_ci 20518c2ecf20Sopenharmony_cimodule_param_named(checksum, checksum_param, bool, 0400); 20528c2ecf20Sopenharmony_ciMODULE_PARM_DESC(checksum, "Enable TCP checksum: boolean (defaults to false)"); 20538c2ecf20Sopenharmony_ci 20548c2ecf20Sopenharmony_cimodule_param_named(dc2dc, dc2dc_param, int, 0400); 20558c2ecf20Sopenharmony_ciMODULE_PARM_DESC(dc2dc, "External DC2DC: u8 (defaults to 0)"); 20568c2ecf20Sopenharmony_ci 20578c2ecf20Sopenharmony_cimodule_param_named(n_antennas_2, n_antennas_2_param, int, 0400); 20588c2ecf20Sopenharmony_ciMODULE_PARM_DESC(n_antennas_2, 20598c2ecf20Sopenharmony_ci "Number of installed 2.4GHz antennas: 1 (default) or 2"); 20608c2ecf20Sopenharmony_ci 20618c2ecf20Sopenharmony_cimodule_param_named(n_antennas_5, n_antennas_5_param, int, 0400); 20628c2ecf20Sopenharmony_ciMODULE_PARM_DESC(n_antennas_5, 20638c2ecf20Sopenharmony_ci "Number of installed 5GHz antennas: 1 (default) or 2"); 20648c2ecf20Sopenharmony_ci 20658c2ecf20Sopenharmony_cimodule_param_named(low_band_component, low_band_component_param, int, 0400); 20668c2ecf20Sopenharmony_ciMODULE_PARM_DESC(low_band_component, "Low band component: u8 " 20678c2ecf20Sopenharmony_ci "(default is 0x01)"); 20688c2ecf20Sopenharmony_ci 20698c2ecf20Sopenharmony_cimodule_param_named(low_band_component_type, low_band_component_type_param, 20708c2ecf20Sopenharmony_ci int, 0400); 20718c2ecf20Sopenharmony_ciMODULE_PARM_DESC(low_band_component_type, "Low band component type: u8 " 20728c2ecf20Sopenharmony_ci "(default is 0x05 or 0x06 depending on the board_type)"); 20738c2ecf20Sopenharmony_ci 20748c2ecf20Sopenharmony_cimodule_param_named(high_band_component, high_band_component_param, int, 0400); 20758c2ecf20Sopenharmony_ciMODULE_PARM_DESC(high_band_component, "High band component: u8, " 20768c2ecf20Sopenharmony_ci "(default is 0x01)"); 20778c2ecf20Sopenharmony_ci 20788c2ecf20Sopenharmony_cimodule_param_named(high_band_component_type, high_band_component_type_param, 20798c2ecf20Sopenharmony_ci int, 0400); 20808c2ecf20Sopenharmony_ciMODULE_PARM_DESC(high_band_component_type, "High band component type: u8 " 20818c2ecf20Sopenharmony_ci "(default is 0x09)"); 20828c2ecf20Sopenharmony_ci 20838c2ecf20Sopenharmony_cimodule_param_named(pwr_limit_reference_11_abg, 20848c2ecf20Sopenharmony_ci pwr_limit_reference_11_abg_param, int, 0400); 20858c2ecf20Sopenharmony_ciMODULE_PARM_DESC(pwr_limit_reference_11_abg, "Power limit reference: u8 " 20868c2ecf20Sopenharmony_ci "(default is 0xc8)"); 20878c2ecf20Sopenharmony_ci 20888c2ecf20Sopenharmony_cimodule_param_named(num_rx_desc, num_rx_desc_param, int, 0400); 20898c2ecf20Sopenharmony_ciMODULE_PARM_DESC(num_rx_desc_param, 20908c2ecf20Sopenharmony_ci "Number of Rx descriptors: u8 (default is 32)"); 20918c2ecf20Sopenharmony_ci 20928c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 20938c2ecf20Sopenharmony_ciMODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); 20948c2ecf20Sopenharmony_ciMODULE_FIRMWARE(WL18XX_FW_NAME); 2095