Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290600
b: refs/heads/master
c: 3fcdab7
h: refs/heads/master
v: v3
  • Loading branch information
Eliad Peller authored and Luciano Coelho committed Feb 15, 2012
1 parent 63f3e10 commit 8cb311f
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 23 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: f95f9aad150238236b2338efa60a14891081026e
refs/heads/master: 3fcdab7066a31ae90ac2beba7d38e8e606374998
2 changes: 1 addition & 1 deletion trunk/drivers/net/wireless/wl12xx/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static void wl1271_debugfs_update_stats(struct wl1271 *wl)
if (ret < 0)
goto out;

if (wl->state == WL1271_STATE_ON &&
if (wl->state == WL1271_STATE_ON && !wl->plt &&
time_after(jiffies, wl->stats.fw_stats_update +
msecs_to_jiffies(WL1271_DEBUGFS_STATS_LIFETIME))) {
wl1271_acx_statistics(wl, wl->stats.fw_stats);
Expand Down
53 changes: 35 additions & 18 deletions trunk/drivers/net/wireless/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,16 +993,29 @@ static irqreturn_t wl1271_irq(int irq, void *cookie)
return IRQ_HANDLED;
}

static int wl1271_fetch_firmware(struct wl1271 *wl)
static int wl12xx_fetch_firmware(struct wl1271 *wl, bool plt)
{
const struct firmware *fw;
const char *fw_name;
enum wl12xx_fw_type fw_type;
int ret;

if (wl->chip.id == CHIP_ID_1283_PG20)
fw_name = WL128X_FW_NAME;
else
fw_name = WL127X_FW_NAME;
if (plt) {
fw_type = WL12XX_FW_TYPE_PLT;
if (wl->chip.id == CHIP_ID_1283_PG20)
fw_name = WL128X_PLT_FW_NAME;
else
fw_name = WL127X_PLT_FW_NAME;
} else {
fw_type = WL12XX_FW_TYPE_NORMAL;
if (wl->chip.id == CHIP_ID_1283_PG20)
fw_name = WL128X_FW_NAME;
else
fw_name = WL127X_FW_NAME;
}

if (wl->fw_type == fw_type)
return 0;

wl1271_debug(DEBUG_BOOT, "booting firmware %s", fw_name);

Expand All @@ -1021,6 +1034,7 @@ static int wl1271_fetch_firmware(struct wl1271 *wl)
}

vfree(wl->fw);
wl->fw_type = WL12XX_FW_TYPE_NONE;
wl->fw_len = fw->size;
wl->fw = vmalloc(wl->fw_len);

Expand All @@ -1032,7 +1046,7 @@ static int wl1271_fetch_firmware(struct wl1271 *wl)

memcpy(wl->fw, fw->data, wl->fw_len);
ret = 0;

wl->fw_type = fw_type;
out:
release_firmware(fw);

Expand Down Expand Up @@ -1160,7 +1174,7 @@ static void wl1271_recovery_work(struct work_struct *work)

mutex_lock(&wl->mutex);

if (wl->state != WL1271_STATE_ON)
if (wl->state != WL1271_STATE_ON || wl->plt)
goto out_unlock;

/* Avoid a recursive recovery */
Expand Down Expand Up @@ -1261,7 +1275,7 @@ static int wl12xx_set_power_on(struct wl1271 *wl)
return ret;
}

static int wl1271_chip_wakeup(struct wl1271 *wl)
static int wl12xx_chip_wakeup(struct wl1271 *wl, bool plt)
{
int ret = 0;

Expand Down Expand Up @@ -1316,11 +1330,9 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
goto out;
}

if (wl->fw == NULL) {
ret = wl1271_fetch_firmware(wl);
if (ret < 0)
goto out;
}
ret = wl12xx_fetch_firmware(wl, plt);
if (ret < 0)
goto out;

/* No NVS from netlink, try to get it from the filesystem */
if (wl->nvs == NULL) {
Expand Down Expand Up @@ -1352,7 +1364,7 @@ int wl1271_plt_start(struct wl1271 *wl)

while (retries) {
retries--;
ret = wl1271_chip_wakeup(wl);
ret = wl12xx_chip_wakeup(wl, true);
if (ret < 0)
goto power_off;

Expand All @@ -1364,7 +1376,8 @@ int wl1271_plt_start(struct wl1271 *wl)
if (ret < 0)
goto irq_disable;

wl->state = WL1271_STATE_PLT;
wl->plt = true;
wl->state = WL1271_STATE_ON;
wl1271_notice("firmware booted in PLT mode (%s)",
wl->chip.fw_ver_str);

Expand Down Expand Up @@ -1413,7 +1426,7 @@ int wl1271_plt_stop(struct wl1271 *wl)
*/
wl1271_disable_interrupts(wl);
mutex_lock(&wl->mutex);
if (wl->state != WL1271_STATE_PLT) {
if (!wl->plt) {
mutex_unlock(&wl->mutex);

/*
Expand All @@ -1440,6 +1453,7 @@ int wl1271_plt_stop(struct wl1271 *wl)
wl1271_power_off(wl);
wl->flags = 0;
wl->state = WL1271_STATE_OFF;
wl->plt = false;
wl->rx_counter = 0;
mutex_unlock(&wl->mutex);

Expand Down Expand Up @@ -1995,7 +2009,7 @@ static bool wl12xx_init_fw(struct wl1271 *wl)

while (retries) {
retries--;
ret = wl1271_chip_wakeup(wl);
ret = wl12xx_chip_wakeup(wl, false);
if (ret < 0)
goto power_off;

Expand Down Expand Up @@ -2098,6 +2112,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
goto out;
}


ret = wl12xx_init_vif_data(wl, vif);
if (ret < 0)
goto out;
Expand Down Expand Up @@ -5009,7 +5024,7 @@ static int wl1271_register_hw(struct wl1271 *wl)

static void wl1271_unregister_hw(struct wl1271 *wl)
{
if (wl->state == WL1271_STATE_PLT)
if (wl->plt)
wl1271_plt_stop(wl);

unregister_netdevice_notifier(&wl1271_dev_notifier);
Expand Down Expand Up @@ -5186,6 +5201,7 @@ static struct ieee80211_hw *wl1271_alloc_hw(void)
spin_lock_init(&wl->wl_lock);

wl->state = WL1271_STATE_OFF;
wl->fw_type = WL12XX_FW_TYPE_NONE;
mutex_init(&wl->mutex);

/* Apply default driver configuration. */
Expand Down Expand Up @@ -5253,6 +5269,7 @@ static int wl1271_free_hw(struct wl1271 *wl)

vfree(wl->fw);
wl->fw = NULL;
wl->fw_type = WL12XX_FW_TYPE_NONE;
kfree(wl->nvs);
wl->nvs = NULL;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/wireless/wl12xx/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
* In PLT mode we seem to get frames and mac80211 warns about them,
* workaround this by not retrieving them at all.
*/
if (unlikely(wl->state == WL1271_STATE_PLT))
if (unlikely(wl->plt))
return -EINVAL;

/* the data read starts with the descriptor */
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/net/wireless/wl12xx/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,3 +372,5 @@ MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
MODULE_FIRMWARE(WL127X_FW_NAME);
MODULE_FIRMWARE(WL128X_FW_NAME);
MODULE_FIRMWARE(WL127X_PLT_FW_NAME);
MODULE_FIRMWARE(WL128X_PLT_FW_NAME);
2 changes: 2 additions & 0 deletions trunk/drivers/net/wireless/wl12xx/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,6 @@ MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
MODULE_FIRMWARE(WL127X_FW_NAME);
MODULE_FIRMWARE(WL128X_FW_NAME);
MODULE_FIRMWARE(WL127X_PLT_FW_NAME);
MODULE_FIRMWARE(WL128X_PLT_FW_NAME);
MODULE_ALIAS("spi:wl1271");
2 changes: 1 addition & 1 deletion trunk/drivers/net/wireless/wl12xx/testmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static int wl12xx_tm_cmd_get_mac(struct wl1271 *wl, struct nlattr *tb[])

mutex_lock(&wl->mutex);

if (wl->state != WL1271_STATE_PLT) {
if (!wl->plt) {
ret = -EINVAL;
goto out;
}
Expand Down
11 changes: 10 additions & 1 deletion trunk/drivers/net/wireless/wl12xx/wl12xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#define WL127X_FW_NAME "ti-connectivity/wl127x-fw-4-sr.bin"
#define WL128X_FW_NAME "ti-connectivity/wl128x-fw-4-sr.bin"
#define WL127X_PLT_FW_NAME "ti-connectivity/wl127x-fw-4-plt.bin"
#define WL128X_PLT_FW_NAME "ti-connectivity/wl128x-fw-4-plt.bin"

/*
* wl127x and wl128x are using the same NVS file name. However, the
Expand Down Expand Up @@ -90,7 +92,12 @@
enum wl1271_state {
WL1271_STATE_OFF,
WL1271_STATE_ON,
WL1271_STATE_PLT,
};

enum wl12xx_fw_type {
WL12XX_FW_TYPE_NONE,
WL12XX_FW_TYPE_NORMAL,
WL12XX_FW_TYPE_PLT,
};

enum wl1271_partition_type {
Expand Down Expand Up @@ -294,6 +301,8 @@ struct wl1271 {
spinlock_t wl_lock;

enum wl1271_state state;
enum wl12xx_fw_type fw_type;
bool plt;
struct mutex mutex;

unsigned long flags;
Expand Down

0 comments on commit 8cb311f

Please sign in to comment.