diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-10-10 21:11:01 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-11 15:04:24 -0400 |
commit | a656b6a9665dce09a8f273091f1b4aa3d5cec721 (patch) | |
tree | 6ebcdf11685d51698458e3788124d4f770dbec5c /drivers/net/wireless/b43/phy_n.c | |
parent | a8909cfb1832ac623142898df2a9374722cfe68f (diff) |
b43: N-PHY: grab more info about new channel
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy_n.c')
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 52ce4383a056..6ca41a09fec4 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -3323,9 +3323,9 @@ int b43_phy_initn(struct b43_wldev *dev) | |||
3323 | } | 3323 | } |
3324 | 3324 | ||
3325 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */ | 3325 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */ |
3326 | static void b43_nphy_chanspec_setup(struct b43_wldev *dev, | 3326 | static void b43_nphy_channel_setup(struct b43_wldev *dev, |
3327 | const struct b43_phy_n_sfo_cfg *e, | 3327 | const struct b43_phy_n_sfo_cfg *e, |
3328 | struct b43_chanspec chanspec) | 3328 | struct ieee80211_channel *new_channel) |
3329 | { | 3329 | { |
3330 | struct b43_phy *phy = &dev->phy; | 3330 | struct b43_phy *phy = &dev->phy; |
3331 | struct b43_phy_n *nphy = dev->phy.n; | 3331 | struct b43_phy_n *nphy = dev->phy.n; |
@@ -3334,13 +3334,13 @@ static void b43_nphy_chanspec_setup(struct b43_wldev *dev, | |||
3334 | u32 tmp32; | 3334 | u32 tmp32; |
3335 | 3335 | ||
3336 | tmp = b43_phy_read(dev, B43_NPHY_BANDCTL) & B43_NPHY_BANDCTL_5GHZ; | 3336 | tmp = b43_phy_read(dev, B43_NPHY_BANDCTL) & B43_NPHY_BANDCTL_5GHZ; |
3337 | if (chanspec.b_freq == 1 && tmp == 0) { | 3337 | if (new_channel->band == IEEE80211_BAND_5GHZ && tmp == 0) { |
3338 | tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR); | 3338 | tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR); |
3339 | b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4); | 3339 | b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4); |
3340 | b43_phy_set(dev, B43_PHY_B_BBCFG, 0xC000); | 3340 | b43_phy_set(dev, B43_PHY_B_BBCFG, 0xC000); |
3341 | b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32); | 3341 | b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32); |
3342 | b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ); | 3342 | b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ); |
3343 | } else if (chanspec.b_freq == 1) { | 3343 | } else if (new_channel->band == IEEE80211_BAND_5GHZ) { |
3344 | b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ); | 3344 | b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ); |
3345 | tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR); | 3345 | tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR); |
3346 | b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4); | 3346 | b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4); |
@@ -3350,13 +3350,12 @@ static void b43_nphy_chanspec_setup(struct b43_wldev *dev, | |||
3350 | 3350 | ||
3351 | b43_chantab_phy_upload(dev, e); | 3351 | b43_chantab_phy_upload(dev, e); |
3352 | 3352 | ||
3353 | 3353 | if (new_channel->hw_value == 14) { | |
3354 | if (nphy->radio_chanspec.channel == 14) { | ||
3355 | b43_nphy_classifier(dev, 2, 0); | 3354 | b43_nphy_classifier(dev, 2, 0); |
3356 | b43_phy_set(dev, B43_PHY_B_TEST, 0x0800); | 3355 | b43_phy_set(dev, B43_PHY_B_TEST, 0x0800); |
3357 | } else { | 3356 | } else { |
3358 | b43_nphy_classifier(dev, 2, 2); | 3357 | b43_nphy_classifier(dev, 2, 2); |
3359 | if (chanspec.b_freq == 2) | 3358 | if (new_channel->band == IEEE80211_BAND_2GHZ) |
3360 | b43_phy_mask(dev, B43_PHY_B_TEST, ~0x840); | 3359 | b43_phy_mask(dev, B43_PHY_B_TEST, ~0x840); |
3361 | } | 3360 | } |
3362 | 3361 | ||
@@ -3379,16 +3378,17 @@ static void b43_nphy_chanspec_setup(struct b43_wldev *dev, | |||
3379 | } | 3378 | } |
3380 | 3379 | ||
3381 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */ | 3380 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */ |
3382 | static int b43_nphy_set_chanspec(struct b43_wldev *dev, | 3381 | static int b43_nphy_set_channel(struct b43_wldev *dev, |
3383 | struct b43_chanspec chanspec) | 3382 | struct ieee80211_channel *channel, |
3383 | enum nl80211_channel_type channel_type) | ||
3384 | { | 3384 | { |
3385 | struct b43_phy *phy = &dev->phy; | ||
3385 | struct b43_phy_n *nphy = dev->phy.n; | 3386 | struct b43_phy_n *nphy = dev->phy.n; |
3386 | 3387 | ||
3387 | const struct b43_nphy_channeltab_entry_rev2 *tabent_r2; | 3388 | const struct b43_nphy_channeltab_entry_rev2 *tabent_r2; |
3388 | const struct b43_nphy_channeltab_entry_rev3 *tabent_r3; | 3389 | const struct b43_nphy_channeltab_entry_rev3 *tabent_r3; |
3389 | 3390 | ||
3390 | u8 tmp; | 3391 | u8 tmp; |
3391 | u8 channel = chanspec.channel; | ||
3392 | 3392 | ||
3393 | if (dev->phy.rev >= 3) { | 3393 | if (dev->phy.rev >= 3) { |
3394 | /* TODO */ | 3394 | /* TODO */ |
@@ -3396,36 +3396,36 @@ static int b43_nphy_set_chanspec(struct b43_wldev *dev, | |||
3396 | if (!tabent_r3) | 3396 | if (!tabent_r3) |
3397 | return -ESRCH; | 3397 | return -ESRCH; |
3398 | } else { | 3398 | } else { |
3399 | tabent_r2 = b43_nphy_get_chantabent_rev2(dev, channel); | 3399 | tabent_r2 = b43_nphy_get_chantabent_rev2(dev, |
3400 | channel->hw_value); | ||
3400 | if (!tabent_r2) | 3401 | if (!tabent_r2) |
3401 | return -ESRCH; | 3402 | return -ESRCH; |
3402 | } | 3403 | } |
3403 | 3404 | ||
3404 | nphy->radio_chanspec = chanspec; | 3405 | nphy->radio_chanspec.channel = channel->hw_value; |
3405 | 3406 | ||
3407 | /* | ||
3406 | if (chanspec.b_width != nphy->b_width) | 3408 | if (chanspec.b_width != nphy->b_width) |
3407 | ; /* TODO: BMAC BW Set (chanspec.b_width) */ | 3409 | ; TODO: BMAC BW Set (chanspec.b_width) |
3410 | */ | ||
3408 | 3411 | ||
3409 | /* TODO: use defines */ | 3412 | if (channel_type == NL80211_CHAN_HT40PLUS) |
3410 | if (chanspec.b_width == 3) { | 3413 | b43_phy_set(dev, B43_NPHY_RXCTL, |
3411 | if (chanspec.sideband == 2) | 3414 | B43_NPHY_RXCTL_BSELU20); |
3412 | b43_phy_set(dev, B43_NPHY_RXCTL, | 3415 | else if (channel_type == NL80211_CHAN_HT40MINUS) |
3413 | B43_NPHY_RXCTL_BSELU20); | 3416 | b43_phy_mask(dev, B43_NPHY_RXCTL, |
3414 | else | 3417 | ~B43_NPHY_RXCTL_BSELU20); |
3415 | b43_phy_mask(dev, B43_NPHY_RXCTL, | ||
3416 | ~B43_NPHY_RXCTL_BSELU20); | ||
3417 | } | ||
3418 | 3418 | ||
3419 | if (dev->phy.rev >= 3) { | 3419 | if (dev->phy.rev >= 3) { |
3420 | tmp = (chanspec.b_freq == 1) ? 4 : 0; | 3420 | tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 4 : 0; |
3421 | b43_radio_maskset(dev, 0x08, 0xFFFB, tmp); | 3421 | b43_radio_maskset(dev, 0x08, 0xFFFB, tmp); |
3422 | /* TODO: PHY Radio2056 Setup (dev, tabent_r3); */ | 3422 | /* TODO: PHY Radio2056 Setup (dev, tabent_r3); */ |
3423 | b43_nphy_chanspec_setup(dev, &(tabent_r3->phy_regs), chanspec); | 3423 | b43_nphy_channel_setup(dev, &(tabent_r3->phy_regs), channel); |
3424 | } else { | 3424 | } else { |
3425 | tmp = (chanspec.b_freq == 1) ? 0x0020 : 0x0050; | 3425 | tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 0x0020 : 0x0050; |
3426 | b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp); | 3426 | b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp); |
3427 | b43_radio_2055_setup(dev, tabent_r2); | 3427 | b43_radio_2055_setup(dev, tabent_r2); |
3428 | b43_nphy_chanspec_setup(dev, &(tabent_r2->phy_regs), chanspec); | 3428 | b43_nphy_channel_setup(dev, &(tabent_r2->phy_regs), channel); |
3429 | } | 3429 | } |
3430 | 3430 | ||
3431 | return 0; | 3431 | return 0; |
@@ -3567,8 +3567,8 @@ static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on) | |||
3567 | static int b43_nphy_op_switch_channel(struct b43_wldev *dev, | 3567 | static int b43_nphy_op_switch_channel(struct b43_wldev *dev, |
3568 | unsigned int new_channel) | 3568 | unsigned int new_channel) |
3569 | { | 3569 | { |
3570 | struct b43_phy_n *nphy = dev->phy.n; | 3570 | struct ieee80211_channel *channel = dev->wl->hw->conf.channel; |
3571 | struct b43_chanspec chanspec; | 3571 | enum nl80211_channel_type channel_type = dev->wl->hw->conf.channel_type; |
3572 | 3572 | ||
3573 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | 3573 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { |
3574 | if ((new_channel < 1) || (new_channel > 14)) | 3574 | if ((new_channel < 1) || (new_channel > 14)) |
@@ -3578,10 +3578,7 @@ static int b43_nphy_op_switch_channel(struct b43_wldev *dev, | |||
3578 | return -EINVAL; | 3578 | return -EINVAL; |
3579 | } | 3579 | } |
3580 | 3580 | ||
3581 | chanspec = nphy->radio_chanspec; | 3581 | return b43_nphy_set_channel(dev, channel, channel_type); |
3582 | chanspec.channel = new_channel; | ||
3583 | |||
3584 | return b43_nphy_set_chanspec(dev, chanspec); | ||
3585 | } | 3582 | } |
3586 | 3583 | ||
3587 | static unsigned int b43_nphy_op_get_default_chan(struct b43_wldev *dev) | 3584 | static unsigned int b43_nphy_op_get_default_chan(struct b43_wldev *dev) |