Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314111
b: refs/heads/master
c: 7140df6
h: refs/heads/master
i:
  314109: 6944cb4
  314107: 0816ddf
  314103: f6187a6
  314095: 3748213
  314079: 627655e
  314047: 84e2dcb
  313983: db36d0b
  313855: f842579
v: v3
  • Loading branch information
Luciano Coelho committed Jun 5, 2012
1 parent 7299584 commit 36bccb5
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 24 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: 8c0ea1021c38cfd2f0ba5d8fdd48a9e9827bbc03
refs/heads/master: 7140df6e51ecca70e8963f18e9836e62090221c2
53 changes: 30 additions & 23 deletions trunk/drivers/net/wireless/ti/wlcore/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,17 @@ static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag)
wlcore_write_reg(wl, REG_ECPU_CONTROL, cpu_ctrl);
}

static int wlcore_parse_fw_ver(struct wl1271 *wl)
static int wlcore_boot_parse_fw_ver(struct wl1271 *wl,
struct wl1271_static_data *static_data)
{
int ret;

strncpy(wl->chip.fw_ver_str, static_data->fw_version,
sizeof(wl->chip.fw_ver_str));

/* make sure the string is NULL-terminated */
wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0';

ret = sscanf(wl->chip.fw_ver_str + 4, "%u.%u.%u.%u.%u",
&wl->chip.fw_ver[0], &wl->chip.fw_ver[1],
&wl->chip.fw_ver[2], &wl->chip.fw_ver[3],
Expand All @@ -57,43 +64,43 @@ static int wlcore_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 -EINVAL;
ret = -EINVAL;
goto out;
}

ret = wlcore_identify_fw(wl);
if (ret < 0)
return ret;

return 0;
goto out;
out:
return ret;
}

static int wlcore_boot_fw_version(struct wl1271 *wl)
static int wlcore_boot_static_data(struct wl1271 *wl)
{
struct wl1271_static_data *static_data;
size_t len = sizeof(*static_data) + wl->static_data_priv_len;
int ret;

static_data = kmalloc(sizeof(*static_data), GFP_KERNEL | GFP_DMA);
static_data = kmalloc(len, GFP_KERNEL);
if (!static_data) {
wl1271_error("Couldn't allocate memory for static data!");
return -ENOMEM;
ret = -ENOMEM;
goto out;
}

wl1271_read(wl, wl->cmd_box_addr, static_data, sizeof(*static_data),
false);
wl1271_read(wl, wl->cmd_box_addr, static_data, len, false);

strncpy(wl->chip.fw_ver_str, static_data->fw_version,
sizeof(wl->chip.fw_ver_str));

kfree(static_data);

/* make sure the string is NULL-terminated */
wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0';
ret = wlcore_boot_parse_fw_ver(wl, static_data);
if (ret < 0)
goto out_free;

ret = wlcore_parse_fw_ver(wl);
ret = wlcore_handle_static_data(wl, static_data);
if (ret < 0)
return ret;
goto out_free;

return 0;
out_free:
kfree(static_data);
out:
return ret;
}

static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
Expand Down Expand Up @@ -400,9 +407,9 @@ 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]);

ret = wlcore_boot_fw_version(wl);
ret = wlcore_boot_static_data(wl);
if (ret < 0) {
wl1271_error("couldn't boot firmware");
wl1271_error("error getting static data");
return ret;
}

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/ti/wlcore/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct wl1271_static_data {
u8 fw_version[WL1271_FW_VERSION_MAX_LEN];
u32 hw_version;
u8 tx_power_table[WL1271_NO_SUBBANDS][WL1271_NO_POWER_LEVELS];
u8 priv[0];
};

/* number of times we try to read the INIT interrupt */
Expand Down
9 changes: 9 additions & 0 deletions trunk/drivers/net/wireless/ti/wlcore/hw_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,13 @@ wlcore_debugfs_init(struct wl1271 *wl, struct dentry *rootdir)
return 0;
}

static inline int
wlcore_handle_static_data(struct wl1271 *wl, void *static_data)
{
if (wl->ops->handle_static_data)
return wl->ops->handle_static_data(wl, static_data);

return 0;
}

#endif
6 changes: 6 additions & 0 deletions trunk/drivers/net/wireless/ti/wlcore/wlcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "wlcore_i.h"
#include "event.h"
#include "boot.h"

/* The maximum number of Tx descriptors in all chip families */
#define WLCORE_MAX_TX_DESCRIPTORS 32
Expand Down Expand Up @@ -72,6 +73,8 @@ struct wlcore_ops {
u32 (*ap_get_mimo_wide_rate_mask)(struct wl1271 *wl,
struct wl12xx_vif *wlvif);
int (*debugfs_init)(struct wl1271 *wl, struct dentry *rootdir);
int (*handle_static_data)(struct wl1271 *wl,
struct wl1271_static_data *static_data);
};

enum wlcore_partitions {
Expand Down Expand Up @@ -373,6 +376,9 @@ struct wl1271 {
/* RX Data filter rule state - enabled/disabled */
bool rx_filter_enabled[WL1271_MAX_RX_FILTERS];

/* size of the private static data */
size_t static_data_priv_len;

/* the current channel type */
enum nl80211_channel_type channel_type;
};
Expand Down

0 comments on commit 36bccb5

Please sign in to comment.