Skip to content

Commit

Permalink
wl12xx: Check for FW quirks as soon as the FW boots
Browse files Browse the repository at this point in the history
The FW initialization might depend on the FW revision, so check for any
FW quirks right after booting it.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information
Ido Yariv authored and Luciano Coelho committed Jun 27, 2011
1 parent 92ef896 commit 842f1a6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
21 changes: 21 additions & 0 deletions drivers/net/wireless/wl12xx/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,24 @@ static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag)
wl1271_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl);
}

static unsigned int wl12xx_get_fw_ver_quirks(struct wl1271 *wl)
{
unsigned int quirks = 0;
unsigned int *fw_ver = wl->chip.fw_ver;

/* Only for wl127x */
if ((fw_ver[FW_VER_CHIP] == FW_VER_CHIP_WL127X) &&
/* Check STA version */
(((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_STA) &&
(fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_STA_MIN)) ||
/* Check AP version */
((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_AP) &&
(fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_AP_MIN))))
quirks |= WL12XX_QUIRK_USE_2_SPARE_BLOCKS;

return quirks;
}

static void wl1271_parse_fw_ver(struct wl1271 *wl)
{
int ret;
Expand All @@ -116,6 +134,9 @@ static void wl1271_parse_fw_ver(struct wl1271 *wl)
memset(wl->chip.fw_ver, 0, sizeof(wl->chip.fw_ver));
return;
}

/* Check if any quirks are needed with older fw versions */
wl->quirks |= wl12xx_get_fw_ver_quirks(wl);
}

static void wl1271_boot_fw_version(struct wl1271 *wl)
Expand Down
23 changes: 0 additions & 23 deletions drivers/net/wireless/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,24 +1251,6 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
return ret;
}

static unsigned int wl1271_get_fw_ver_quirks(struct wl1271 *wl)
{
unsigned int quirks = 0;
unsigned int *fw_ver = wl->chip.fw_ver;

/* Only for wl127x */
if ((fw_ver[FW_VER_CHIP] == FW_VER_CHIP_WL127X) &&
/* Check STA version */
(((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_STA) &&
(fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_STA_MIN)) ||
/* Check AP version */
((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_AP) &&
(fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_AP_MIN))))
quirks |= WL12XX_QUIRK_USE_2_SPARE_BLOCKS;

return quirks;
}

int wl1271_plt_start(struct wl1271 *wl)
{
int retries = WL1271_BOOT_RETRIES;
Expand Down Expand Up @@ -1305,8 +1287,6 @@ int wl1271_plt_start(struct wl1271 *wl)
wl1271_notice("firmware booted in PLT mode (%s)",
wl->chip.fw_ver_str);

/* Check if any quirks are needed with older fw versions */
wl->quirks |= wl1271_get_fw_ver_quirks(wl);
goto out;

irq_disable:
Expand Down Expand Up @@ -1794,9 +1774,6 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
strncpy(wiphy->fw_version, wl->chip.fw_ver_str,
sizeof(wiphy->fw_version));

/* Check if any quirks are needed with older fw versions */
wl->quirks |= wl1271_get_fw_ver_quirks(wl);

/*
* Now we know if 11a is supported (info from the NVS), so disable
* 11a channels if not supported
Expand Down

0 comments on commit 842f1a6

Please sign in to comment.