wl1271: Add pre-power-on sleep
[deliverable/linux.git] / drivers / net / wireless / wl12xx / wl1271_main.c
index 90916ed63b4504399896e0ca6583c4d42ef3920f..0520b38e8e727f3c6d292b741a61e8fe4cbcee39 100644 (file)
@@ -47,6 +47,8 @@
 #include "wl1271_cmd.h"
 #include "wl1271_boot.h"
 
+#define WL1271_BOOT_RETRIES 3
+
 static struct conf_drv_settings default_conf = {
        .sg = {
                .per_threshold               = 7500,
@@ -67,10 +69,10 @@ static struct conf_drv_settings default_conf = {
                .ps_poll_timeout             = 15,
                .upsd_timeout                = 15,
                .rts_threshold               = 2347,
-               .rx_cca_threshold            = 0xFFEF,
-               .irq_blk_threshold           = 0,
-               .irq_pkt_threshold           = USHORT_MAX,
-               .irq_timeout                 = 5,
+               .rx_cca_threshold            = 0,
+               .irq_blk_threshold           = 0xFFFF,
+               .irq_pkt_threshold           = 0,
+               .irq_timeout                 = 600,
                .queue_type                  = CONF_RX_QUEUE_TYPE_LOW_PRIORITY,
        },
        .tx = {
@@ -172,8 +174,8 @@ static struct conf_drv_settings default_conf = {
                        }
                },
                .frag_threshold              = IEEE80211_MAX_FRAG_THRESHOLD,
-               .tx_compl_timeout            = 5,
-               .tx_compl_threshold          = 5
+               .tx_compl_timeout            = 700,
+               .tx_compl_threshold          = 4
        },
        .conn = {
                .wake_up_event               = CONF_WAKE_UP_EVENT_DTIM,
@@ -186,12 +188,12 @@ static struct conf_drv_settings default_conf = {
                                .rule        = CONF_BCN_RULE_PASS_ON_APPEARANCE,
                        }
                },
-               .synch_fail_thold            = 5,
+               .synch_fail_thold            = 10,
                .bss_lose_timeout            = 100,
                .beacon_rx_timeout           = 10000,
                .broadcast_timeout           = 20000,
                .rx_broadcast_in_ps          = 1,
-               .ps_poll_threshold           = 4,
+               .ps_poll_threshold           = 20,
                .sig_trigger_count           = 2,
                .sig_trigger = {
                        [0] = {
@@ -226,53 +228,35 @@ static struct conf_drv_settings default_conf = {
                .psm_entry_retries           = 3
        },
        .init = {
-               .sr_err_tbl = {
-                       [0] = {
-                               .len         = 7,
-                               .upper_limit = 0x03,
-                               .values      = {
-                                       0x18, 0x10, 0x05, 0xfb, 0xf0, 0xe8,
-                                       0x00 }
-                       },
-                       [1] = {
-                               .len         = 7,
-                               .upper_limit = 0x03,
-                               .values      = {
-                                       0x18, 0x10, 0x05, 0xf6, 0xf0, 0xe8,
-                                       0x00 }
-                       },
-                       [2] = {
-                               .len         = 7,
-                               .upper_limit = 0x03,
-                               .values      = {
-                                       0x18, 0x10, 0x05, 0xfb, 0xf0, 0xe8,
-                                       0x00 }
-                       }
-               },
-               .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,
                        .single_dual_band    = CONF_SINGLE_BAND,
-                       .tx_bip_fem_autodetect = 0,
+                       .tx_bip_fem_autodetect = 1,
                        .tx_bip_fem_manufacturer = 1,
                        .settings = 1,
+                       .sr_state = 1,
+                       .srf1 = { 0x07, 0x03, 0x18, 0x10, 0x05, 0xfb, 0xf0,
+                                 0xe8, 0, 0, 0, 0, 0, 0, 0, 0 },
+                       .srf2 = { 0x07, 0x03, 0x18, 0x10, 0x05, 0xfb, 0xf0,
+                                 0xe8, 0, 0, 0, 0, 0, 0, 0, 0 },
+                       .srf3 = { 0x07, 0x03, 0x18, 0x10, 0x05, 0xfb, 0xf0,
+                                 0xe8, 0, 0, 0, 0, 0, 0, 0, 0 },
+                       .sr_debug_table = { 0, 0, 0, 0, 0, 0, 0, 0,
+                                           0, 0, 0, 0, 0, 0, 0, 0 },
+                       .sr_sen_n_p = 0,
+                       .sr_sen_n_p_gain = 0,
+                       .sr_sen_nrn = 0,
+                       .sr_sen_prn = 0,
                },
                .radioparam = {
-                       .rx_trace_loss       = 10,
-                       .tx_trace_loss       = 10,
+                       .rx_trace_loss       = 0x24,
+                       .tx_trace_loss       = 0x0,
                        .rx_rssi_and_proc_compens = {
                                0xec, 0xf6, 0x00, 0x0c, 0x18, 0xf8,
-                               0xfc, 0x00, 0x08, 0x10, 0xf0, 0xf8,
+                               0xfc, 0x00, 0x80, 0x10, 0xf0, 0xf8,
                                0x00, 0x0a, 0x14 },
                        .rx_trace_loss_5     = { 0, 0, 0, 0, 0, 0, 0 },
                        .tx_trace_loss_5     = { 0, 0, 0, 0, 0, 0, 0 },
@@ -280,13 +264,15 @@ static struct conf_drv_settings default_conf = {
                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                0x00, 0x00, 0x00 },
-                       .tx_ref_pd_voltage   = 0x24e,
-                       .tx_ref_power        = 0x78,
+                       .tx_ref_pd_voltage   = 0x1a9,
+                       .tx_ref_power        = 0x80,
                        .tx_offset_db        = 0x0,
                        .tx_rate_limits_normal = {
-                               0x1e, 0x1f, 0x22, 0x24, 0x28, 0x29 },
+                               0x1d, 0x1f, 0x24, 0x28, 0x28, 0x29 },
                        .tx_rate_limits_degraded = {
-                               0x1b, 0x1c, 0x1e, 0x20, 0x24, 0x25 },
+                               0x19, 0x1f, 0x22, 0x23, 0x27, 0x28 },
+                       .tx_rate_limits_extreme = {
+                               0x19, 0x1c, 0x1e, 0x20, 0x24, 0x25 },
                        .tx_channel_limits_11b = {
                                0x22, 0x50, 0x50, 0x50, 0x50, 0x50,
                                0x50, 0x50, 0x50, 0x50, 0x22, 0x50,
@@ -296,10 +282,12 @@ static struct conf_drv_settings default_conf = {
                                0x50, 0x50, 0x50, 0x50, 0x20, 0x50,
                                0x20, 0x50 },
                        .tx_pdv_rate_offsets = {
-                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+                               0x07, 0x08, 0x04, 0x02, 0x02, 0x00 },
                        .tx_ibias            = {
-                               0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x27 },
-                       .rx_fem_insertion_loss = 0x14,
+                               0x11, 0x11, 0x15, 0x11, 0x15, 0x0f },
+                       .rx_fem_insertion_loss = 0x0e,
+                       .degraded_low_to_normal_threshold = 0x1e,
+                       .degraded_normal_to_high_threshold = 0x2d,
                        .tx_ref_pd_voltage_5 = {
                                0x0190, 0x01a4, 0x01c3, 0x01d8,
                                0x020a, 0x021c },
@@ -311,6 +299,8 @@ static struct conf_drv_settings default_conf = {
                                0x1b, 0x1e, 0x21, 0x23, 0x27, 0x00 },
                        .tx_rate_limits_degraded_5 = {
                                0x1b, 0x1e, 0x21, 0x23, 0x27, 0x00 },
+                       .tx_rate_limits_extreme_5 = {
+                               0x1b, 0x1e, 0x21, 0x23, 0x27, 0x00 },
                        .tx_channel_limits_ofdm_5 = {
                                0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50,
                                0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50,
@@ -322,8 +312,14 @@ static struct conf_drv_settings default_conf = {
                        .tx_ibias_5          = {
                                0x10, 0x10, 0x10, 0x10, 0x10, 0x10 },
                        .rx_fem_insertion_loss_5 = {
-                               0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 }
+                               0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 },
+                       .degraded_low_to_normal_threshold_5 = 0x00,
+                       .degraded_normal_to_high_threshold_5 = 0x00
                }
+       },
+       .itrim = {
+               .enable = false,
+               .timeout = 50000,
        }
 };
 
@@ -354,11 +350,19 @@ static int wl1271_plt_init(struct wl1271 *wl)
 {
        int ret;
 
+       ret = wl1271_cmd_general_parms(wl);
+       if (ret < 0)
+               return ret;
+
+       ret = wl1271_cmd_radio_parms(wl);
+       if (ret < 0)
+               return ret;
+
        ret = wl1271_acx_init_mem_config(wl);
        if (ret < 0)
                return ret;
 
-       ret = wl1271_cmd_data_path(wl, wl->channel, 1);
+       ret = wl1271_cmd_data_path(wl, 1);
        if (ret < 0)
                return ret;
 
@@ -373,11 +377,13 @@ static void wl1271_disable_interrupts(struct wl1271 *wl)
 static void wl1271_power_off(struct wl1271 *wl)
 {
        wl->set_power(false);
+       wl->gpio_power = false;
 }
 
 static void wl1271_power_on(struct wl1271 *wl)
 {
        wl->set_power(true);
+       wl->gpio_power = true;
 }
 
 static void wl1271_fw_status(struct wl1271 *wl,
@@ -446,14 +452,13 @@ static void wl1271_irq_work(struct work_struct *work)
        intr &= WL1271_INTR_MASK;
 
        if (intr & WL1271_ACX_INTR_EVENT_A) {
-               bool do_ack = (intr & WL1271_ACX_INTR_EVENT_B) ? false : true;
                wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_A");
-               wl1271_event_handle(wl, 0, do_ack);
+               wl1271_event_handle(wl, 0);
        }
 
        if (intr & WL1271_ACX_INTR_EVENT_B) {
                wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_B");
-               wl1271_event_handle(wl, 1, true);
+               wl1271_event_handle(wl, 1);
        }
 
        if (intr & WL1271_ACX_INTR_INIT_COMPLETE)
@@ -613,6 +618,7 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
        struct wl1271_partition_set partition;
        int ret = 0;
 
+       msleep(WL1271_PRE_POWER_ON_SLEEP);
        wl1271_power_on(wl);
        msleep(WL1271_POWER_ON_SLEEP);
        wl1271_spi_reset(wl);
@@ -642,7 +648,7 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
 
                ret = wl1271_setup(wl);
                if (ret < 0)
-                       goto out_power_off;
+                       goto out;
                break;
        case CHIP_ID_1271_PG20:
                wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)",
@@ -650,38 +656,34 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
 
                ret = wl1271_setup(wl);
                if (ret < 0)
-                       goto out_power_off;
+                       goto out;
                break;
        default:
-               wl1271_error("unsupported chip id: 0x%x", wl->chip.id);
+               wl1271_warning("unsupported chip id: 0x%x", wl->chip.id);
                ret = -ENODEV;
-               goto out_power_off;
+               goto out;
        }
 
        if (wl->fw == NULL) {
                ret = wl1271_fetch_firmware(wl);
                if (ret < 0)
-                       goto out_power_off;
+                       goto out;
        }
 
        /* No NVS from netlink, try to get it from the filesystem */
        if (wl->nvs == NULL) {
                ret = wl1271_fetch_nvs(wl);
                if (ret < 0)
-                       goto out_power_off;
+                       goto out;
        }
 
-       goto out;
-
-out_power_off:
-       wl1271_power_off(wl);
-
 out:
        return ret;
 }
 
 int wl1271_plt_start(struct wl1271 *wl)
 {
+       int retries = WL1271_BOOT_RETRIES;
        int ret;
 
        mutex_lock(&wl->mutex);
@@ -695,35 +697,48 @@ int wl1271_plt_start(struct wl1271 *wl)
                goto out;
        }
 
-       wl->state = WL1271_STATE_PLT;
-
-       ret = wl1271_chip_wakeup(wl);
-       if (ret < 0)
-               goto out;
-
-       ret = wl1271_boot(wl);
-       if (ret < 0)
-               goto out_power_off;
-
-       wl1271_notice("firmware booted in PLT mode (%s)", wl->chip.fw_ver);
+       while (retries) {
+               retries--;
+               ret = wl1271_chip_wakeup(wl);
+               if (ret < 0)
+                       goto power_off;
 
-       ret = wl1271_plt_init(wl);
-       if (ret < 0)
-               goto out_irq_disable;
+               ret = wl1271_boot(wl);
+               if (ret < 0)
+                       goto power_off;
 
-       /* Make sure power saving is disabled */
-       ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
-       if (ret < 0)
-               goto out_irq_disable;
+               ret = wl1271_plt_init(wl);
+               if (ret < 0)
+                       goto irq_disable;
 
-       goto out;
+               /* Make sure power saving is disabled */
+               ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
+               if (ret < 0)
+                       goto irq_disable;
 
-out_irq_disable:
-       wl1271_disable_interrupts(wl);
+               wl->state = WL1271_STATE_PLT;
+               wl1271_notice("firmware booted in PLT mode (%s)",
+                             wl->chip.fw_ver);
+               goto out;
 
-out_power_off:
-       wl1271_power_off(wl);
+irq_disable:
+               wl1271_disable_interrupts(wl);
+               mutex_unlock(&wl->mutex);
+               /* Unlocking the mutex in the middle of handling is
+                  inherently unsafe. In this case we deem it safe to do,
+                  because we need to let any possibly pending IRQ out of
+                  the system (and while we are WL1271_STATE_OFF the IRQ
+                  work function will not do anything.) Also, any other
+                  possible concurrent operations will fail due to the
+                  current state, hence the wl1271 struct should be safe. */
+               cancel_work_sync(&wl->irq_work);
+               mutex_lock(&wl->mutex);
+power_off:
+               wl1271_power_off(wl);
+       }
 
+       wl1271_error("firmware boot in PLT mode failed despite %d retries",
+                    WL1271_BOOT_RETRIES);
 out:
        mutex_unlock(&wl->mutex);
 
@@ -815,15 +830,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 +847,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 +883,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 = {
@@ -879,6 +894,7 @@ static struct notifier_block wl1271_dev_notifier = {
 static int wl1271_op_start(struct ieee80211_hw *hw)
 {
        struct wl1271 *wl = hw->priv;
+       int retries = WL1271_BOOT_RETRIES;
        int ret = 0;
 
        wl1271_debug(DEBUG_MAC80211, "mac80211 start");
@@ -892,30 +908,42 @@ static int wl1271_op_start(struct ieee80211_hw *hw)
                goto out;
        }
 
-       ret = wl1271_chip_wakeup(wl);
-       if (ret < 0)
-               goto out;
-
-       ret = wl1271_boot(wl);
-       if (ret < 0)
-               goto out_power_off;
-
-       ret = wl1271_hw_init(wl);
-       if (ret < 0)
-               goto out_irq_disable;
-
-       wl->state = WL1271_STATE_ON;
+       while (retries) {
+               retries--;
+               ret = wl1271_chip_wakeup(wl);
+               if (ret < 0)
+                       goto power_off;
 
-       wl1271_info("firmware booted (%s)", wl->chip.fw_ver);
+               ret = wl1271_boot(wl);
+               if (ret < 0)
+                       goto power_off;
 
-       goto out;
+               ret = wl1271_hw_init(wl);
+               if (ret < 0)
+                       goto irq_disable;
 
-out_irq_disable:
-       wl1271_disable_interrupts(wl);
+               wl->state = WL1271_STATE_ON;
+               wl1271_info("firmware booted (%s)", wl->chip.fw_ver);
+               goto out;
 
-out_power_off:
-       wl1271_power_off(wl);
+irq_disable:
+               wl1271_disable_interrupts(wl);
+               mutex_unlock(&wl->mutex);
+               /* Unlocking the mutex in the middle of handling is
+                  inherently unsafe. In this case we deem it safe to do,
+                  because we need to let any possibly pending IRQ out of
+                  the system (and while we are WL1271_STATE_OFF the IRQ
+                  work function will not do anything.) Also, any other
+                  possible concurrent operations will fail due to the
+                  current state, hence the wl1271 struct should be safe. */
+               cancel_work_sync(&wl->irq_work);
+               mutex_lock(&wl->mutex);
+power_off:
+               wl1271_power_off(wl);
+       }
 
+       wl1271_error("firmware boot failed despite %d retries",
+                    WL1271_BOOT_RETRIES);
 out:
        mutex_unlock(&wl->mutex);
 
@@ -975,6 +1003,7 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)
        wl->elp = false;
        wl->psm = 0;
        wl->psm_entry_retry = 0;
+       wl->associated = false;
        wl->tx_queue_stopped = false;
        wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
        wl->tx_blocks_available = 0;
@@ -1108,6 +1137,47 @@ out:
 }
 #endif
 
+static int wl1271_join_channel(struct wl1271 *wl, int channel)
+{
+       int ret;
+       /* we need to use a dummy BSSID for now */
+       static const u8 dummy_bssid[ETH_ALEN] = { 0x0b, 0xad, 0xde,
+                                                 0xad, 0xbe, 0xef };
+
+       /* disable mac filter, so we hear everything */
+       wl->rx_config &= ~CFG_BSSID_FILTER_EN;
+
+       wl->channel = channel;
+       memcpy(wl->bssid, dummy_bssid, ETH_ALEN);
+
+       ret = wl1271_cmd_join(wl);
+       if (ret < 0)
+               goto out;
+
+       wl->joined = true;
+
+out:
+       return ret;
+}
+
+static int wl1271_unjoin_channel(struct wl1271 *wl)
+{
+       int ret;
+
+       /* to stop listening to a channel, we disconnect */
+       ret = wl1271_cmd_disconnect(wl);
+       if (ret < 0)
+               goto out;
+
+       wl->joined = false;
+       wl->channel = 0;
+       memset(wl->bssid, 0, ETH_ALEN);
+       wl->rx_config = WL1271_DEFAULT_RX_CONFIG;
+
+out:
+       return ret;
+}
+
 static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct wl1271 *wl = hw->priv;
@@ -1116,10 +1186,11 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
 
        channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
 
-       wl1271_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d",
+       wl1271_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d %s",
                     channel,
                     conf->flags & IEEE80211_CONF_PS ? "on" : "off",
-                    conf->power_level);
+                    conf->power_level,
+                    conf->flags & IEEE80211_CONF_IDLE ? "idle" : "in use");
 
        mutex_lock(&wl->mutex);
 
@@ -1129,19 +1200,23 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
        if (ret < 0)
                goto out;
 
-       if (channel != wl->channel) {
-               /*
-                * We assume that the stack will configure the right channel
-                * before associating, so we don't need to send a join
-                * command here.  We will join the right channel when the
-                * BSSID changes
-                */
-               wl->channel = channel;
+       if (changed & IEEE80211_CONF_CHANGE_IDLE) {
+               if (conf->flags & IEEE80211_CONF_IDLE && wl->joined)
+                       wl1271_unjoin_channel(wl);
+               else
+                       wl1271_join_channel(wl, channel);
+
+               if (conf->flags & IEEE80211_CONF_IDLE) {
+                       wl->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
+                       wl1271_acx_rate_policies(wl, CONF_TX_RATE_MASK_BASIC);
+               }
        }
 
-       if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) {
-               wl1271_info("psm enabled");
+       /* if the channel changes while joined, join again */
+       if (channel != wl->channel && wl->joined)
+               wl1271_join_channel(wl, channel);
 
+       if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) {
                wl->psm_requested = true;
 
                /*
@@ -1149,7 +1224,10 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
                 * If we're not, we'll enter it when joining an SSID,
                 * through the bss_info_changed() hook.
                 */
-               ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
+               if (wl->associated) {
+                       wl1271_info("psm enabled");
+                       ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
+               }
        } else if (!(conf->flags & IEEE80211_CONF_PS) &&
                   wl->psm_requested) {
                wl1271_info("psm disabled");
@@ -1472,9 +1550,32 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
        if (ret < 0)
                goto out;
 
+       if ((changed & BSS_CHANGED_BSSID) &&
+           /*
+            * Now we know the correct bssid, so we send a new join command
+            * and enable the BSSID filter
+            */
+           memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) {
+                       wl->rx_config |= CFG_BSSID_FILTER_EN;
+                       memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
+                       ret = wl1271_cmd_build_null_data(wl);
+                       if (ret < 0) {
+                               wl1271_warning("cmd buld null data failed %d",
+                                              ret);
+                               goto out_sleep;
+                       }
+                       ret = wl1271_cmd_join(wl);
+                       if (ret < 0) {
+                               wl1271_warning("cmd join failed %d", ret);
+                               goto out_sleep;
+                       }
+                       wl->joined = true;
+       }
+
        if (changed & BSS_CHANGED_ASSOC) {
                if (bss_conf->assoc) {
                        wl->aid = bss_conf->aid;
+                       wl->associated = true;
 
                        /*
                         * with wl1271, we don't need to update the
@@ -1499,7 +1600,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
                        }
                } else {
                        /* use defaults when not associated */
-                       wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
+                       wl->associated = false;
                        wl->aid = 0;
                }
 
@@ -1598,19 +1699,19 @@ static struct ieee80211_rate wl1271_rates[] = {
 
 /* can't be const, mac80211 writes to this */
 static struct ieee80211_channel wl1271_channels[] = {
-       { .hw_value = 1, .center_freq = 2412},
-       { .hw_value = 2, .center_freq = 2417},
-       { .hw_value = 3, .center_freq = 2422},
-       { .hw_value = 4, .center_freq = 2427},
-       { .hw_value = 5, .center_freq = 2432},
-       { .hw_value = 6, .center_freq = 2437},
-       { .hw_value = 7, .center_freq = 2442},
-       { .hw_value = 8, .center_freq = 2447},
-       { .hw_value = 9, .center_freq = 2452},
-       { .hw_value = 10, .center_freq = 2457},
-       { .hw_value = 11, .center_freq = 2462},
-       { .hw_value = 12, .center_freq = 2467},
-       { .hw_value = 13, .center_freq = 2472},
+       { .hw_value = 1, .center_freq = 2412, .max_power = 25 },
+       { .hw_value = 2, .center_freq = 2417, .max_power = 25 },
+       { .hw_value = 3, .center_freq = 2422, .max_power = 25 },
+       { .hw_value = 4, .center_freq = 2427, .max_power = 25 },
+       { .hw_value = 5, .center_freq = 2432, .max_power = 25 },
+       { .hw_value = 6, .center_freq = 2437, .max_power = 25 },
+       { .hw_value = 7, .center_freq = 2442, .max_power = 25 },
+       { .hw_value = 8, .center_freq = 2447, .max_power = 25 },
+       { .hw_value = 9, .center_freq = 2452, .max_power = 25 },
+       { .hw_value = 10, .center_freq = 2457, .max_power = 25 },
+       { .hw_value = 11, .center_freq = 2462, .max_power = 25 },
+       { .hw_value = 12, .center_freq = 2467, .max_power = 25 },
+       { .hw_value = 13, .center_freq = 2472, .max_power = 25 },
 };
 
 /* can't be const, mac80211 writes to this */
@@ -1826,12 +1927,14 @@ static int __devinit wl1271_probe(struct spi_device *spi)
        wl->psm = 0;
        wl->psm_requested = false;
        wl->psm_entry_retry = 0;
+       wl->associated = false;
        wl->tx_queue_stopped = false;
        wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
-       wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
+       wl->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
        wl->band = IEEE80211_BAND_2GHZ;
        wl->vif = NULL;
        wl->joined = false;
+       wl->gpio_power = false;
 
        for (i = 0; i < ACX_TX_DESCRIPTORS; i++)
                wl->tx_frames[i] = NULL;
This page took 0.03476 seconds and 5 git commands to generate.