Commit 8675f9ab authored by Luciano Coelho's avatar Luciano Coelho

wlcore/wl12xx/wl18xx: verify multi-role and single-role fw versions

Previously we were only checking the single-role firmware version.
Now add code to check for the firmware versions separately for each
firmware type.
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent b3ec9cf2
......@@ -653,9 +653,11 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
/* read data preparation is only needed by wl127x */
wl->ops->prepare_read = wl127x_prepare_read;
wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER, WL127X_IFTYPE_VER,
WL127X_MAJOR_VER, WL127X_SUBTYPE_VER,
WL127X_MINOR_VER);
wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER,
WL127X_IFTYPE_SR_VER, WL127X_MAJOR_SR_VER,
WL127X_SUBTYPE_SR_VER, WL127X_MINOR_SR_VER,
WL127X_IFTYPE_MR_VER, WL127X_MAJOR_MR_VER,
WL127X_SUBTYPE_MR_VER, WL127X_MINOR_MR_VER);
break;
case CHIP_ID_127X_PG20:
......@@ -675,9 +677,11 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
/* read data preparation is only needed by wl127x */
wl->ops->prepare_read = wl127x_prepare_read;
wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER, WL127X_IFTYPE_VER,
WL127X_MAJOR_VER, WL127X_SUBTYPE_VER,
WL127X_MINOR_VER);
wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER,
WL127X_IFTYPE_SR_VER, WL127X_MAJOR_SR_VER,
WL127X_SUBTYPE_SR_VER, WL127X_MINOR_SR_VER,
WL127X_IFTYPE_MR_VER, WL127X_MAJOR_MR_VER,
WL127X_SUBTYPE_MR_VER, WL127X_MINOR_MR_VER);
break;
case CHIP_ID_128X_PG20:
......@@ -693,9 +697,11 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
WLCORE_QUIRK_TKIP_HEADER_SPACE |
WLCORE_QUIRK_START_STA_FAILS;
wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER, WL128X_IFTYPE_VER,
WL128X_MAJOR_VER, WL128X_SUBTYPE_VER,
WL128X_MINOR_VER);
wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER,
WL128X_IFTYPE_SR_VER, WL128X_MAJOR_SR_VER,
WL128X_SUBTYPE_SR_VER, WL128X_MINOR_SR_VER,
WL128X_IFTYPE_MR_VER, WL128X_MAJOR_MR_VER,
WL128X_SUBTYPE_MR_VER, WL128X_MINOR_MR_VER);
break;
case CHIP_ID_128X_PG10:
default:
......
......@@ -30,19 +30,31 @@
#define CHIP_ID_128X_PG10 (0x05030101)
#define CHIP_ID_128X_PG20 (0x05030111)
/* minimum FW required for driver for wl127x */
/* FW chip version for wl127x */
#define WL127X_CHIP_VER 6
#define WL127X_IFTYPE_VER WLCORE_FW_VER_IGNORE
#define WL127X_MAJOR_VER 10
#define WL127X_SUBTYPE_VER WLCORE_FW_VER_IGNORE
#define WL127X_MINOR_VER 115
/* minimum single-role FW version for wl127x */
#define WL127X_IFTYPE_SR_VER 3
#define WL127X_MAJOR_SR_VER 10
#define WL127X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE
#define WL127X_MINOR_SR_VER 115
/* minimum multi-role FW version for wl127x */
#define WL127X_IFTYPE_MR_VER 5
#define WL127X_MAJOR_MR_VER 7
#define WL127X_SUBTYPE_MR_VER WLCORE_FW_VER_IGNORE
#define WL127X_MINOR_MR_VER 115
/* minimum FW required for driver for wl128x */
/* FW chip version for wl128x */
#define WL128X_CHIP_VER 7
#define WL128X_IFTYPE_VER WLCORE_FW_VER_IGNORE
#define WL128X_MAJOR_VER 10
#define WL128X_SUBTYPE_VER WLCORE_FW_VER_IGNORE
#define WL128X_MINOR_VER 115
/* minimum single-role FW version for wl128x */
#define WL128X_IFTYPE_SR_VER 3
#define WL128X_MAJOR_SR_VER 10
#define WL128X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE
#define WL128X_MINOR_SR_VER 115
/* minimum multi-role FW version for wl128x */
#define WL128X_IFTYPE_MR_VER 5
#define WL128X_MAJOR_MR_VER 7
#define WL128X_SUBTYPE_MR_VER WLCORE_FW_VER_IGNORE
#define WL128X_MINOR_MR_VER 42
#define WL12XX_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
......
......@@ -623,9 +623,11 @@ static int wl18xx_identify_chip(struct wl1271 *wl)
WLCORE_QUIRK_REGDOMAIN_CONF |
WLCORE_QUIRK_DUAL_PROBE_TMPL;
wlcore_set_min_fw_ver(wl, WL18XX_CHIP_VER, WL18XX_IFTYPE_VER,
WL18XX_MAJOR_VER, WL18XX_SUBTYPE_VER,
WL18XX_MINOR_VER);
wlcore_set_min_fw_ver(wl, WL18XX_CHIP_VER,
WL18XX_IFTYPE_VER, WL18XX_MAJOR_VER,
WL18XX_SUBTYPE_VER, WL18XX_MINOR_VER,
/* there's no separate multi-role FW */
0, 0, 0, 0);
break;
case CHIP_ID_185x_PG10:
wl1271_warning("chip id 0x%x (185x PG10) is deprecated",
......
......@@ -84,7 +84,8 @@ static int wlcore_boot_parse_fw_ver(struct wl1271 *wl,
static int wlcore_validate_fw_ver(struct wl1271 *wl)
{
unsigned int *fw_ver = wl->chip.fw_ver;
unsigned int *min_ver = wl->min_fw_ver;
unsigned int *min_ver = (wl->fw_type == WL12XX_FW_TYPE_NORMAL) ?
wl->min_sr_fw_ver : wl->min_mr_fw_ver;
char min_fw_str[32] = "";
int i;
......
......@@ -439,8 +439,11 @@ struct wl1271 {
/* the number of allocated MAC addresses in this chip */
int num_mac_addr;
/* the minimum FW version required for the driver to work */
unsigned int min_fw_ver[NUM_FW_VER];
/* minimum FW version required for the driver to work in single-role */
unsigned int min_sr_fw_ver[NUM_FW_VER];
/* minimum FW version required for the driver to work in multi-role */
unsigned int min_mr_fw_ver[NUM_FW_VER];
struct completion nvs_loading_complete;
......@@ -471,14 +474,22 @@ wlcore_set_ht_cap(struct wl1271 *wl, enum ieee80211_band band,
static inline void
wlcore_set_min_fw_ver(struct wl1271 *wl, unsigned int chip,
unsigned int iftype, unsigned int major,
unsigned int subtype, unsigned int minor)
unsigned int iftype_sr, unsigned int major_sr,
unsigned int subtype_sr, unsigned int minor_sr,
unsigned int iftype_mr, unsigned int major_mr,
unsigned int subtype_mr, unsigned int minor_mr)
{
wl->min_fw_ver[FW_VER_CHIP] = chip;
wl->min_fw_ver[FW_VER_IF_TYPE] = iftype;
wl->min_fw_ver[FW_VER_MAJOR] = major;
wl->min_fw_ver[FW_VER_SUBTYPE] = subtype;
wl->min_fw_ver[FW_VER_MINOR] = minor;
wl->min_sr_fw_ver[FW_VER_CHIP] = chip;
wl->min_sr_fw_ver[FW_VER_IF_TYPE] = iftype_sr;
wl->min_sr_fw_ver[FW_VER_MAJOR] = major_sr;
wl->min_sr_fw_ver[FW_VER_SUBTYPE] = subtype_sr;
wl->min_sr_fw_ver[FW_VER_MINOR] = minor_sr;
wl->min_mr_fw_ver[FW_VER_CHIP] = chip;
wl->min_mr_fw_ver[FW_VER_IF_TYPE] = iftype_mr;
wl->min_mr_fw_ver[FW_VER_MAJOR] = major_mr;
wl->min_mr_fw_ver[FW_VER_SUBTYPE] = subtype_mr;
wl->min_mr_fw_ver[FW_VER_MINOR] = minor_mr;
}
/* Firmware image load chunk size */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment