b43: HT-PHY: init: init BPHY and upload 0x1a table
[deliverable/linux.git] / drivers / net / wireless / b43 / main.c
index 85d6a1f03a08923c227a3516c4b4d080f7b0e519..b5e83057dab3719f38afc558dafc04811ce37e9e 100644 (file)
@@ -4,7 +4,7 @@
 
   Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>
   Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
-  Copyright (c) 2005-2009 Michael Buesch <mb@bu3sch.de>
+  Copyright (c) 2005-2009 Michael Buesch <m@bues.ch>
   Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
   Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
@@ -37,7 +37,6 @@
 #include <linux/if_arp.h>
 #include <linux/etherdevice.h>
 #include <linux/firmware.h>
-#include <linux/wireless.h>
 #include <linux/workqueue.h>
 #include <linux/skbuff.h>
 #include <linux/io.h>
@@ -115,6 +114,7 @@ MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
 
 #ifdef CONFIG_B43_BCMA
 static const struct bcma_device_id b43_bcma_tbl[] = {
+       BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x11, BCMA_ANY_CLASS),
        BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS),
        BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS),
        BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1D, BCMA_ANY_CLASS),
@@ -320,6 +320,10 @@ static void b43_wireless_core_exit(struct b43_wldev *dev);
 static int b43_wireless_core_init(struct b43_wldev *dev);
 static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev);
 static int b43_wireless_core_start(struct b43_wldev *dev);
+static void b43_op_bss_info_changed(struct ieee80211_hw *hw,
+                                   struct ieee80211_vif *vif,
+                                   struct ieee80211_bss_conf *conf,
+                                   u32 changed);
 
 static int b43_ratelimit(struct b43_wl *wl)
 {
@@ -2510,6 +2514,12 @@ static int b43_upload_microcode(struct b43_wldev *dev)
        }
        dev->fw.rev = fwrev;
        dev->fw.patch = fwpatch;
+       if (dev->fw.rev >= 598)
+               dev->fw.hdr_format = B43_FW_HDR_598;
+       else if (dev->fw.rev >= 410)
+               dev->fw.hdr_format = B43_FW_HDR_410;
+       else
+               dev->fw.hdr_format = B43_FW_HDR_351;
        dev->fw.opensource = (fwdate == 0xFFFF);
 
        /* Default to use-all-queues. */
@@ -2557,7 +2567,7 @@ static int b43_upload_microcode(struct b43_wldev *dev)
                        dev->fw.rev, dev->fw.patch);
        wiphy->hw_version = dev->dev->core_id;
 
-       if (b43_is_old_txhdr_format(dev)) {
+       if (dev->fw.hdr_format == B43_FW_HDR_351) {
                /* We're over the deadline, but we keep support for old fw
                 * until it turns out to be in major conflict with something new. */
                b43warn(dev->wl, "You are using an old firmware image. "
@@ -2943,6 +2953,7 @@ static void b43_rate_memory_init(struct b43_wldev *dev)
        case B43_PHYTYPE_G:
        case B43_PHYTYPE_N:
        case B43_PHYTYPE_LP:
+       case B43_PHYTYPE_HT:
                b43_rate_memory_write(dev, B43_OFDM_RATE_6MB, 1);
                b43_rate_memory_write(dev, B43_OFDM_RATE_12MB, 1);
                b43_rate_memory_write(dev, B43_OFDM_RATE_18MB, 1);
@@ -3778,14 +3789,24 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
        struct ieee80211_conf *conf = &hw->conf;
        int antenna;
        int err = 0;
+       bool reload_bss = false;
 
        mutex_lock(&wl->mutex);
 
+       dev = wl->current_dev;
+
        /* Switch the band (if necessary). This might change the active core. */
        err = b43_switch_band(wl, conf->channel);
        if (err)
                goto out_unlock_mutex;
-       dev = wl->current_dev;
+
+       /* Need to reload all settings if the core changed */
+       if (dev != wl->current_dev) {
+               dev = wl->current_dev;
+               changed = ~0;
+               reload_bss = true;
+       }
+
        phy = &dev->phy;
 
        if (conf_is_ht(conf))
@@ -3846,6 +3867,9 @@ out_mac_enable:
 out_unlock_mutex:
        mutex_unlock(&wl->mutex);
 
+       if (wl->vif && reload_bss)
+               b43_op_bss_info_changed(hw, wl->vif, &wl->vif->bss_conf, ~0);
+
        return err;
 }
 
@@ -3934,7 +3958,8 @@ static void b43_op_bss_info_changed(struct ieee80211_hw *hw,
        if (changed & BSS_CHANGED_BEACON_INT &&
            (b43_is_mode(wl, NL80211_IFTYPE_AP) ||
             b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT) ||
-            b43_is_mode(wl, NL80211_IFTYPE_ADHOC)))
+            b43_is_mode(wl, NL80211_IFTYPE_ADHOC)) &&
+           conf->beacon_int)
                b43_set_beacon_int(dev, conf->beacon_int);
 
        if (changed & BSS_CHANGED_BASIC_RATES)
@@ -4271,7 +4296,7 @@ static int b43_phy_versioning(struct b43_wldev *dev)
 #endif
        default:
                unsupported = 1;
-       };
+       }
        if (unsupported) {
                b43err(dev->wl, "FOUND UNSUPPORTED PHY "
                       "(Analog %u, Type %u, Revision %u)\n",
@@ -4702,6 +4727,9 @@ static int b43_op_add_interface(struct ieee80211_hw *hw,
  out_mutex_unlock:
        mutex_unlock(&wl->mutex);
 
+       if (err == 0)
+               b43_op_bss_info_changed(hw, vif, &vif->bss_conf, ~0);
+
        return err;
 }
 
@@ -4772,6 +4800,9 @@ static int b43_op_start(struct ieee80211_hw *hw)
  out_mutex_unlock:
        mutex_unlock(&wl->mutex);
 
+       /* reload configuration */
+       b43_op_config(hw, ~0);
+
        return err;
 }
 
@@ -4928,10 +4959,18 @@ out:
        if (err)
                wl->current_dev = NULL; /* Failed to init the dev. */
        mutex_unlock(&wl->mutex);
-       if (err)
+
+       if (err) {
                b43err(wl, "Controller restart FAILED\n");
-       else
-               b43info(wl, "Controller restarted\n");
+               return;
+       }
+
+       /* reload configuration */
+       b43_op_config(wl->hw, ~0);
+       if (wl->vif)
+               b43_op_bss_info_changed(wl->hw, wl->vif, &wl->vif->bss_conf, ~0);
+
+       b43info(wl, "Controller restarted\n");
 }
 
 static int b43_setup_bands(struct b43_wldev *dev,
This page took 0.038819 seconds and 5 git commands to generate.