aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-09-16 06:33:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-19 16:10:11 -0400
commitb534706a0692912e72d4be78f45be57c5b231ed5 (patch)
treeae21e6e65cfb6aa0e22859fb4161c6d447edb25f
parent3861b2c5d90b219ee772b5a1d1a32ee630564121 (diff)
b43: LCN-PHY: tweaks for channel switching
They have been taken from brcmsmac, add Broadcom's copyright. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/b43/phy_lcn.c67
1 files changed, 63 insertions, 4 deletions
diff --git a/drivers/net/wireless/b43/phy_lcn.c b/drivers/net/wireless/b43/phy_lcn.c
index d1dfeec7bc28..06d8efc2f29f 100644
--- a/drivers/net/wireless/b43/phy_lcn.c
+++ b/drivers/net/wireless/b43/phy_lcn.c
@@ -20,6 +20,14 @@
20 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, 20 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
21 Boston, MA 02110-1301, USA. 21 Boston, MA 02110-1301, USA.
22 22
23 This file incorporates work covered by the following copyright and
24 permission notice:
25
26 Copyright (c) 2010 Broadcom Corporation
27
28 Permission to use, copy, modify, and/or distribute this software for any
29 purpose with or without fee is hereby granted, provided that the above
30 copyright notice and this permission notice appear in all copies.
23*/ 31*/
24 32
25#include <linux/slab.h> 33#include <linux/slab.h>
@@ -278,14 +286,50 @@ static void b43_phy_lcn_sense_setup(struct b43_wldev *dev)
278 * Channel switching ops. 286 * Channel switching ops.
279 **************************************************/ 287 **************************************************/
280 288
281static int b43_phy_lcn_set_channel(struct b43_wldev *dev, 289/* wlc_lcnphy_set_chanspec_tweaks */
282 struct ieee80211_channel *channel, 290static void b43_phy_lcn_set_channel_tweaks(struct b43_wldev *dev, int channel)
283 enum nl80211_channel_type channel_type)
284{ 291{
285 /* TODO: PLL and PHY ops */ 292 struct bcma_drv_cc *cc = &dev->dev->bdev->bus->drv_cc;
293
294 b43_phy_maskset(dev, 0x448, ~0x300, (channel == 14) ? 0x200 : 0x100);
295
296 if (channel == 1 || channel == 2 || channel == 3 || channel == 4 ||
297 channel == 9 || channel == 10 || channel == 11 || channel == 12) {
298 bcma_chipco_pll_write(cc, 0x2, 0x03000c04);
299 bcma_chipco_pll_maskset(cc, 0x3, 0x00ffffff, 0x0);
300 bcma_chipco_pll_write(cc, 0x4, 0x200005c0);
301
302 bcma_cc_set32(cc, BCMA_CC_PMU_CTL, 0x400);
303
304 b43_phy_write(dev, 0x942, 0);
305
306 /* b43_phy_lcn_txrx_spur_avoidance_mode(dev, false); */
307 b43_phy_maskset(dev, 0x424, (u16) ~0xff00, 0x1b00);
308 b43_phy_write(dev, 0x425, 0x5907);
309 } else {
310 bcma_chipco_pll_write(cc, 0x2, 0x03140c04);
311 bcma_chipco_pll_maskset(cc, 0x3, 0x00ffffff, 0x333333);
312 bcma_chipco_pll_write(cc, 0x4, 0x202c2820);
313
314 bcma_cc_set32(cc, BCMA_CC_PMU_CTL, 0x400);
315
316 b43_phy_write(dev, 0x942, 0);
317
318 /* b43_phy_lcn_txrx_spur_avoidance_mode(dev, true); */
319 b43_phy_maskset(dev, 0x424, (u16) ~0xff00, 0x1f00);
320 b43_phy_write(dev, 0x425, 0x590a);
321 }
286 322
287 b43_phy_set(dev, 0x44a, 0x44); 323 b43_phy_set(dev, 0x44a, 0x44);
288 b43_phy_write(dev, 0x44a, 0x80); 324 b43_phy_write(dev, 0x44a, 0x80);
325}
326
327/* wlc_phy_chanspec_set_lcnphy */
328static int b43_phy_lcn_set_channel(struct b43_wldev *dev,
329 struct ieee80211_channel *channel,
330 enum nl80211_channel_type channel_type)
331{
332 b43_phy_lcn_set_channel_tweaks(dev, channel->hw_value);
289 333
290 b43_phy_set(dev, 0x44a, 0x44); 334 b43_phy_set(dev, 0x44a, 0x44);
291 b43_phy_write(dev, 0x44a, 0x80); 335 b43_phy_write(dev, 0x44a, 0x80);
@@ -336,6 +380,8 @@ static void b43_phy_lcn_op_prepare_structs(struct b43_wldev *dev)
336/* wlc_phy_init_lcnphy */ 380/* wlc_phy_init_lcnphy */
337static int b43_phy_lcn_op_init(struct b43_wldev *dev) 381static int b43_phy_lcn_op_init(struct b43_wldev *dev)
338{ 382{
383 struct bcma_drv_cc *cc = &dev->dev->bdev->bus->drv_cc;
384
339 b43_phy_set(dev, 0x44a, 0x80); 385 b43_phy_set(dev, 0x44a, 0x80);
340 b43_phy_mask(dev, 0x44a, 0x7f); 386 b43_phy_mask(dev, 0x44a, 0x7f);
341 b43_phy_set(dev, 0x6d1, 0x80); 387 b43_phy_set(dev, 0x6d1, 0x80);
@@ -359,6 +405,19 @@ static int b43_phy_lcn_op_init(struct b43_wldev *dev)
359 405
360 b43_phy_lcn_sense_setup(dev); 406 b43_phy_lcn_sense_setup(dev);
361 407
408 b43_switch_channel(dev, dev->phy.channel);
409
410 bcma_chipco_regctl_maskset(cc, 0, 0xf, 0x9);
411 bcma_chipco_chipctl_maskset(cc, 0, 0, 0x03cddddd);
412
413 /* TODO */
414
415 b43_phy_set(dev, 0x448, 0x4000);
416 udelay(100);
417 b43_phy_mask(dev, 0x448, ~0x4000);
418
419 /* TODO */
420
362 return 0; 421 return 0;
363} 422}
364 423