Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314171
b: refs/heads/master
c: 640dfb9
h: refs/heads/master
i:
  314169: 880baf3
  314167: 03edac3
v: v3
  • Loading branch information
Luciano Coelho committed Jun 8, 2012
1 parent 92682ed commit 08dd446
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 6 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: 18b70ac9c7fd640cbd5921b5ca2705db0f8b9d83
refs/heads/master: 640dfb9b85bc80c607c07531dc5428418ef39974
68 changes: 63 additions & 5 deletions trunk/drivers/net/wireless/ti/wl18xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/ip.h>
#include <linux/firmware.h>

#include "../wlcore/wlcore.h"
#include "../wlcore/debug.h"
Expand Down Expand Up @@ -1046,15 +1047,65 @@ static s8 wl18xx_get_pg_ver(struct wl1271 *wl)
return (s8)fuse;
}

static void wl18xx_conf_init(struct wl1271 *wl)
#define WL18XX_CONF_FILE_NAME "ti-connectivity/wl18xx-conf.bin"
static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev)
{
struct wl18xx_priv *priv = wl->priv;
struct wlcore_conf_file *conf_file;
const struct firmware *fw;
int ret;

ret = request_firmware(&fw, WL18XX_CONF_FILE_NAME, dev);
if (ret < 0) {
wl1271_error("could not get configuration binary %s: %d",
WL18XX_CONF_FILE_NAME, ret);
goto out_fallback;
}

if (fw->size != WL18XX_CONF_SIZE) {
wl1271_error("configuration binary file size is wrong, "
"expected %d got %d", WL18XX_CONF_SIZE, fw->size);
ret = -EINVAL;
goto out;
}

conf_file = (struct wlcore_conf_file *) fw->data;

if (conf_file->header.magic != cpu_to_le32(WL18XX_CONF_MAGIC)) {
wl1271_error("configuration binary file magic number mismatch, "
"expected 0x%0x got 0x%0x", WL18XX_CONF_MAGIC,
conf_file->header.magic);
ret = -EINVAL;
goto out;
}

if (conf_file->header.version != cpu_to_le32(WL18XX_CONF_VERSION)) {
wl1271_error("configuration binary file version not supported, "
"expected 0x%08x got 0x%08x",
WL18XX_CONF_VERSION, conf_file->header.version);
ret = -EINVAL;
goto out;
}

memcpy(&wl->conf, &conf_file->core, sizeof(wl18xx_conf));
memcpy(&priv->conf, &conf_file->priv, sizeof(priv->conf));

goto out;

out_fallback:
wl1271_warning("falling back to default config");

/* apply driver default configuration */
memcpy(&wl->conf, &wl18xx_conf, sizeof(wl18xx_conf));

/* apply default private configuration */
memcpy(&priv->conf, &wl18xx_default_priv_conf, sizeof(priv->conf));

/* For now we just fallback */
return 0;

out:
release_firmware(fw);
return ret;
}

static int wl18xx_plt_init(struct wl1271 *wl)
Expand Down Expand Up @@ -1261,11 +1312,13 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)
struct wl1271 *wl;
struct ieee80211_hw *hw;
struct wl18xx_priv *priv;
int ret;

hw = wlcore_alloc_hw(sizeof(*priv));
if (IS_ERR(hw)) {
wl1271_error("can't allocate hw");
return PTR_ERR(hw);
ret = PTR_ERR(hw);
goto out;
}

wl = hw->priv;
Expand Down Expand Up @@ -1305,10 +1358,13 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)
sizeof(wl18xx_siso20_ht_cap));
} else {
wl1271_error("invalid ht_mode '%s'", ht_mode_param);
ret = -EINVAL;
goto out_free;
}

wl18xx_conf_init(wl);
ret = wl18xx_conf_init(wl, &pdev->dev);
if (ret < 0)
goto out_free;

if (!strcmp(board_type_param, "fpga")) {
priv->board_type = BOARD_TYPE_FPGA_18XX;
Expand All @@ -1326,6 +1382,7 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)
priv->conf.phy.low_band_component_type = 0x06;
} else {
wl1271_error("invalid board type '%s'", board_type_param);
ret = -EINVAL;
goto out_free;
}

Expand Down Expand Up @@ -1373,7 +1430,8 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)

out_free:
wlcore_free_hw(wl);
return -EINVAL;
out:
return ret;
}

static const struct platform_device_id wl18xx_id_table[] __devinitconst = {
Expand Down

0 comments on commit 08dd446

Please sign in to comment.