2009-11-23 21:23:00

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 0/8] wl1271 patches of the week

Hi John et al,

Here are some patches that were still pending on our internal tree. They are
mostly fixes, without any new implementation.

Cheers,
Luca.


Juuso Oikarinen (3):
wl1271: Decrease BET consecutive terminated beacons value to 10
wl1271: Prevent PSM-entry retry loop if PSM cancelled
wl1271: Set PSM support flags in driver configuration

Luciano Coelho (5):
wl1271: fix the inetdev notifier callback return values
wl1271: set radio and general params also for PLT
wl1271: fix radio and general parameters commands
wl1271: remove workaround to ignore -EIO from radio and general
params
wl1271: Remove REF_CLK hack

drivers/net/wireless/wl12xx/wl1271_cmd.c | 107 +++++++++++++++++++++++++
drivers/net/wireless/wl12xx/wl1271_cmd.h | 72 +++++++++++++++++
drivers/net/wireless/wl12xx/wl1271_event.c | 8 ++-
drivers/net/wireless/wl12xx/wl1271_init.c | 117 +---------------------------
drivers/net/wireless/wl12xx/wl1271_init.h | 70 -----------------
drivers/net/wireless/wl12xx/wl1271_main.c | 32 ++++----
6 files changed, 206 insertions(+), 200 deletions(-)



2009-11-23 21:22:59

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 2/8] wl1271: Prevent PSM-entry retry loop if PSM cancelled

From: Juuso Oikarinen <[email protected]>

Prevent endless PSM-entry retry loops, if PSM has already been cancelled while
PSM entry was attempted.

Signed-off-by: Juuso Oikarinen <[email protected]>
Reviewed-by: Luciano Coelho <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_event.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_event.c b/drivers/net/wireless/wl12xx/wl1271_event.c
index e135d89..d13fdd9 100644
--- a/drivers/net/wireless/wl12xx/wl1271_event.c
+++ b/drivers/net/wireless/wl12xx/wl1271_event.c
@@ -78,12 +78,16 @@ static int wl1271_event_ps_report(struct wl1271 *wl,

switch (mbox->ps_status) {
case EVENT_ENTER_POWER_SAVE_FAIL:
+ if (!wl->psm) {
+ wl->psm_entry_retry = 0;
+ break;
+ }
+
if (wl->psm_entry_retry < wl->conf.conn.psm_entry_retries) {
wl->psm_entry_retry++;
- wl1271_error("PSM entry failed, retrying %d\n",
- wl->psm_entry_retry);
ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
} else {
+ wl1271_error("PSM entry failed, giving up.\n");
wl->psm_entry_retry = 0;
*beacon_loss = true;
}
--
1.6.3.3


2009-11-23 21:23:06

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 6/8] wl1271: fix radio and general parameters commands

We were missing the command header in the radio and general parameters
commands. This was causing them to fail, resulting in problems in the power
levels and other PLT-related commands.

Also reorganized the command functions, moving from wl1271_init.c to
wl1271_cmd.c where it fits better.

Signed-off-by: Luciano Coelho <[email protected]>
Reviewed-by: Juuso Oikarinen <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_cmd.c | 107 ++++++++++++++++++++++++++++
drivers/net/wireless/wl12xx/wl1271_cmd.h | 72 +++++++++++++++++++
drivers/net/wireless/wl12xx/wl1271_init.c | 110 +----------------------------
drivers/net/wireless/wl12xx/wl1271_init.h | 72 -------------------
drivers/net/wireless/wl12xx/wl1271_main.c | 4 +-
5 files changed, 183 insertions(+), 182 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 990eb01..886a9bc 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -188,6 +188,113 @@ static int wl1271_cmd_cal(struct wl1271 *wl)
return ret;
}

+int wl1271_cmd_general_parms(struct wl1271 *wl)
+{
+ struct wl1271_general_parms_cmd *gen_parms;
+ struct conf_general_parms *g = &wl->conf.init.genparam;
+ int ret;
+
+ gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
+ if (!gen_parms)
+ return -ENOMEM;
+
+ gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM;
+
+ gen_parms->ref_clk = g->ref_clk;
+ gen_parms->settling_time = g->settling_time;
+ gen_parms->clk_valid_on_wakeup = g->clk_valid_on_wakeup;
+ gen_parms->dc2dcmode = g->dc2dcmode;
+ gen_parms->single_dual_band = g->single_dual_band;
+ gen_parms->tx_bip_fem_autodetect = g->tx_bip_fem_autodetect;
+ gen_parms->tx_bip_fem_manufacturer = g->tx_bip_fem_manufacturer;
+ gen_parms->settings = g->settings;
+
+ ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0);
+ if (ret < 0)
+ wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed");
+
+ kfree(gen_parms);
+ return ret;
+}
+
+int wl1271_cmd_radio_parms(struct wl1271 *wl)
+{
+ struct wl1271_radio_parms_cmd *radio_parms;
+ struct conf_radio_parms *r = &wl->conf.init.radioparam;
+ int i, ret;
+
+ radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL);
+ if (!radio_parms)
+ return -ENOMEM;
+
+ radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM;
+
+ /* Static radio parameters */
+ radio_parms->rx_trace_loss = r->rx_trace_loss;
+ radio_parms->tx_trace_loss = r->tx_trace_loss;
+ memcpy(radio_parms->rx_rssi_and_proc_compens,
+ r->rx_rssi_and_proc_compens,
+ CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE);
+
+ memcpy(radio_parms->rx_trace_loss_5, r->rx_trace_loss_5,
+ CONF_NUMBER_OF_SUB_BANDS_5);
+ memcpy(radio_parms->tx_trace_loss_5, r->tx_trace_loss_5,
+ CONF_NUMBER_OF_SUB_BANDS_5);
+ memcpy(radio_parms->rx_rssi_and_proc_compens_5,
+ r->rx_rssi_and_proc_compens_5,
+ CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE);
+
+ /* Dynamic radio parameters */
+ radio_parms->tx_ref_pd_voltage = cpu_to_le16(r->tx_ref_pd_voltage);
+ radio_parms->tx_ref_power = r->tx_ref_power;
+ radio_parms->tx_offset_db = r->tx_offset_db;
+
+ memcpy(radio_parms->tx_rate_limits_normal, r->tx_rate_limits_normal,
+ CONF_NUMBER_OF_RATE_GROUPS);
+ memcpy(radio_parms->tx_rate_limits_degraded, r->tx_rate_limits_degraded,
+ CONF_NUMBER_OF_RATE_GROUPS);
+
+ memcpy(radio_parms->tx_channel_limits_11b, r->tx_channel_limits_11b,
+ CONF_NUMBER_OF_CHANNELS_2_4);
+ memcpy(radio_parms->tx_channel_limits_ofdm, r->tx_channel_limits_ofdm,
+ CONF_NUMBER_OF_CHANNELS_2_4);
+ memcpy(radio_parms->tx_pdv_rate_offsets, r->tx_pdv_rate_offsets,
+ CONF_NUMBER_OF_RATE_GROUPS);
+ memcpy(radio_parms->tx_ibias, r->tx_ibias, CONF_NUMBER_OF_RATE_GROUPS);
+
+ radio_parms->rx_fem_insertion_loss = r->rx_fem_insertion_loss;
+
+ for (i = 0; i < CONF_NUMBER_OF_SUB_BANDS_5; i++)
+ radio_parms->tx_ref_pd_voltage_5[i] =
+ cpu_to_le16(r->tx_ref_pd_voltage_5[i]);
+ memcpy(radio_parms->tx_ref_power_5, r->tx_ref_power_5,
+ CONF_NUMBER_OF_SUB_BANDS_5);
+ memcpy(radio_parms->tx_offset_db_5, r->tx_offset_db_5,
+ CONF_NUMBER_OF_SUB_BANDS_5);
+ memcpy(radio_parms->tx_rate_limits_normal_5,
+ r->tx_rate_limits_normal_5, CONF_NUMBER_OF_RATE_GROUPS);
+ memcpy(radio_parms->tx_rate_limits_degraded_5,
+ r->tx_rate_limits_degraded_5, CONF_NUMBER_OF_RATE_GROUPS);
+ memcpy(radio_parms->tx_channel_limits_ofdm_5,
+ r->tx_channel_limits_ofdm_5, CONF_NUMBER_OF_CHANNELS_5);
+ memcpy(radio_parms->tx_pdv_rate_offsets_5, r->tx_pdv_rate_offsets_5,
+ CONF_NUMBER_OF_RATE_GROUPS);
+ memcpy(radio_parms->tx_ibias_5, r->tx_ibias_5,
+ CONF_NUMBER_OF_RATE_GROUPS);
+ memcpy(radio_parms->rx_fem_insertion_loss_5,
+ r->rx_fem_insertion_loss_5, CONF_NUMBER_OF_SUB_BANDS_5);
+
+ wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ",
+ radio_parms, sizeof(*radio_parms));
+
+ ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0);
+ if (ret < 0)
+ wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed");
+
+ kfree(radio_parms);
+ return ret;
+}
+
int wl1271_cmd_join(struct wl1271 *wl)
{
static bool do_cal = true;
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index 9d7061b..b4fa4ac 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -31,6 +31,8 @@ struct acx_header;

int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
size_t res_len);
+int wl1271_cmd_general_parms(struct wl1271 *wl);
+int wl1271_cmd_radio_parms(struct wl1271 *wl);
int wl1271_cmd_join(struct wl1271 *wl);
int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
@@ -418,6 +420,76 @@ enum wl1271_channel_tune_bands {
#define TEST_CMD_P2G_CAL 0x02
#define TEST_CMD_CHANNEL_TUNE 0x0d
#define TEST_CMD_UPDATE_PD_REFERENCE_POINT 0x1d
+#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
+#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
+
+struct wl1271_general_parms_cmd {
+ struct wl1271_cmd_header header;
+
+ struct wl1271_cmd_test_header test;
+
+ u8 ref_clk;
+ u8 settling_time;
+ u8 clk_valid_on_wakeup;
+ u8 dc2dcmode;
+ u8 single_dual_band;
+
+ u8 tx_bip_fem_autodetect;
+ u8 tx_bip_fem_manufacturer;
+ u8 settings;
+} __attribute__ ((packed));
+
+struct wl1271_radio_parms_cmd {
+ struct wl1271_cmd_header header;
+
+ struct wl1271_cmd_test_header test;
+
+ /* Static radio parameters */
+ /* 2.4GHz */
+ u8 rx_trace_loss;
+ u8 tx_trace_loss;
+ s8 rx_rssi_and_proc_compens[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE];
+
+ /* 5GHz */
+ u8 rx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5];
+ u8 tx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5];
+ s8 rx_rssi_and_proc_compens_5[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE];
+
+ /* Dynamic radio parameters */
+ /* 2.4GHz */
+ __le16 tx_ref_pd_voltage;
+ s8 tx_ref_power;
+ s8 tx_offset_db;
+
+ s8 tx_rate_limits_normal[CONF_NUMBER_OF_RATE_GROUPS];
+ s8 tx_rate_limits_degraded[CONF_NUMBER_OF_RATE_GROUPS];
+
+ s8 tx_channel_limits_11b[CONF_NUMBER_OF_CHANNELS_2_4];
+ s8 tx_channel_limits_ofdm[CONF_NUMBER_OF_CHANNELS_2_4];
+ s8 tx_pdv_rate_offsets[CONF_NUMBER_OF_RATE_GROUPS];
+
+ u8 tx_ibias[CONF_NUMBER_OF_RATE_GROUPS];
+ u8 rx_fem_insertion_loss;
+
+ u8 padding2;
+
+ /* 5GHz */
+ __le16 tx_ref_pd_voltage_5[CONF_NUMBER_OF_SUB_BANDS_5];
+ s8 tx_ref_power_5[CONF_NUMBER_OF_SUB_BANDS_5];
+ s8 tx_offset_db_5[CONF_NUMBER_OF_SUB_BANDS_5];
+
+ s8 tx_rate_limits_normal_5[CONF_NUMBER_OF_RATE_GROUPS];
+ s8 tx_rate_limits_degraded_5[CONF_NUMBER_OF_RATE_GROUPS];
+
+ s8 tx_channel_limits_ofdm_5[CONF_NUMBER_OF_CHANNELS_5];
+ s8 tx_pdv_rate_offsets_5[CONF_NUMBER_OF_RATE_GROUPS];
+
+ /* FIXME: this is inconsistent with the types for 2.4GHz */
+ s8 tx_ibias_5[CONF_NUMBER_OF_RATE_GROUPS];
+ s8 rx_fem_insertion_loss_5[CONF_NUMBER_OF_SUB_BANDS_5];
+
+ u8 padding3[2];
+} __attribute__ ((packed));

struct wl1271_cmd_cal_channel_tune {
struct wl1271_cmd_header header;
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 95ee036..44896ac 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -193,112 +193,6 @@ static int wl1271_init_beacon_broadcast(struct wl1271 *wl)
return 0;
}

-int wl1271_init_general_parms(struct wl1271 *wl)
-{
- struct wl1271_general_parms *gen_parms;
- struct conf_general_parms *g = &wl->conf.init.genparam;
- int ret;
-
- gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
- if (!gen_parms)
- return -ENOMEM;
-
- gen_parms->id = TEST_CMD_INI_FILE_GENERAL_PARAM;
-
- gen_parms->ref_clk = g->ref_clk;
- gen_parms->settling_time = g->settling_time;
- gen_parms->clk_valid_on_wakeup = g->clk_valid_on_wakeup;
- gen_parms->dc2dcmode = g->dc2dcmode;
- gen_parms->single_dual_band = g->single_dual_band;
- gen_parms->tx_bip_fem_autodetect = g->tx_bip_fem_autodetect;
- gen_parms->tx_bip_fem_manufacturer = g->tx_bip_fem_manufacturer;
- gen_parms->settings = g->settings;
-
- ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0);
- if (ret < 0) {
- wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed");
- return ret;
- }
-
- kfree(gen_parms);
- return 0;
-}
-
-int wl1271_init_radio_parms(struct wl1271 *wl)
-{
- struct wl1271_radio_parms *radio_parms;
- struct conf_radio_parms *r = &wl->conf.init.radioparam;
- int i, ret;
-
- radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL);
- if (!radio_parms)
- return -ENOMEM;
-
- radio_parms->id = TEST_CMD_INI_FILE_RADIO_PARAM;
-
- /* Static radio parameters */
- radio_parms->rx_trace_loss = r->rx_trace_loss;
- radio_parms->tx_trace_loss = r->tx_trace_loss;
- memcpy(radio_parms->rx_rssi_and_proc_compens,
- r->rx_rssi_and_proc_compens,
- CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE);
-
- memcpy(radio_parms->rx_trace_loss_5, r->rx_trace_loss_5,
- CONF_NUMBER_OF_SUB_BANDS_5);
- memcpy(radio_parms->tx_trace_loss_5, r->tx_trace_loss_5,
- CONF_NUMBER_OF_SUB_BANDS_5);
- memcpy(radio_parms->rx_rssi_and_proc_compens_5,
- r->rx_rssi_and_proc_compens_5,
- CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE);
-
- /* Dynamic radio parameters */
- radio_parms->tx_ref_pd_voltage = cpu_to_le16(r->tx_ref_pd_voltage);
- radio_parms->tx_ref_power = r->tx_ref_power;
- radio_parms->tx_offset_db = r->tx_offset_db;
-
- memcpy(radio_parms->tx_rate_limits_normal, r->tx_rate_limits_normal,
- CONF_NUMBER_OF_RATE_GROUPS);
- memcpy(radio_parms->tx_rate_limits_degraded, r->tx_rate_limits_degraded,
- CONF_NUMBER_OF_RATE_GROUPS);
-
- memcpy(radio_parms->tx_channel_limits_11b, r->tx_channel_limits_11b,
- CONF_NUMBER_OF_CHANNELS_2_4);
- memcpy(radio_parms->tx_channel_limits_ofdm, r->tx_channel_limits_ofdm,
- CONF_NUMBER_OF_CHANNELS_2_4);
- memcpy(radio_parms->tx_pdv_rate_offsets, r->tx_pdv_rate_offsets,
- CONF_NUMBER_OF_RATE_GROUPS);
- memcpy(radio_parms->tx_ibias, r->tx_ibias, CONF_NUMBER_OF_RATE_GROUPS);
-
- radio_parms->rx_fem_insertion_loss = r->rx_fem_insertion_loss;
-
- for (i = 0; i < CONF_NUMBER_OF_SUB_BANDS_5; i++)
- radio_parms->tx_ref_pd_voltage_5[i] =
- cpu_to_le16(r->tx_ref_pd_voltage_5[i]);
- memcpy(radio_parms->tx_ref_power_5, r->tx_ref_power_5,
- CONF_NUMBER_OF_SUB_BANDS_5);
- memcpy(radio_parms->tx_offset_db_5, r->tx_offset_db_5,
- CONF_NUMBER_OF_SUB_BANDS_5);
- memcpy(radio_parms->tx_rate_limits_normal_5,
- r->tx_rate_limits_normal_5, CONF_NUMBER_OF_RATE_GROUPS);
- memcpy(radio_parms->tx_rate_limits_degraded_5,
- r->tx_rate_limits_degraded_5, CONF_NUMBER_OF_RATE_GROUPS);
- memcpy(radio_parms->tx_channel_limits_ofdm_5,
- r->tx_channel_limits_ofdm_5, CONF_NUMBER_OF_CHANNELS_5);
- memcpy(radio_parms->tx_pdv_rate_offsets_5, r->tx_pdv_rate_offsets_5,
- CONF_NUMBER_OF_RATE_GROUPS);
- memcpy(radio_parms->tx_ibias_5, r->tx_ibias_5,
- CONF_NUMBER_OF_RATE_GROUPS);
- memcpy(radio_parms->rx_fem_insertion_loss_5,
- r->rx_fem_insertion_loss_5, CONF_NUMBER_OF_SUB_BANDS_5);
-
- ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0);
- if (ret < 0)
- wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed");
-
- kfree(radio_parms);
- return ret;
-}
-
int wl1271_hw_init(struct wl1271 *wl)
{
int ret;
@@ -306,11 +200,11 @@ int wl1271_hw_init(struct wl1271 *wl)
/* FIXME: the following parameter setting functions return error
* codes - the reason is so far unknown. The -EIO is therefore
* ignored for the time being. */
- ret = wl1271_init_general_parms(wl);
+ ret = wl1271_cmd_general_parms(wl);
if (ret < 0 && ret != -EIO)
return ret;

- ret = wl1271_init_radio_parms(wl);
+ ret = wl1271_cmd_radio_parms(wl);
if (ret < 0 && ret != -EIO)
return ret;

diff --git a/drivers/net/wireless/wl12xx/wl1271_init.h b/drivers/net/wireless/wl12xx/wl1271_init.h
index 539b57f..930677f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.h
+++ b/drivers/net/wireless/wl12xx/wl1271_init.h
@@ -28,77 +28,5 @@

int wl1271_hw_init_power_auth(struct wl1271 *wl);
int wl1271_hw_init(struct wl1271 *wl);
-int wl1271_init_general_parms(struct wl1271 *wl);
-int wl1271_init_radio_parms(struct wl1271 *wl);
-
-/* These are not really a TEST_CMD, but the ref driver uses them as such */
-#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
-#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
-
-struct wl1271_general_parms {
- u8 id;
- u8 padding[3];
-
- u8 ref_clk;
- u8 settling_time;
- u8 clk_valid_on_wakeup;
- u8 dc2dcmode;
- u8 single_dual_band;
-
- u8 tx_bip_fem_autodetect;
- u8 tx_bip_fem_manufacturer;
- u8 settings;
-} __attribute__ ((packed));
-
-struct wl1271_radio_parms {
- u8 id;
- u8 padding[3];
-
- /* Static radio parameters */
- /* 2.4GHz */
- u8 rx_trace_loss;
- u8 tx_trace_loss;
- s8 rx_rssi_and_proc_compens[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE];
-
- /* 5GHz */
- u8 rx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5];
- u8 tx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5];
- s8 rx_rssi_and_proc_compens_5[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE];
-
- /* Dynamic radio parameters */
- /* 2.4GHz */
- __le16 tx_ref_pd_voltage;
- s8 tx_ref_power;
- s8 tx_offset_db;
-
- s8 tx_rate_limits_normal[CONF_NUMBER_OF_RATE_GROUPS];
- s8 tx_rate_limits_degraded[CONF_NUMBER_OF_RATE_GROUPS];
-
- s8 tx_channel_limits_11b[CONF_NUMBER_OF_CHANNELS_2_4];
- s8 tx_channel_limits_ofdm[CONF_NUMBER_OF_CHANNELS_2_4];
- s8 tx_pdv_rate_offsets[CONF_NUMBER_OF_RATE_GROUPS];
-
- u8 tx_ibias[CONF_NUMBER_OF_RATE_GROUPS];
- u8 rx_fem_insertion_loss;
-
- u8 padding2;
-
- /* 5GHz */
- __le16 tx_ref_pd_voltage_5[CONF_NUMBER_OF_SUB_BANDS_5];
- s8 tx_ref_power_5[CONF_NUMBER_OF_SUB_BANDS_5];
- s8 tx_offset_db_5[CONF_NUMBER_OF_SUB_BANDS_5];
-
- s8 tx_rate_limits_normal_5[CONF_NUMBER_OF_RATE_GROUPS];
- s8 tx_rate_limits_degraded_5[CONF_NUMBER_OF_RATE_GROUPS];
-
- s8 tx_channel_limits_ofdm_5[CONF_NUMBER_OF_CHANNELS_5];
- s8 tx_pdv_rate_offsets_5[CONF_NUMBER_OF_RATE_GROUPS];
-
- /* FIXME: this is inconsistent with the types for 2.4GHz */
- s8 tx_ibias_5[CONF_NUMBER_OF_RATE_GROUPS];
- s8 rx_fem_insertion_loss_5[CONF_NUMBER_OF_SUB_BANDS_5];
-
- u8 padding3[2];
-} __attribute__ ((packed));

#endif
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index d4e6039..b75557e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -357,11 +357,11 @@ static int wl1271_plt_init(struct wl1271 *wl)
/* FIXME: the following parameter setting functions return error
* codes - the reason is so far unknown. The -EIO is therefore
* ignored for the time being. */
- ret = wl1271_init_general_parms(wl);
+ ret = wl1271_cmd_general_parms(wl);
if (ret < 0 && ret != -EIO)
return ret;

- ret = wl1271_init_radio_parms(wl);
+ ret = wl1271_cmd_radio_parms(wl);
if (ret < 0 && ret != -EIO)
return ret;

--
1.6.3.3


2009-11-23 21:23:02

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 1/8] wl1271: Decrease BET consecutive terminated beacons value to 10

From: Juuso Oikarinen <[email protected]>

Decrease the consecutive terminated beacons value for BET from 100 to 10.
According to the vendor, 10 will give a more reliable connection and more
reliable detection of connection problems.

Signed-off-by: Juuso Oikarinen <[email protected]>
Reviewed-by: Luciano Coelho <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 00ddcc2..43fdd45 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -222,7 +222,7 @@ static struct conf_drv_settings default_conf = {
.snr_pkt_avg_weight = 10
},
.bet_enable = CONF_BET_MODE_ENABLE,
- .bet_max_consecutive = 100,
+ .bet_max_consecutive = 10,
.psm_entry_retries = 3
},
.init = {
--
1.6.3.3


2009-11-23 21:23:10

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 8/8] wl1271: Remove REF_CLK hack

This hack was totally wrong and was "needed" because of a problem in the way
we were sending the GENERAL_PARMS command to the firmware. Now that that
problem has been fixed, this hack can be removed.

Signed-off-by: Luciano Coelho <[email protected]>
Reviewed-by: Juuso Oikarinen <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_main.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 64d0526..b62c00f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -251,14 +251,7 @@ static struct conf_drv_settings default_conf = {
},
.sr_enable = 1,
.genparam = {
- /*
- * FIXME: The correct value CONF_REF_CLK_38_4_E
- * causes the firmware to crash on boot.
- * The value 5 apparently is an
- * unnoficial XTAL configuration of the
- * same frequency, which appears to work.
- */
- .ref_clk = 5,
+ .ref_clk = CONF_REF_CLK_38_4_E,
.settling_time = 5,
.clk_valid_on_wakeup = 0,
.dc2dcmode = 0,
--
1.6.3.3


2009-11-23 21:23:03

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 4/8] wl1271: fix the inetdev notifier callback return values

The wl1271_dev_notify() was returning 0 or -ENODEV, when it should return
NOTIFY_* instead. Now we use NOTIFY_DONE when we didn't handle the event or
NOTIFY_OK when we have handled it.

For inetdev notifications, it doesn't matter whether we use NOTIFY_DONE or
NOTIFY_OK, because it ignores the return value of the call to
blocking_notifier_call_chain(). But the notify.h header says that
NOTIFY_DONE is "Don't care" and NOTIFY_OK is "Suits me", so that seems to be
the right way to do it.

Reported-by: Johannes Berg <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
Reviewed-by: Juuso Oikarinen <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_main.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 90916ed..c8652ee 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -815,15 +815,15 @@ static int wl1271_dev_notify(struct notifier_block *me, unsigned long what,

wdev = dev->ieee80211_ptr;
if (wdev == NULL)
- return -ENODEV;
+ return NOTIFY_DONE;

wiphy = wdev->wiphy;
if (wiphy == NULL)
- return -ENODEV;
+ return NOTIFY_DONE;

hw = wiphy_priv(wiphy);
if (hw == NULL)
- return -ENODEV;
+ return NOTIFY_DONE;

/* Check that the interface is one supported by this driver. */
wl_temp = hw->priv;
@@ -832,7 +832,7 @@ static int wl1271_dev_notify(struct notifier_block *me, unsigned long what,
break;
}
if (wl == NULL)
- return -ENODEV;
+ return NOTIFY_DONE;

/* Get the interface IP address for the device. "ifa" will become
NULL if:
@@ -868,7 +868,7 @@ static int wl1271_dev_notify(struct notifier_block *me, unsigned long what,
out:
mutex_unlock(&wl->mutex);

- return ret;
+ return NOTIFY_OK;
}

static struct notifier_block wl1271_dev_notifier = {
--
1.6.3.3


2009-11-23 21:23:01

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 5/8] wl1271: set radio and general params also for PLT

We need to set the radio and general parameters when starting PLT mode. This
patch adds calls to TEST_CMD_INI_RADIO_PARAMS and
TEST_CMD_INIT_GENERAL_PARAMS when initializing PLT mode.

Signed-off-by: Luciano Coelho <[email protected]>
Reviewed-by: Juuso Oikarinen <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_init.c | 4 ++--
drivers/net/wireless/wl12xx/wl1271_init.h | 2 ++
drivers/net/wireless/wl12xx/wl1271_main.c | 11 +++++++++++
3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 7c2017f..95ee036 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -193,7 +193,7 @@ static int wl1271_init_beacon_broadcast(struct wl1271 *wl)
return 0;
}

-static int wl1271_init_general_parms(struct wl1271 *wl)
+int wl1271_init_general_parms(struct wl1271 *wl)
{
struct wl1271_general_parms *gen_parms;
struct conf_general_parms *g = &wl->conf.init.genparam;
@@ -224,7 +224,7 @@ static int wl1271_init_general_parms(struct wl1271 *wl)
return 0;
}

-static int wl1271_init_radio_parms(struct wl1271 *wl)
+int wl1271_init_radio_parms(struct wl1271 *wl)
{
struct wl1271_radio_parms *radio_parms;
struct conf_radio_parms *r = &wl->conf.init.radioparam;
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.h b/drivers/net/wireless/wl12xx/wl1271_init.h
index 6e21cee..539b57f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.h
+++ b/drivers/net/wireless/wl12xx/wl1271_init.h
@@ -28,6 +28,8 @@

int wl1271_hw_init_power_auth(struct wl1271 *wl);
int wl1271_hw_init(struct wl1271 *wl);
+int wl1271_init_general_parms(struct wl1271 *wl);
+int wl1271_init_radio_parms(struct wl1271 *wl);

/* These are not really a TEST_CMD, but the ref driver uses them as such */
#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index c8652ee..d4e6039 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -354,6 +354,17 @@ static int wl1271_plt_init(struct wl1271 *wl)
{
int ret;

+ /* FIXME: the following parameter setting functions return error
+ * codes - the reason is so far unknown. The -EIO is therefore
+ * ignored for the time being. */
+ ret = wl1271_init_general_parms(wl);
+ if (ret < 0 && ret != -EIO)
+ return ret;
+
+ ret = wl1271_init_radio_parms(wl);
+ if (ret < 0 && ret != -EIO)
+ return ret;
+
ret = wl1271_acx_init_mem_config(wl);
if (ret < 0)
return ret;
--
1.6.3.3


2009-11-23 21:23:09

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 7/8] wl1271: remove workaround to ignore -EIO from radio and general params

We were ignoring the -EIO return value from wl1271_cmd_radio_params() and
wl1271_cmd_general_params(), because they were always returning an error and
we didn't know why. Now this has been fixed, so the workaround can be
removed.

Signed-off-by: Luciano Coelho <[email protected]>
Reviewed-by: Juuso Oikarinen <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_init.c | 7 ++-----
drivers/net/wireless/wl12xx/wl1271_main.c | 7 ++-----
2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 44896ac..11249b4 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -197,15 +197,12 @@ int wl1271_hw_init(struct wl1271 *wl)
{
int ret;

- /* FIXME: the following parameter setting functions return error
- * codes - the reason is so far unknown. The -EIO is therefore
- * ignored for the time being. */
ret = wl1271_cmd_general_parms(wl);
- if (ret < 0 && ret != -EIO)
+ if (ret < 0)
return ret;

ret = wl1271_cmd_radio_parms(wl);
- if (ret < 0 && ret != -EIO)
+ if (ret < 0)
return ret;

/* Template settings */
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index b75557e..64d0526 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -354,15 +354,12 @@ static int wl1271_plt_init(struct wl1271 *wl)
{
int ret;

- /* FIXME: the following parameter setting functions return error
- * codes - the reason is so far unknown. The -EIO is therefore
- * ignored for the time being. */
ret = wl1271_cmd_general_parms(wl);
- if (ret < 0 && ret != -EIO)
+ if (ret < 0)
return ret;

ret = wl1271_cmd_radio_parms(wl);
- if (ret < 0 && ret != -EIO)
+ if (ret < 0)
return ret;

ret = wl1271_acx_init_mem_config(wl);
--
1.6.3.3


2009-11-23 21:23:05

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 3/8] wl1271: Set PSM support flags in driver configuration

From: Juuso Oikarinen <[email protected]>

Set the PSM support flag in the device configuration
for the mac80211 stack. This will enable usage of powersave.

Signed-off-by: Juuso Oikarinen <[email protected]>
Reviewed-by: Luciano Coelho <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_main.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 43fdd45..90916ed 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1753,7 +1753,8 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)

wl->hw->flags = IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_NOISE_DBM |
- IEEE80211_HW_BEACON_FILTER;
+ IEEE80211_HW_BEACON_FILTER |
+ IEEE80211_HW_SUPPORTS_PS;

wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
wl->hw->wiphy->max_scan_ssids = 1;
--
1.6.3.3