aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/boot.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/wl12xx/boot.c')
-rw-r--r--drivers/net/wireless/wl12xx/boot.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/net/wireless/wl12xx/boot.c b/drivers/net/wireless/wl12xx/boot.c
index d7e036f42958..1ffbad67d2d8 100644
--- a/drivers/net/wireless/wl12xx/boot.c
+++ b/drivers/net/wireless/wl12xx/boot.c
@@ -101,6 +101,22 @@ static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag)
101 wl1271_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl); 101 wl1271_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl);
102} 102}
103 103
104static void wl1271_parse_fw_ver(struct wl1271 *wl)
105{
106 int ret;
107
108 ret = sscanf(wl->chip.fw_ver_str + 4, "%u.%u.%u.%u.%u",
109 &wl->chip.fw_ver[0], &wl->chip.fw_ver[1],
110 &wl->chip.fw_ver[2], &wl->chip.fw_ver[3],
111 &wl->chip.fw_ver[4]);
112
113 if (ret != 5) {
114 wl1271_warning("fw version incorrect value");
115 memset(wl->chip.fw_ver, 0, sizeof(wl->chip.fw_ver));
116 return;
117 }
118}
119
104static void wl1271_boot_fw_version(struct wl1271 *wl) 120static void wl1271_boot_fw_version(struct wl1271 *wl)
105{ 121{
106 struct wl1271_static_data static_data; 122 struct wl1271_static_data static_data;
@@ -108,11 +124,13 @@ static void wl1271_boot_fw_version(struct wl1271 *wl)
108 wl1271_read(wl, wl->cmd_box_addr, &static_data, sizeof(static_data), 124 wl1271_read(wl, wl->cmd_box_addr, &static_data, sizeof(static_data),
109 false); 125 false);
110 126
111 strncpy(wl->chip.fw_ver, static_data.fw_version, 127 strncpy(wl->chip.fw_ver_str, static_data.fw_version,
112 sizeof(wl->chip.fw_ver)); 128 sizeof(wl->chip.fw_ver_str));
113 129
114 /* make sure the string is NULL-terminated */ 130 /* make sure the string is NULL-terminated */
115 wl->chip.fw_ver[sizeof(wl->chip.fw_ver) - 1] = '\0'; 131 wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0';
132
133 wl1271_parse_fw_ver(wl);
116} 134}
117 135
118static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, 136static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,