aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/nphy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43/nphy.c')
-rw-r--r--drivers/net/wireless/b43/nphy.c98
1 files changed, 97 insertions, 1 deletions
diff --git a/drivers/net/wireless/b43/nphy.c b/drivers/net/wireless/b43/nphy.c
index 6d92545b1fae..b427aeeaa1f2 100644
--- a/drivers/net/wireless/b43/nphy.c
+++ b/drivers/net/wireless/b43/nphy.c
@@ -24,11 +24,107 @@
24 24
25#include "b43.h" 25#include "b43.h"
26#include "nphy.h" 26#include "nphy.h"
27#include "tables_nphy.h"
27 28
28 29
30void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
31{//TODO
32}
33
34void b43_nphy_xmitpower(struct b43_wldev *dev)
35{//TODO
36}
37
38/* Tune the hardware to a new channel. Don't call this directly.
39 * Use b43_radio_selectchannel() */
40void b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel)
41{
42
43//TODO
44}
45
46static void b43_radio_init2055_pre(struct b43_wldev *dev)
47{
48 b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
49 ~B43_NPHY_RFCTL_CMD_PORFORCE);
50 b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
51 B43_NPHY_RFCTL_CMD_CHIP0PU |
52 B43_NPHY_RFCTL_CMD_OEPORFORCE);
53 b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
54 B43_NPHY_RFCTL_CMD_PORFORCE);
55}
56
57static void b43_radio_init2055_post(struct b43_wldev *dev)
58{
59 struct ssb_sprom *sprom = &(dev->dev->bus->sprom);
60 struct ssb_boardinfo *binfo = &(dev->dev->bus->boardinfo);
61 int i;
62 u16 val;
63
64 b43_radio_mask(dev, B2055_MASTER1, 0xFFF3);
65 msleep(1);
66 if ((sprom->revision != 4) || !(sprom->boardflags_hi & 0x0002)) {
67 if ((binfo->vendor != PCI_VENDOR_ID_BROADCOM) ||
68 (binfo->type != 0x46D) ||
69 (binfo->rev < 0x41)) {
70 b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
71 b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
72 msleep(1);
73 }
74 }
75 b43_radio_maskset(dev, B2055_RRCCAL_NOPTSEL, 0x3F, 0x2C);
76 msleep(1);
77 b43_radio_write16(dev, B2055_CAL_MISC, 0x3C);
78 msleep(1);
79 b43_radio_mask(dev, B2055_CAL_MISC, 0xFFBE);
80 msleep(1);
81 b43_radio_set(dev, B2055_CAL_LPOCTL, 0x80);
82 msleep(1);
83 b43_radio_set(dev, B2055_CAL_MISC, 0x1);
84 msleep(1);
85 b43_radio_set(dev, B2055_CAL_MISC, 0x40);
86 msleep(1);
87 for (i = 0; i < 100; i++) {
88 val = b43_radio_read16(dev, B2055_CAL_COUT2);
89 if (val & 0x80)
90 break;
91 udelay(10);
92 }
93 msleep(1);
94 b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F);
95 msleep(1);
96 b43_radio_selectchannel(dev, dev->phy.channel, 0);
97 b43_radio_write16(dev, B2055_C1_RX_BB_LPF, 0x9);
98 b43_radio_write16(dev, B2055_C2_RX_BB_LPF, 0x9);
99 b43_radio_write16(dev, B2055_C1_RX_BB_MIDACHP, 0x83);
100 b43_radio_write16(dev, B2055_C2_RX_BB_MIDACHP, 0x83);
101}
102
103/* Initialize a Broadcom 2055 N-radio */
104static void b43_radio_init2055(struct b43_wldev *dev)
105{
106 b43_radio_init2055_pre(dev);
107 if (b43_status(dev) < B43_STAT_INITIALIZED)
108 b2055_upload_inittab(dev, 0, 1);
109 else
110 b2055_upload_inittab(dev, 0/*FIXME on 5ghz band*/, 0);
111 b43_radio_init2055_post(dev);
112}
113
114void b43_nphy_radio_turn_on(struct b43_wldev *dev)
115{
116 b43_radio_init2055(dev);
117}
118
119void b43_nphy_radio_turn_off(struct b43_wldev *dev)
120{
121 b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
122 ~B43_NPHY_RFCTL_CMD_EN);
123}
124
29int b43_phy_initn(struct b43_wldev *dev) 125int b43_phy_initn(struct b43_wldev *dev)
30{ 126{
31 b43err(dev->wl, "IEEE 802.11n devices are not supported, yet.\n"); 127 b43err(dev->wl, "IEEE 802.11n devices are not supported, yet.\n");
32 128
33 return -EOPNOTSUPP; 129 return 0;
34} 130}