diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-02-27 07:03:41 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-09 15:06:57 -0500 |
commit | eff66c519e8087e18526a6e0c5ee3dd1de1bc792 (patch) | |
tree | 020bc0b6b6af29806477b4201ce9c18712fb1813 /drivers | |
parent | 1b69ec7bac9cc0688ecf1411d167d1b8a34aeb07 (diff) |
b43: N-PHY: switch to chanspec ops
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 87 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_n.h | 1 |
2 files changed, 63 insertions, 25 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 862223fdde4d..6fd140ac7f9e 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -72,6 +72,7 @@ static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field, | |||
72 | u16 value, u8 core, bool off); | 72 | u16 value, u8 core, bool off); |
73 | static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field, | 73 | static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field, |
74 | u16 value, u8 core); | 74 | u16 value, u8 core); |
75 | static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel); | ||
75 | 76 | ||
76 | static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec) | 77 | static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec) |
77 | { | 78 | { |
@@ -171,31 +172,6 @@ static void b43_radio_2055_setup(struct b43_wldev *dev, | |||
171 | udelay(300); | 172 | udelay(300); |
172 | } | 173 | } |
173 | 174 | ||
174 | /* Tune the hardware to a new channel. */ | ||
175 | static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel) | ||
176 | { | ||
177 | const struct b43_nphy_channeltab_entry *tabent; | ||
178 | |||
179 | tabent = b43_nphy_get_chantabent(dev, channel); | ||
180 | if (!tabent) | ||
181 | return -ESRCH; | ||
182 | |||
183 | //FIXME enable/disable band select upper20 in RXCTL | ||
184 | if (0 /*FIXME 5Ghz*/) | ||
185 | b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x20); | ||
186 | else | ||
187 | b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x50); | ||
188 | b43_radio_2055_setup(dev, tabent); | ||
189 | if (0 /*FIXME 5Ghz*/) | ||
190 | b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ); | ||
191 | else | ||
192 | b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ); | ||
193 | b43_chantab_phy_upload(dev, tabent); | ||
194 | b43_nphy_tx_power_fix(dev); | ||
195 | |||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | static void b43_radio_init2055_pre(struct b43_wldev *dev) | 175 | static void b43_radio_init2055_pre(struct b43_wldev *dev) |
200 | { | 176 | { |
201 | b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, | 177 | b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, |
@@ -3344,6 +3320,67 @@ static void b43_nphy_chanspec_setup(struct b43_wldev *dev, | |||
3344 | b43_nphy_spur_workaround(dev); | 3320 | b43_nphy_spur_workaround(dev); |
3345 | } | 3321 | } |
3346 | 3322 | ||
3323 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */ | ||
3324 | static int b43_nphy_set_chanspec(struct b43_wldev *dev, | ||
3325 | struct b43_chanspec chanspec) | ||
3326 | { | ||
3327 | struct b43_phy_n *nphy = dev->phy.n; | ||
3328 | |||
3329 | const struct b43_nphy_channeltab_entry *tabent; | ||
3330 | |||
3331 | u8 tmp; | ||
3332 | u8 channel = chanspec.channel; | ||
3333 | |||
3334 | if (dev->phy.rev >= 3) { | ||
3335 | /* TODO */ | ||
3336 | } | ||
3337 | |||
3338 | nphy->radio_chanspec = chanspec; | ||
3339 | |||
3340 | if (chanspec.b_width != nphy->b_width) | ||
3341 | ; /* TODO: BMAC BW Set (chanspec.b_width) */ | ||
3342 | |||
3343 | /* TODO: use defines */ | ||
3344 | if (chanspec.b_width == 3) { | ||
3345 | if (chanspec.sideband == 2) | ||
3346 | b43_phy_set(dev, B43_NPHY_RXCTL, | ||
3347 | B43_NPHY_RXCTL_BSELU20); | ||
3348 | else | ||
3349 | b43_phy_mask(dev, B43_NPHY_RXCTL, | ||
3350 | ~B43_NPHY_RXCTL_BSELU20); | ||
3351 | } | ||
3352 | |||
3353 | if (dev->phy.rev >= 3) { | ||
3354 | tmp = (chanspec.b_freq == 1) ? 4 : 0; | ||
3355 | b43_radio_maskset(dev, 0x08, 0xFFFB, tmp); | ||
3356 | /* TODO: PHY Radio2056 Setup (chan_info_ptr[i]) */ | ||
3357 | /* TODO: N PHY Chanspec Setup (chan_info_ptr[i]) */ | ||
3358 | } else { | ||
3359 | tabent = b43_nphy_get_chantabent(dev, channel); | ||
3360 | if (!tabent) | ||
3361 | return -ESRCH; | ||
3362 | |||
3363 | tmp = (chanspec.b_freq == 1) ? 0x0020 : 0x0050; | ||
3364 | b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp); | ||
3365 | b43_radio_2055_setup(dev, tabent); | ||
3366 | b43_nphy_chanspec_setup(dev, tabent, chanspec); | ||
3367 | } | ||
3368 | |||
3369 | return 0; | ||
3370 | } | ||
3371 | |||
3372 | /* Tune the hardware to a new channel */ | ||
3373 | static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel) | ||
3374 | { | ||
3375 | struct b43_phy_n *nphy = dev->phy.n; | ||
3376 | |||
3377 | struct b43_chanspec chanspec; | ||
3378 | chanspec = nphy->radio_chanspec; | ||
3379 | chanspec.channel = channel; | ||
3380 | |||
3381 | return b43_nphy_set_chanspec(dev, chanspec); | ||
3382 | } | ||
3383 | |||
3347 | static int b43_nphy_op_allocate(struct b43_wldev *dev) | 3384 | static int b43_nphy_op_allocate(struct b43_wldev *dev) |
3348 | { | 3385 | { |
3349 | struct b43_phy_n *nphy; | 3386 | struct b43_phy_n *nphy; |
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h index e7acae278be0..8b6d570dd0aa 100644 --- a/drivers/net/wireless/b43/phy_n.h +++ b/drivers/net/wireless/b43/phy_n.h | |||
@@ -984,6 +984,7 @@ struct b43_phy_n { | |||
984 | u16 papd_epsilon_offset[2]; | 984 | u16 papd_epsilon_offset[2]; |
985 | s32 preamble_override; | 985 | s32 preamble_override; |
986 | u32 bb_mult_save; | 986 | u32 bb_mult_save; |
987 | u8 b_width; | ||
987 | struct b43_chanspec radio_chanspec; | 988 | struct b43_chanspec radio_chanspec; |
988 | 989 | ||
989 | bool gain_boost; | 990 | bool gain_boost; |