aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorIdo Yariv <ido@wizery.com>2011-06-06 07:57:04 -0400
committerLuciano Coelho <coelho@ti.com>2011-06-27 08:05:14 -0400
commit842f1a6c71551ac10fbdff4a4e65821228df9ea7 (patch)
tree4a63174b2777c0e3c0eceeb693bf9ed79f09c139 /drivers/net
parent92ef8960aee2f840c6a54c968d40199843f015c0 (diff)
wl12xx: Check for FW quirks as soon as the FW boots
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/wl12xx/boot.c21
-rw-r--r--drivers/net/wireless/wl12xx/main.c23
2 files changed, 21 insertions, 23 deletions
diff --git a/drivers/net/wireless/wl12xx/boot.c b/drivers/net/wireless/wl12xx/boot.c
index 9dcfc6d1e865..2f0fb6a5bfdb 100644
--- a/drivers/net/wireless/wl12xx/boot.c
+++ b/drivers/net/wireless/wl12xx/boot.c
@@ -102,6 +102,24 @@ static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag)
102 wl1271_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl); 102 wl1271_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl);
103} 103}
104 104
105static unsigned int wl12xx_get_fw_ver_quirks(struct wl1271 *wl)
106{
107 unsigned int quirks = 0;
108 unsigned int *fw_ver = wl->chip.fw_ver;
109
110 /* Only for wl127x */
111 if ((fw_ver[FW_VER_CHIP] == FW_VER_CHIP_WL127X) &&
112 /* Check STA version */
113 (((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_STA) &&
114 (fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_STA_MIN)) ||
115 /* Check AP version */
116 ((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_AP) &&
117 (fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_AP_MIN))))
118 quirks |= WL12XX_QUIRK_USE_2_SPARE_BLOCKS;
119
120 return quirks;
121}
122
105static void wl1271_parse_fw_ver(struct wl1271 *wl) 123static void wl1271_parse_fw_ver(struct wl1271 *wl)
106{ 124{
107 int ret; 125 int ret;
@@ -116,6 +134,9 @@ static void wl1271_parse_fw_ver(struct wl1271 *wl)
116 memset(wl->chip.fw_ver, 0, sizeof(wl->chip.fw_ver)); 134 memset(wl->chip.fw_ver, 0, sizeof(wl->chip.fw_ver));
117 return; 135 return;
118 } 136 }
137
138 /* Check if any quirks are needed with older fw versions */
139 wl->quirks |= wl12xx_get_fw_ver_quirks(wl);
119} 140}
120 141
121static void wl1271_boot_fw_version(struct wl1271 *wl) 142static void wl1271_boot_fw_version(struct wl1271 *wl)
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index ab3aa45db07b..2c03b4716d3f 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1251,24 +1251,6 @@ out:
1251 return ret; 1251 return ret;
1252} 1252}
1253 1253
1254static unsigned int wl1271_get_fw_ver_quirks(struct wl1271 *wl)
1255{
1256 unsigned int quirks = 0;
1257 unsigned int *fw_ver = wl->chip.fw_ver;
1258
1259 /* Only for wl127x */
1260 if ((fw_ver[FW_VER_CHIP] == FW_VER_CHIP_WL127X) &&
1261 /* Check STA version */
1262 (((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_STA) &&
1263 (fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_STA_MIN)) ||
1264 /* Check AP version */
1265 ((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_AP) &&
1266 (fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_AP_MIN))))
1267 quirks |= WL12XX_QUIRK_USE_2_SPARE_BLOCKS;
1268
1269 return quirks;
1270}
1271
1272int wl1271_plt_start(struct wl1271 *wl) 1254int wl1271_plt_start(struct wl1271 *wl)
1273{ 1255{
1274 int retries = WL1271_BOOT_RETRIES; 1256 int retries = WL1271_BOOT_RETRIES;
@@ -1305,8 +1287,6 @@ int wl1271_plt_start(struct wl1271 *wl)
1305 wl1271_notice("firmware booted in PLT mode (%s)", 1287 wl1271_notice("firmware booted in PLT mode (%s)",
1306 wl->chip.fw_ver_str); 1288 wl->chip.fw_ver_str);
1307 1289
1308 /* Check if any quirks are needed with older fw versions */
1309 wl->quirks |= wl1271_get_fw_ver_quirks(wl);
1310 goto out; 1290 goto out;
1311 1291
1312irq_disable: 1292irq_disable:
@@ -1794,9 +1774,6 @@ power_off:
1794 strncpy(wiphy->fw_version, wl->chip.fw_ver_str, 1774 strncpy(wiphy->fw_version, wl->chip.fw_ver_str,
1795 sizeof(wiphy->fw_version)); 1775 sizeof(wiphy->fw_version));
1796 1776
1797 /* Check if any quirks are needed with older fw versions */
1798 wl->quirks |= wl1271_get_fw_ver_quirks(wl);
1799
1800 /* 1777 /*
1801 * Now we know if 11a is supported (info from the NVS), so disable 1778 * Now we know if 11a is supported (info from the NVS), so disable
1802 * 11a channels if not supported 1779 * 11a channels if not supported