Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 300936
b: refs/heads/master
c: 80cd661
h: refs/heads/master
v: v3
  • Loading branch information
Luciano Coelho committed Apr 12, 2012
1 parent c322a3d commit 1464c2c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba421f8f9266a5dda86fb8ce7b814336ae1edadc
refs/heads/master: 80cd661097f3cb1dcfe45cac983c55d03cdcf64d
17 changes: 17 additions & 0 deletions trunk/drivers/net/wireless/ti/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,22 @@ static u32 wl12xx_sta_get_ap_rate_mask(struct wl1271 *wl,
return wlvif->rate_set;
}

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

/* Only new station firmwares support routing fw logs to the host */
if ((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_STA) &&
(fw_ver[FW_VER_MINOR] < FW_VER_MINOR_FWLOG_STA_MIN))
wl->quirks |= WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED;

/* This feature is not yet supported for AP mode */
if (fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_AP)
wl->quirks |= WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED;

return 0;
}

static void wl12xx_conf_init(struct wl1271 *wl)
{
struct wl12xx_priv *priv = wl->priv;
Expand Down Expand Up @@ -1274,6 +1290,7 @@ static void wl12xx_get_mac(struct wl1271 *wl)

static struct wlcore_ops wl12xx_ops = {
.identify_chip = wl12xx_identify_chip,
.identify_fw = wl12xx_identify_fw,
.boot = wl12xx_boot,
.trigger_cmd = wl12xx_trigger_cmd,
.ack_event = wl12xx_ack_event,
Expand Down
48 changes: 22 additions & 26 deletions trunk/drivers/net/wireless/ti/wlcore/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "io.h"
#include "event.h"
#include "rx.h"
#include "hw_ops.h"

static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag)
{
Expand All @@ -44,24 +45,7 @@ static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag)
wlcore_write_reg(wl, 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 new station firmwares support routing fw logs to the host */
if ((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_STA) &&
(fw_ver[FW_VER_MINOR] < FW_VER_MINOR_FWLOG_STA_MIN))
quirks |= WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED;

/* This feature is not yet supported for AP mode */
if (fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_AP)
quirks |= WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED;

return quirks;
}

static void wl1271_parse_fw_ver(struct wl1271 *wl)
static int wlcore_parse_fw_ver(struct wl1271 *wl)
{
int ret;

Expand All @@ -73,21 +57,25 @@ static void wl1271_parse_fw_ver(struct wl1271 *wl)
if (ret != 5) {
wl1271_warning("fw version incorrect value");
memset(wl->chip.fw_ver, 0, sizeof(wl->chip.fw_ver));
return;
return -EINVAL;
}

/* Check if any quirks are needed with older fw versions */
wl->quirks |= wl12xx_get_fw_ver_quirks(wl);
ret = wlcore_identify_fw(wl);
if (ret < 0)
return ret;

return 0;
}

static void wl1271_boot_fw_version(struct wl1271 *wl)
static int wlcore_boot_fw_version(struct wl1271 *wl)
{
struct wl1271_static_data *static_data;
int ret;

static_data = kmalloc(sizeof(*static_data), GFP_DMA);
if (!static_data) {
__WARN();
return;
wl1271_error("Couldn't allocate memory for static data!");
return -ENOMEM;
}

wl1271_read(wl, wl->cmd_box_addr, static_data, sizeof(*static_data),
Expand All @@ -101,7 +89,11 @@ static void wl1271_boot_fw_version(struct wl1271 *wl)
/* make sure the string is NULL-terminated */
wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0';

wl1271_parse_fw_ver(wl);
ret = wlcore_parse_fw_ver(wl);
if (ret < 0)
return ret;

return 0;
}

static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
Expand Down Expand Up @@ -408,7 +400,11 @@ int wlcore_boot_run_firmware(struct wl1271 *wl)
wl1271_debug(DEBUG_MAILBOX, "MBOX ptrs: 0x%x 0x%x",
wl->mbox_ptr[0], wl->mbox_ptr[1]);

wl1271_boot_fw_version(wl);
ret = wlcore_boot_fw_version(wl);
if (ret < 0) {
wl1271_error("couldn't boot firmware");
return ret;
}

/*
* in case of full asynchronous mode the firmware event must be
Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/net/wireless/ti/wlcore/hw_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,12 @@ wlcore_hw_sta_get_ap_rate_mask(struct wl1271 *wl, struct wl12xx_vif *wlvif)
return wl->ops->sta_get_ap_rate_mask(wl, wlvif);
}

static inline int wlcore_identify_fw(struct wl1271 *wl)
{
if (wl->ops->identify_fw)
return wl->ops->identify_fw(wl);

return 0;
}

#endif
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/ti/wlcore/wlcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ enum wl_rx_buf_align;

struct wlcore_ops {
int (*identify_chip)(struct wl1271 *wl);
int (*identify_fw)(struct wl1271 *wl);
int (*boot)(struct wl1271 *wl);
void (*trigger_cmd)(struct wl1271 *wl, int cmd_box_addr,
void *buf, size_t len);
Expand Down

0 comments on commit 1464c2c

Please sign in to comment.