wlcore/wl12xx: add quirk for legacy NVS support
Instead of checking the chip ID directly in the wlcore code to decide whether to use the new or the old NVS format, we now use a quirk that should be set by the low level driver to say that it needs to use the old format. Signed-off-by: Luciano Coelho <coelho@ti.com>
This commit is contained in:
parent
f16ff75872
commit
d203e59c4b
|
@ -151,7 +151,8 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
|
|||
wl1271_warning("chip id 0x%x (1271 PG10) support is obsolete",
|
||||
wl->chip.id);
|
||||
|
||||
wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT;
|
||||
wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT |
|
||||
WLCORE_QUIRK_LEGACY_NVS;
|
||||
wl->plt_fw_name = WL127X_PLT_FW_NAME;
|
||||
wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
|
||||
wl->mr_fw_name = WL127X_FW_NAME_MULTI;
|
||||
|
@ -161,7 +162,8 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
|
|||
wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)",
|
||||
wl->chip.id);
|
||||
|
||||
wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT;
|
||||
wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT |
|
||||
WLCORE_QUIRK_LEGACY_NVS;
|
||||
wl->plt_fw_name = WL127X_PLT_FW_NAME;
|
||||
wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
|
||||
wl->mr_fw_name = WL127X_FW_NAME_MULTI;
|
||||
|
|
|
@ -215,27 +215,7 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl)
|
|||
if (wl->nvs == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
if (wl->chip.id == CHIP_ID_1283_PG20) {
|
||||
struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs;
|
||||
|
||||
if (wl->nvs_len == sizeof(struct wl128x_nvs_file)) {
|
||||
if (nvs->general_params.dual_mode_select)
|
||||
wl->enable_11a = true;
|
||||
} else {
|
||||
wl1271_error("nvs size is not as expected: %zu != %zu",
|
||||
wl->nvs_len,
|
||||
sizeof(struct wl128x_nvs_file));
|
||||
kfree(wl->nvs);
|
||||
wl->nvs = NULL;
|
||||
wl->nvs_len = 0;
|
||||
return -EILSEQ;
|
||||
}
|
||||
|
||||
/* only the first part of the NVS needs to be uploaded */
|
||||
nvs_len = sizeof(nvs->nvs);
|
||||
nvs_ptr = (u8 *)nvs->nvs;
|
||||
|
||||
} else {
|
||||
if (wl->quirks & WLCORE_QUIRK_LEGACY_NVS) {
|
||||
struct wl1271_nvs_file *nvs =
|
||||
(struct wl1271_nvs_file *)wl->nvs;
|
||||
/*
|
||||
|
@ -263,6 +243,25 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl)
|
|||
/* only the first part of the NVS needs to be uploaded */
|
||||
nvs_len = sizeof(nvs->nvs);
|
||||
nvs_ptr = (u8 *) nvs->nvs;
|
||||
} else {
|
||||
struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs;
|
||||
|
||||
if (wl->nvs_len == sizeof(struct wl128x_nvs_file)) {
|
||||
if (nvs->general_params.dual_mode_select)
|
||||
wl->enable_11a = true;
|
||||
} else {
|
||||
wl1271_error("nvs size is not as expected: %zu != %zu",
|
||||
wl->nvs_len,
|
||||
sizeof(struct wl128x_nvs_file));
|
||||
kfree(wl->nvs);
|
||||
wl->nvs = NULL;
|
||||
wl->nvs_len = 0;
|
||||
return -EILSEQ;
|
||||
}
|
||||
|
||||
/* only the first part of the NVS needs to be uploaded */
|
||||
nvs_len = sizeof(nvs->nvs);
|
||||
nvs_ptr = (u8 *)nvs->nvs;
|
||||
}
|
||||
|
||||
/* update current MAC address to NVS */
|
||||
|
|
|
@ -322,6 +322,9 @@ int wlcore_free_hw(struct wl1271 *wl);
|
|||
/* Older firmwares did not implement the FW logger over bus feature */
|
||||
#define WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED BIT(4)
|
||||
|
||||
/* Older firmwares use an old NVS format */
|
||||
#define WLCORE_QUIRK_LEGACY_NVS BIT(5)
|
||||
|
||||
/* TODO: move to the lower drivers when all usages are abstracted */
|
||||
#define CHIP_ID_1271_PG10 (0x4030101)
|
||||
#define CHIP_ID_1271_PG20 (0x4030111)
|
||||
|
|
Loading…
Reference in New Issue