diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-08-28 08:59:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-13 15:42:30 -0400 |
commit | 39f7d33c499980267f68fcb1fadd03bdcbc9ab9a (patch) | |
tree | db90d4cb77a16f8f360dd9f1dc90df413d867c9e /drivers/net/wireless/b43 | |
parent | bd3bf693c72826d7c5be9df09fe3d1198b89b538 (diff) |
b43: LCN-PHY: prepare functions for channel switching
Switching is not fully implemented yet, prepare place for the code.
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')
-rw-r--r-- | drivers/net/wireless/b43/phy_lcn.c | 86 |
1 files changed, 84 insertions, 2 deletions
diff --git a/drivers/net/wireless/b43/phy_lcn.c b/drivers/net/wireless/b43/phy_lcn.c index 9707a2b9cbe0..483953665d08 100644 --- a/drivers/net/wireless/b43/phy_lcn.c +++ b/drivers/net/wireless/b43/phy_lcn.c | |||
@@ -31,6 +31,48 @@ | |||
31 | * Radio 2064. | 31 | * Radio 2064. |
32 | **************************************************/ | 32 | **************************************************/ |
33 | 33 | ||
34 | static void b43_radio_2064_channel_setup(struct b43_wldev *dev) | ||
35 | { | ||
36 | u16 save[2]; | ||
37 | |||
38 | b43_radio_set(dev, 0x09d, 0x4); | ||
39 | b43_radio_write(dev, 0x09e, 0xf); | ||
40 | |||
41 | b43_radio_write(dev, 0x02a, 0xb); | ||
42 | b43_radio_maskset(dev, 0x030, ~0x3, 0xa); | ||
43 | b43_radio_maskset(dev, 0x091, ~0x3, 0); | ||
44 | b43_radio_maskset(dev, 0x038, ~0xf, 0x7); | ||
45 | b43_radio_maskset(dev, 0x030, ~0xc, 0x8); | ||
46 | b43_radio_maskset(dev, 0x05e, ~0xf, 0x8); | ||
47 | b43_radio_maskset(dev, 0x05e, ~0xf0, 0x80); | ||
48 | b43_radio_write(dev, 0x06c, 0x80); | ||
49 | |||
50 | save[0] = b43_radio_read(dev, 0x044); | ||
51 | save[1] = b43_radio_read(dev, 0x12b); | ||
52 | |||
53 | b43_radio_set(dev, 0x044, 0x7); | ||
54 | b43_radio_set(dev, 0x12b, 0xe); | ||
55 | |||
56 | /* TODO */ | ||
57 | |||
58 | b43_radio_write(dev, 0x040, 0xfb); | ||
59 | |||
60 | b43_radio_write(dev, 0x041, 0x9a); | ||
61 | b43_radio_write(dev, 0x042, 0xa3); | ||
62 | b43_radio_write(dev, 0x043, 0x0c); | ||
63 | |||
64 | /* TODO */ | ||
65 | |||
66 | b43_radio_set(dev, 0x044, 0x0c); | ||
67 | udelay(1); | ||
68 | |||
69 | b43_radio_write(dev, 0x044, save[0]); | ||
70 | b43_radio_write(dev, 0x12b, save[1]); | ||
71 | |||
72 | b43_radio_write(dev, 0x038, 0x0); | ||
73 | b43_radio_write(dev, 0x091, 0x7); | ||
74 | } | ||
75 | |||
34 | static void b43_radio_2064_init(struct b43_wldev *dev) | 76 | static void b43_radio_2064_init(struct b43_wldev *dev) |
35 | { | 77 | { |
36 | b43_radio_write(dev, 0x09c, 0x0020); | 78 | b43_radio_write(dev, 0x09c, 0x0020); |
@@ -172,6 +214,32 @@ static void b43_phy_lcn_pre_radio_init(struct b43_wldev *dev) | |||
172 | } | 214 | } |
173 | 215 | ||
174 | /************************************************** | 216 | /************************************************** |
217 | * Channel switching ops. | ||
218 | **************************************************/ | ||
219 | |||
220 | static int b43_phy_lcn_set_channel(struct b43_wldev *dev, | ||
221 | struct ieee80211_channel *channel, | ||
222 | enum nl80211_channel_type channel_type) | ||
223 | { | ||
224 | /* TODO: PLL and PHY ops */ | ||
225 | |||
226 | b43_phy_set(dev, 0x44a, 0x44); | ||
227 | b43_phy_write(dev, 0x44a, 0x80); | ||
228 | |||
229 | b43_phy_set(dev, 0x44a, 0x44); | ||
230 | b43_phy_write(dev, 0x44a, 0x80); | ||
231 | |||
232 | b43_radio_2064_channel_setup(dev); | ||
233 | mdelay(1); | ||
234 | |||
235 | b43_phy_lcn_afe_set_unset(dev); | ||
236 | |||
237 | /* TODO */ | ||
238 | |||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | /************************************************** | ||
175 | * Basic PHY ops. | 243 | * Basic PHY ops. |
176 | **************************************************/ | 244 | **************************************************/ |
177 | 245 | ||
@@ -265,6 +333,22 @@ static void b43_phy_lcn_op_switch_analog(struct b43_wldev *dev, bool on) | |||
265 | } | 333 | } |
266 | } | 334 | } |
267 | 335 | ||
336 | static int b43_phy_lcn_op_switch_channel(struct b43_wldev *dev, | ||
337 | unsigned int new_channel) | ||
338 | { | ||
339 | struct ieee80211_channel *channel = dev->wl->hw->conf.channel; | ||
340 | enum nl80211_channel_type channel_type = dev->wl->hw->conf.channel_type; | ||
341 | |||
342 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | ||
343 | if ((new_channel < 1) || (new_channel > 14)) | ||
344 | return -EINVAL; | ||
345 | } else { | ||
346 | return -EINVAL; | ||
347 | } | ||
348 | |||
349 | return b43_phy_lcn_set_channel(dev, channel, channel_type); | ||
350 | } | ||
351 | |||
268 | static unsigned int b43_phy_lcn_op_get_default_chan(struct b43_wldev *dev) | 352 | static unsigned int b43_phy_lcn_op_get_default_chan(struct b43_wldev *dev) |
269 | { | 353 | { |
270 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) | 354 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) |
@@ -338,9 +422,7 @@ const struct b43_phy_operations b43_phyops_lcn = { | |||
338 | .radio_write = b43_phy_lcn_op_radio_write, | 422 | .radio_write = b43_phy_lcn_op_radio_write, |
339 | .software_rfkill = b43_phy_lcn_op_software_rfkill, | 423 | .software_rfkill = b43_phy_lcn_op_software_rfkill, |
340 | .switch_analog = b43_phy_lcn_op_switch_analog, | 424 | .switch_analog = b43_phy_lcn_op_switch_analog, |
341 | /* | ||
342 | .switch_channel = b43_phy_lcn_op_switch_channel, | 425 | .switch_channel = b43_phy_lcn_op_switch_channel, |
343 | */ | ||
344 | .get_default_chan = b43_phy_lcn_op_get_default_chan, | 426 | .get_default_chan = b43_phy_lcn_op_get_default_chan, |
345 | .recalc_txpower = b43_phy_lcn_op_recalc_txpower, | 427 | .recalc_txpower = b43_phy_lcn_op_recalc_txpower, |
346 | .adjust_txpower = b43_phy_lcn_op_adjust_txpower, | 428 | .adjust_txpower = b43_phy_lcn_op_adjust_txpower, |