aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/b43/b43.h15
-rw-r--r--drivers/net/wireless/b43/main.c137
2 files changed, 60 insertions, 92 deletions
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index c19b773c978a..086a9c6c2b07 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -328,17 +328,22 @@ enum {
328#define B43_MACCMD_CCA 0x00000008 /* Clear channel assessment */ 328#define B43_MACCMD_CCA 0x00000008 /* Clear channel assessment */
329#define B43_MACCMD_BGNOISE 0x00000010 /* Background noise */ 329#define B43_MACCMD_BGNOISE 0x00000010 /* Background noise */
330 330
331/* 802.11 core specific TM State Low flags */ 331/* 802.11 core specific TM State Low (SSB_TMSLOW) flags */
332#define B43_TMSLOW_GMODE 0x20000000 /* G Mode Enable */ 332#define B43_TMSLOW_GMODE 0x20000000 /* G Mode Enable */
333#define B43_TMSLOW_PLLREFSEL 0x00200000 /* PLL Frequency Reference Select */ 333#define B43_TMSLOW_PHYCLKSPEED 0x00C00000 /* PHY clock speed mask (N-PHY only) */
334#define B43_TMSLOW_PHYCLKSPEED_40MHZ 0x00000000 /* 40 MHz PHY */
335#define B43_TMSLOW_PHYCLKSPEED_80MHZ 0x00400000 /* 80 MHz PHY */
336#define B43_TMSLOW_PHYCLKSPEED_160MHZ 0x00800000 /* 160 MHz PHY */
337#define B43_TMSLOW_PLLREFSEL 0x00200000 /* PLL Frequency Reference Select (rev >= 5) */
334#define B43_TMSLOW_MACPHYCLKEN 0x00100000 /* MAC PHY Clock Control Enable (rev >= 5) */ 338#define B43_TMSLOW_MACPHYCLKEN 0x00100000 /* MAC PHY Clock Control Enable (rev >= 5) */
335#define B43_TMSLOW_PHYRESET 0x00080000 /* PHY Reset */ 339#define B43_TMSLOW_PHYRESET 0x00080000 /* PHY Reset */
336#define B43_TMSLOW_PHYCLKEN 0x00040000 /* PHY Clock Enable */ 340#define B43_TMSLOW_PHYCLKEN 0x00040000 /* PHY Clock Enable */
337 341
338/* 802.11 core specific TM State High flags */ 342/* 802.11 core specific TM State High (SSB_TMSHIGH) flags */
343#define B43_TMSHIGH_DUALBAND_PHY 0x00080000 /* Dualband PHY available */
339#define B43_TMSHIGH_FCLOCK 0x00040000 /* Fast Clock Available (rev >= 5) */ 344#define B43_TMSHIGH_FCLOCK 0x00040000 /* Fast Clock Available (rev >= 5) */
340#define B43_TMSHIGH_APHY 0x00020000 /* A-PHY available (rev >= 5) */ 345#define B43_TMSHIGH_HAVE_5GHZ_PHY 0x00020000 /* 5 GHz PHY available (rev >= 5) */
341#define B43_TMSHIGH_GPHY 0x00010000 /* G-PHY available (rev >= 5) */ 346#define B43_TMSHIGH_HAVE_2GHZ_PHY 0x00010000 /* 2.4 GHz PHY available (rev >= 5) */
342 347
343/* Generic-Interrupt reasons. */ 348/* Generic-Interrupt reasons. */
344#define B43_IRQ_MAC_SUSPENDED 0x00000001 349#define B43_IRQ_MAC_SUSPENDED 0x00000001
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 39eaeb5598b5..7125af6f242a 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -132,7 +132,7 @@ static struct ieee80211_rate __b43_ratetable[] = {
132 .power_level = 0xFF, \ 132 .power_level = 0xFF, \
133 .antenna_max = 0xFF, \ 133 .antenna_max = 0xFF, \
134 } 134 }
135static struct ieee80211_channel b43_bg_chantable[] = { 135static struct ieee80211_channel b43_2ghz_chantable[] = {
136 CHANTAB_ENT(1, 2412), 136 CHANTAB_ENT(1, 2412),
137 CHANTAB_ENT(2, 2417), 137 CHANTAB_ENT(2, 2417),
138 CHANTAB_ENT(3, 2422), 138 CHANTAB_ENT(3, 2422),
@@ -148,9 +148,10 @@ static struct ieee80211_channel b43_bg_chantable[] = {
148 CHANTAB_ENT(13, 2472), 148 CHANTAB_ENT(13, 2472),
149 CHANTAB_ENT(14, 2484), 149 CHANTAB_ENT(14, 2484),
150}; 150};
151#define b43_2ghz_chantable_size ARRAY_SIZE(b43_2ghz_chantable)
151 152
152#define b43_bg_chantable_size ARRAY_SIZE(b43_bg_chantable) 153#if 0
153static struct ieee80211_channel b43_a_chantable[] = { 154static struct ieee80211_channel b43_5ghz_chantable[] = {
154 CHANTAB_ENT(36, 5180), 155 CHANTAB_ENT(36, 5180),
155 CHANTAB_ENT(40, 5200), 156 CHANTAB_ENT(40, 5200),
156 CHANTAB_ENT(44, 5220), 157 CHANTAB_ENT(44, 5220),
@@ -165,8 +166,8 @@ static struct ieee80211_channel b43_a_chantable[] = {
165 CHANTAB_ENT(161, 5805), 166 CHANTAB_ENT(161, 5805),
166 CHANTAB_ENT(165, 5825), 167 CHANTAB_ENT(165, 5825),
167}; 168};
168 169#define b43_5ghz_chantable_size ARRAY_SIZE(b43_5ghz_chantable)
169#define b43_a_chantable_size ARRAY_SIZE(b43_a_chantable) 170#endif
170 171
171static void b43_wireless_core_exit(struct b43_wldev *dev); 172static void b43_wireless_core_exit(struct b43_wldev *dev);
172static int b43_wireless_core_init(struct b43_wldev *dev); 173static int b43_wireless_core_init(struct b43_wldev *dev);
@@ -1614,7 +1615,7 @@ static int b43_request_firmware(struct b43_wldev *dev)
1614 switch (dev->phy.type) { 1615 switch (dev->phy.type) {
1615 case B43_PHYTYPE_A: 1616 case B43_PHYTYPE_A:
1616 if ((rev >= 5) && (rev <= 10)) { 1617 if ((rev >= 5) && (rev <= 10)) {
1617 if (tmshigh & B43_TMSHIGH_GPHY) 1618 if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY)
1618 filename = "a0g1initvals5"; 1619 filename = "a0g1initvals5";
1619 else 1620 else
1620 filename = "a0g0initvals5"; 1621 filename = "a0g0initvals5";
@@ -1640,7 +1641,7 @@ static int b43_request_firmware(struct b43_wldev *dev)
1640 switch (dev->phy.type) { 1641 switch (dev->phy.type) {
1641 case B43_PHYTYPE_A: 1642 case B43_PHYTYPE_A:
1642 if ((rev >= 5) && (rev <= 10)) { 1643 if ((rev >= 5) && (rev <= 10)) {
1643 if (tmshigh & B43_TMSHIGH_GPHY) 1644 if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY)
1644 filename = "a0g1bsinitvals5"; 1645 filename = "a0g1bsinitvals5";
1645 else 1646 else
1646 filename = "a0g0bsinitvals5"; 1647 filename = "a0g0bsinitvals5";
@@ -3090,6 +3091,8 @@ static int b43_phy_versioning(struct b43_wldev *dev)
3090 radio_manuf = (tmp & 0x00000FFF); 3091 radio_manuf = (tmp & 0x00000FFF);
3091 radio_ver = (tmp & 0x0FFFF000) >> 12; 3092 radio_ver = (tmp & 0x0FFFF000) >> 12;
3092 radio_rev = (tmp & 0xF0000000) >> 28; 3093 radio_rev = (tmp & 0xF0000000) >> 28;
3094 if (radio_manuf != 0x17F /* Broadcom */)
3095 unsupported = 1;
3093 switch (phy_type) { 3096 switch (phy_type) {
3094 case B43_PHYTYPE_A: 3097 case B43_PHYTYPE_A:
3095 if (radio_ver != 0x2060) 3098 if (radio_ver != 0x2060)
@@ -3107,6 +3110,10 @@ static int b43_phy_versioning(struct b43_wldev *dev)
3107 if (radio_ver != 0x2050) 3110 if (radio_ver != 0x2050)
3108 unsupported = 1; 3111 unsupported = 1;
3109 break; 3112 break;
3113 case B43_PHYTYPE_N:
3114 if (radio_ver != 5)
3115 unsupported = 1;
3116 break;
3110 default: 3117 default:
3111 B43_WARN_ON(1); 3118 B43_WARN_ON(1);
3112 } 3119 }
@@ -3610,72 +3617,30 @@ static void b43_chip_reset(struct work_struct *work)
3610} 3617}
3611 3618
3612static int b43_setup_modes(struct b43_wldev *dev, 3619static int b43_setup_modes(struct b43_wldev *dev,
3613 int have_aphy, int have_bphy, int have_gphy) 3620 bool have_2ghz_phy, bool have_5ghz_phy)
3614{ 3621{
3615 struct ieee80211_hw *hw = dev->wl->hw; 3622 struct ieee80211_hw *hw = dev->wl->hw;
3616 struct ieee80211_hw_mode *mode; 3623 struct ieee80211_hw_mode *mode;
3617 struct b43_phy *phy = &dev->phy; 3624 struct b43_phy *phy = &dev->phy;
3618 int cnt = 0;
3619 int err; 3625 int err;
3620 3626
3621/*FIXME: Don't tell ieee80211 about an A-PHY, because we currently don't support A-PHY. */ 3627 /* XXX: This function will go away soon, when mac80211
3622 have_aphy = 0; 3628 * band stuff is rewritten. So this is just a hack.
3623 3629 * For now we always claim GPHY mode, as there is no
3624 phy->possible_phymodes = 0; 3630 * support for NPHY and APHY in the device, yet.
3625 for (; 1; cnt++) { 3631 * This assumption is OK, as any B, N or A PHY will already
3626 if (have_aphy) { 3632 * have died a horrible sanity check death earlier. */
3627 B43_WARN_ON(cnt >= B43_MAX_PHYHWMODES); 3633
3628 mode = &phy->hwmodes[cnt]; 3634 mode = &phy->hwmodes[0];
3629 3635 mode->mode = MODE_IEEE80211G;
3630 mode->mode = MODE_IEEE80211A; 3636 mode->num_channels = b43_2ghz_chantable_size;
3631 mode->num_channels = b43_a_chantable_size; 3637 mode->channels = b43_2ghz_chantable;
3632 mode->channels = b43_a_chantable; 3638 mode->num_rates = b43_g_ratetable_size;
3633 mode->num_rates = b43_a_ratetable_size; 3639 mode->rates = b43_g_ratetable;
3634 mode->rates = b43_a_ratetable; 3640 err = ieee80211_register_hwmode(hw, mode);
3635 err = ieee80211_register_hwmode(hw, mode); 3641 if (err)
3636 if (err) 3642 return err;
3637 return err; 3643 phy->possible_phymodes |= B43_PHYMODE_G;
3638
3639 phy->possible_phymodes |= B43_PHYMODE_A;
3640 have_aphy = 0;
3641 continue;
3642 }
3643 if (have_bphy) {
3644 B43_WARN_ON(cnt >= B43_MAX_PHYHWMODES);
3645 mode = &phy->hwmodes[cnt];
3646
3647 mode->mode = MODE_IEEE80211B;
3648 mode->num_channels = b43_bg_chantable_size;
3649 mode->channels = b43_bg_chantable;
3650 mode->num_rates = b43_b_ratetable_size;
3651 mode->rates = b43_b_ratetable;
3652 err = ieee80211_register_hwmode(hw, mode);
3653 if (err)
3654 return err;
3655
3656 phy->possible_phymodes |= B43_PHYMODE_B;
3657 have_bphy = 0;
3658 continue;
3659 }
3660 if (have_gphy) {
3661 B43_WARN_ON(cnt >= B43_MAX_PHYHWMODES);
3662 mode = &phy->hwmodes[cnt];
3663
3664 mode->mode = MODE_IEEE80211G;
3665 mode->num_channels = b43_bg_chantable_size;
3666 mode->channels = b43_bg_chantable;
3667 mode->num_rates = b43_g_ratetable_size;
3668 mode->rates = b43_g_ratetable;
3669 err = ieee80211_register_hwmode(hw, mode);
3670 if (err)
3671 return err;
3672
3673 phy->possible_phymodes |= B43_PHYMODE_G;
3674 have_gphy = 0;
3675 continue;
3676 }
3677 break;
3678 }
3679 3644
3680 return 0; 3645 return 0;
3681} 3646}
@@ -3693,7 +3658,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
3693 struct ssb_bus *bus = dev->dev->bus; 3658 struct ssb_bus *bus = dev->dev->bus;
3694 struct pci_dev *pdev = bus->host_pci; 3659 struct pci_dev *pdev = bus->host_pci;
3695 int err; 3660 int err;
3696 int have_aphy = 0, have_bphy = 0, have_gphy = 0; 3661 bool have_2ghz_phy = 0, have_5ghz_phy = 0;
3697 u32 tmp; 3662 u32 tmp;
3698 3663
3699 /* Do NOT do any device initialization here. 3664 /* Do NOT do any device initialization here.
@@ -3713,17 +3678,12 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
3713 u32 tmshigh; 3678 u32 tmshigh;
3714 3679
3715 tmshigh = ssb_read32(dev->dev, SSB_TMSHIGH); 3680 tmshigh = ssb_read32(dev->dev, SSB_TMSHIGH);
3716 have_aphy = !!(tmshigh & B43_TMSHIGH_APHY); 3681 have_2ghz_phy = !!(tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY);
3717 have_gphy = !!(tmshigh & B43_TMSHIGH_GPHY); 3682 have_5ghz_phy = !!(tmshigh & B43_TMSHIGH_HAVE_5GHZ_PHY);
3718 if (!have_aphy && !have_gphy)
3719 have_bphy = 1;
3720 } else if (dev->dev->id.revision == 4) {
3721 have_gphy = 1;
3722 have_aphy = 1;
3723 } else 3683 } else
3724 have_bphy = 1; 3684 B43_WARN_ON(1);
3725 3685
3726 dev->phy.gmode = (have_gphy || have_bphy); 3686 dev->phy.gmode = have_2ghz_phy;
3727 tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; 3687 tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0;
3728 b43_wireless_core_reset(dev, tmp); 3688 b43_wireless_core_reset(dev, tmp);
3729 3689
@@ -3735,31 +3695,34 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
3735 (pdev->device != 0x4312 && 3695 (pdev->device != 0x4312 &&
3736 pdev->device != 0x4319 && pdev->device != 0x4324)) { 3696 pdev->device != 0x4319 && pdev->device != 0x4324)) {
3737 /* No multiband support. */ 3697 /* No multiband support. */
3738 have_aphy = 0; 3698 have_2ghz_phy = 0;
3739 have_bphy = 0; 3699 have_5ghz_phy = 0;
3740 have_gphy = 0;
3741 switch (dev->phy.type) { 3700 switch (dev->phy.type) {
3742 case B43_PHYTYPE_A: 3701 case B43_PHYTYPE_A:
3743 have_aphy = 1; 3702 have_5ghz_phy = 1;
3744 break;
3745 case B43_PHYTYPE_B:
3746 have_bphy = 1;
3747 break; 3703 break;
3748 case B43_PHYTYPE_G: 3704 case B43_PHYTYPE_G:
3749 have_gphy = 1; 3705 case B43_PHYTYPE_N:
3706 have_2ghz_phy = 1;
3750 break; 3707 break;
3751 default: 3708 default:
3752 B43_WARN_ON(1); 3709 B43_WARN_ON(1);
3753 } 3710 }
3754 } 3711 }
3755 dev->phy.gmode = (have_gphy || have_bphy); 3712 if (dev->phy.type == B43_PHYTYPE_A) {
3713 /* FIXME */
3714 b43err(wl, "IEEE 802.11a devices are unsupported\n");
3715 err = -EOPNOTSUPP;
3716 goto err_powerdown;
3717 }
3718 dev->phy.gmode = have_2ghz_phy;
3756 tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; 3719 tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0;
3757 b43_wireless_core_reset(dev, tmp); 3720 b43_wireless_core_reset(dev, tmp);
3758 3721
3759 err = b43_validate_chipaccess(dev); 3722 err = b43_validate_chipaccess(dev);
3760 if (err) 3723 if (err)
3761 goto err_powerdown; 3724 goto err_powerdown;
3762 err = b43_setup_modes(dev, have_aphy, have_bphy, have_gphy); 3725 err = b43_setup_modes(dev, have_2ghz_phy, have_5ghz_phy);
3763 if (err) 3726 if (err)
3764 goto err_powerdown; 3727 goto err_powerdown;
3765 3728