Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[pandora-kernel.git] / drivers / net / wireless / b43 / phy_n.c
index 3c35382..7ed39e9 100644 (file)
@@ -1564,7 +1564,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
        u16 clip_off[2] = { 0xFFFF, 0xFFFF };
 
        u8 vcm_final = 0;
-       s8 offset[4];
+       s32 offset[4];
        s32 results[8][4] = { };
        s32 results_min[4] = { };
        s32 poll_results[4] = { };
@@ -1615,7 +1615,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
                }
                for (i = 0; i < 4; i += 2) {
                        s32 curr;
-                       s32 mind = 40;
+                       s32 mind = 0x100000;
                        s32 minpoll = 249;
                        u8 minvcm = 0;
                        if (2 * core != i)
@@ -1732,7 +1732,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
        u8 regs_save_radio[2];
        u16 regs_save_phy[2];
 
-       s8 offset[4];
+       s32 offset[4];
        u8 core;
        u8 rail;
 
@@ -1799,7 +1799,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
        }
 
        for (i = 0; i < 4; i++) {
-               s32 mind = 40;
+               s32 mind = 0x100000;
                u8 minvcm = 0;
                s32 minpoll = 249;
                s32 curr;
@@ -2789,10 +2789,6 @@ static void b43_nphy_iq_cal_gain_params(struct b43_wldev *dev, u16 core,
  * Tx and Rx
  **************************************************/
 
-void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
-{//TODO
-}
-
 static void b43_nphy_op_adjust_txpower(struct b43_wldev *dev)
 {//TODO
 }
@@ -4892,7 +4888,7 @@ static void b43_nphy_superswitch_init(struct b43_wldev *dev, bool init)
 }
 
 /* http://bcm-v4.sipsolutions.net/802.11/PHY/Init/N */
-int b43_phy_initn(struct b43_wldev *dev)
+static int b43_phy_initn(struct b43_wldev *dev)
 {
        struct ssb_sprom *sprom = dev->dev->bus_sprom;
        struct b43_phy *phy = &dev->phy;
@@ -5104,68 +5100,17 @@ static void b43_chantab_phy_upload(struct b43_wldev *dev,
 /* http://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */
 static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid)
 {
-       struct bcma_drv_cc __maybe_unused *cc;
-       u32 __maybe_unused pmu_ctl;
-
        switch (dev->dev->bus_type) {
 #ifdef CONFIG_B43_BCMA
        case B43_BUS_BCMA:
-               cc = &dev->dev->bdev->bus->drv_cc;
-               if (dev->dev->chip_id == 43224 || dev->dev->chip_id == 43225) {
-                       if (avoid) {
-                               bcma_chipco_pll_write(cc, 0x0, 0x11500010);
-                               bcma_chipco_pll_write(cc, 0x1, 0x000C0C06);
-                               bcma_chipco_pll_write(cc, 0x2, 0x0F600a08);
-                               bcma_chipco_pll_write(cc, 0x3, 0x00000000);
-                               bcma_chipco_pll_write(cc, 0x4, 0x2001E920);
-                               bcma_chipco_pll_write(cc, 0x5, 0x88888815);
-                       } else {
-                               bcma_chipco_pll_write(cc, 0x0, 0x11100010);
-                               bcma_chipco_pll_write(cc, 0x1, 0x000c0c06);
-                               bcma_chipco_pll_write(cc, 0x2, 0x03000a08);
-                               bcma_chipco_pll_write(cc, 0x3, 0x00000000);
-                               bcma_chipco_pll_write(cc, 0x4, 0x200005c0);
-                               bcma_chipco_pll_write(cc, 0x5, 0x88888815);
-                       }
-                       pmu_ctl = BCMA_CC_PMU_CTL_PLL_UPD;
-               } else if (dev->dev->chip_id == 0x4716) {
-                       if (avoid) {
-                               bcma_chipco_pll_write(cc, 0x0, 0x11500060);
-                               bcma_chipco_pll_write(cc, 0x1, 0x080C0C06);
-                               bcma_chipco_pll_write(cc, 0x2, 0x0F600000);
-                               bcma_chipco_pll_write(cc, 0x3, 0x00000000);
-                               bcma_chipco_pll_write(cc, 0x4, 0x2001E924);
-                               bcma_chipco_pll_write(cc, 0x5, 0x88888815);
-                       } else {
-                               bcma_chipco_pll_write(cc, 0x0, 0x11100060);
-                               bcma_chipco_pll_write(cc, 0x1, 0x080c0c06);
-                               bcma_chipco_pll_write(cc, 0x2, 0x03000000);
-                               bcma_chipco_pll_write(cc, 0x3, 0x00000000);
-                               bcma_chipco_pll_write(cc, 0x4, 0x200005c0);
-                               bcma_chipco_pll_write(cc, 0x5, 0x88888815);
-                       }
-                       pmu_ctl = BCMA_CC_PMU_CTL_PLL_UPD |
-                                 BCMA_CC_PMU_CTL_NOILPONW;
-               } else if (dev->dev->chip_id == 0x4322 ||
-                          dev->dev->chip_id == 0x4340 ||
-                          dev->dev->chip_id == 0x4341) {
-                       bcma_chipco_pll_write(cc, 0x0, 0x11100070);
-                       bcma_chipco_pll_write(cc, 0x1, 0x1014140a);
-                       bcma_chipco_pll_write(cc, 0x5, 0x88888854);
-                       if (avoid)
-                               bcma_chipco_pll_write(cc, 0x2, 0x05201828);
-                       else
-                               bcma_chipco_pll_write(cc, 0x2, 0x05001828);
-                       pmu_ctl = BCMA_CC_PMU_CTL_PLL_UPD;
-               } else {
-                       return;
-               }
-               bcma_cc_set32(cc, BCMA_CC_PMU_CTL, pmu_ctl);
+               bcma_pmu_spuravoid_pllupdate(&dev->dev->bdev->bus->drv_cc,
+                                            avoid);
                break;
 #endif
 #ifdef CONFIG_B43_SSB
        case B43_BUS_SSB:
-               /* FIXME */
+               ssb_pmu_spuravoid_pllupdate(&dev->dev->sdev->bus->chipco,
+                                           avoid);
                break;
 #endif
        }
@@ -5530,8 +5475,9 @@ static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on)
 static int b43_nphy_op_switch_channel(struct b43_wldev *dev,
                                      unsigned int new_channel)
 {
-       struct ieee80211_channel *channel = dev->wl->hw->conf.channel;
-       enum nl80211_channel_type channel_type = dev->wl->hw->conf.channel_type;
+       struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan;
+       enum nl80211_channel_type channel_type =
+               cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef);
 
        if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
                if ((new_channel < 1) || (new_channel > 14))