Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wlcore/wl12xx: add support for HP and SKW FEM radio manufacturers

Add support for HP (High Performance TQS fem type 3) and SKW
(fem type 2). This is done by increasing the number of FEM
manufacturers to 4.

Usually FEM parameters from ini file are read from nvs file and
passed to firmware using TEST_CMD_INI_FILE_RADIO_PARAM. Still,
because the nvs file has only place for 2 FEMs, we need to pass the
new FEM types information in one of the available entries.

This is done by mapping new fem types 2,3 to entry 0. This solution
works for manual FEM selection. AutoDetect-FEM still support only
fem types 0 and 1.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>

authored by

Yair Shapira and committed by
Luciano Coelho
05f48d45 2812eef1

+27 -11
+10 -6
drivers/net/wireless/ti/wl12xx/cmd.c
··· 174 174 struct wl1271_nvs_file *nvs = (struct wl1271_nvs_file *)wl->nvs; 175 175 struct wl1271_radio_parms_cmd *radio_parms; 176 176 struct wl1271_ini_general_params *gp = &nvs->general_params; 177 - int ret; 177 + int ret, fem_idx; 178 178 179 179 if (!wl->nvs) 180 180 return -ENODEV; ··· 185 185 186 186 radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; 187 187 188 + fem_idx = WL12XX_FEM_TO_NVS_ENTRY(gp->tx_bip_fem_manufacturer); 189 + 188 190 /* 2.4GHz parameters */ 189 191 memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, 190 192 sizeof(struct wl1271_ini_band_params_2)); 191 193 memcpy(&radio_parms->dyn_params_2, 192 - &nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, 194 + &nvs->dyn_radio_params_2[fem_idx].params, 193 195 sizeof(struct wl1271_ini_fem_params_2)); 194 196 195 197 /* 5GHz parameters */ ··· 199 197 &nvs->stat_radio_params_5, 200 198 sizeof(struct wl1271_ini_band_params_5)); 201 199 memcpy(&radio_parms->dyn_params_5, 202 - &nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, 200 + &nvs->dyn_radio_params_5[fem_idx].params, 203 201 sizeof(struct wl1271_ini_fem_params_5)); 204 202 205 203 wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", ··· 218 216 struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs; 219 217 struct wl128x_radio_parms_cmd *radio_parms; 220 218 struct wl128x_ini_general_params *gp = &nvs->general_params; 221 - int ret; 219 + int ret, fem_idx; 222 220 223 221 if (!wl->nvs) 224 222 return -ENODEV; ··· 229 227 230 228 radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; 231 229 230 + fem_idx = WL12XX_FEM_TO_NVS_ENTRY(gp->tx_bip_fem_manufacturer); 231 + 232 232 /* 2.4GHz parameters */ 233 233 memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, 234 234 sizeof(struct wl128x_ini_band_params_2)); 235 235 memcpy(&radio_parms->dyn_params_2, 236 - &nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, 236 + &nvs->dyn_radio_params_2[fem_idx].params, 237 237 sizeof(struct wl128x_ini_fem_params_2)); 238 238 239 239 /* 5GHz parameters */ ··· 243 239 &nvs->stat_radio_params_5, 244 240 sizeof(struct wl128x_ini_band_params_5)); 245 241 memcpy(&radio_parms->dyn_params_5, 246 - &nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, 242 + &nvs->dyn_radio_params_5[fem_idx].params, 247 243 sizeof(struct wl128x_ini_fem_params_5)); 248 244 249 245 radio_parms->fem_vendor_and_options = nvs->fem_vendor_and_options;
+17 -5
drivers/net/wireless/ti/wlcore/ini.h
··· 172 172 173 173 /* NVS data structure */ 174 174 #define WL1271_INI_NVS_SECTION_SIZE 468 175 - #define WL1271_INI_FEM_MODULE_COUNT 2 175 + 176 + /* We have four FEM module types: 0-RFMD, 1-TQS, 2-SKW, 3-TQS_HP */ 177 + #define WL1271_INI_FEM_MODULE_COUNT 4 178 + 179 + /* 180 + * In NVS we only store two FEM module entries - 181 + * FEM modules 0,2,3 are stored in entry 0 182 + * FEM module 1 is stored in entry 1 183 + */ 184 + #define WL12XX_NVS_FEM_MODULE_COUNT 2 185 + 186 + #define WL12XX_FEM_TO_NVS_ENTRY(ini_fem_module) \ 187 + ((ini_fem_module) == 1 ? 1 : 0) 176 188 177 189 #define WL1271_INI_LEGACY_NVS_FILE_SIZE 800 178 190 ··· 200 188 struct { 201 189 struct wl1271_ini_fem_params_2 params; 202 190 u8 padding; 203 - } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT]; 191 + } dyn_radio_params_2[WL12XX_NVS_FEM_MODULE_COUNT]; 204 192 struct wl1271_ini_band_params_5 stat_radio_params_5; 205 193 u8 padding3; 206 194 struct { 207 195 struct wl1271_ini_fem_params_5 params; 208 196 u8 padding; 209 - } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT]; 197 + } dyn_radio_params_5[WL12XX_NVS_FEM_MODULE_COUNT]; 210 198 } __packed; 211 199 212 200 struct wl128x_nvs_file { ··· 221 209 struct { 222 210 struct wl128x_ini_fem_params_2 params; 223 211 u8 padding; 224 - } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT]; 212 + } dyn_radio_params_2[WL12XX_NVS_FEM_MODULE_COUNT]; 225 213 struct wl128x_ini_band_params_5 stat_radio_params_5; 226 214 u8 padding3; 227 215 struct { 228 216 struct wl128x_ini_fem_params_5 params; 229 217 u8 padding; 230 - } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT]; 218 + } dyn_radio_params_5[WL12XX_NVS_FEM_MODULE_COUNT]; 231 219 } __packed; 232 220 #endif