diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-02-27 07:03:36 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-09 15:06:52 -0500 |
commit | 036cafe4212a7d71d415b2f02cc5d6cad690dc27 (patch) | |
tree | 18f1ee8fb70be65a235ab44b58f68166c7f15b8c /drivers/net/wireless/b43 | |
parent | e5255cccb26e88d0c7dd2d25b5ec2f26a3c6301d (diff) |
b43: N-PHY: update post init of 2055 radio
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_n.c | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 2c592d2dba93..67748976ae79 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -183,49 +183,58 @@ static void b43_radio_init2055_pre(struct b43_wldev *dev) | |||
183 | 183 | ||
184 | static void b43_radio_init2055_post(struct b43_wldev *dev) | 184 | static void b43_radio_init2055_post(struct b43_wldev *dev) |
185 | { | 185 | { |
186 | struct b43_phy_n *nphy = dev->phy.n; | ||
186 | struct ssb_sprom *sprom = &(dev->dev->bus->sprom); | 187 | struct ssb_sprom *sprom = &(dev->dev->bus->sprom); |
187 | struct ssb_boardinfo *binfo = &(dev->dev->bus->boardinfo); | 188 | struct ssb_boardinfo *binfo = &(dev->dev->bus->boardinfo); |
188 | int i; | 189 | int i; |
189 | u16 val; | 190 | u16 val; |
191 | bool workaround = false; | ||
192 | |||
193 | if (sprom->revision < 4) | ||
194 | workaround = (binfo->vendor != PCI_VENDOR_ID_BROADCOM || | ||
195 | binfo->type != 0x46D || | ||
196 | binfo->rev < 0x41); | ||
197 | else | ||
198 | workaround = ((sprom->boardflags_hi & B43_BFH_NOPA) == 0); | ||
190 | 199 | ||
191 | b43_radio_mask(dev, B2055_MASTER1, 0xFFF3); | 200 | b43_radio_mask(dev, B2055_MASTER1, 0xFFF3); |
192 | msleep(1); | 201 | if (workaround) { |
193 | if ((sprom->revision != 4) || | 202 | b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F); |
194 | !(sprom->boardflags_hi & B43_BFH_RSSIINV)) { | 203 | b43_radio_mask(dev, B2055_C2_RX_BB_REG, 0x7F); |
195 | if ((binfo->vendor != PCI_VENDOR_ID_BROADCOM) || | ||
196 | (binfo->type != 0x46D) || | ||
197 | (binfo->rev < 0x41)) { | ||
198 | b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F); | ||
199 | b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F); | ||
200 | msleep(1); | ||
201 | } | ||
202 | } | 204 | } |
203 | b43_radio_maskset(dev, B2055_RRCCAL_NOPTSEL, 0x3F, 0x2C); | 205 | b43_radio_maskset(dev, B2055_RRCCAL_NOPTSEL, 0xFFC0, 0x2C); |
204 | msleep(1); | 206 | b43_radio_write(dev, B2055_CAL_MISC, 0x3C); |
205 | b43_radio_write16(dev, B2055_CAL_MISC, 0x3C); | ||
206 | msleep(1); | ||
207 | b43_radio_mask(dev, B2055_CAL_MISC, 0xFFBE); | 207 | b43_radio_mask(dev, B2055_CAL_MISC, 0xFFBE); |
208 | msleep(1); | ||
209 | b43_radio_set(dev, B2055_CAL_LPOCTL, 0x80); | 208 | b43_radio_set(dev, B2055_CAL_LPOCTL, 0x80); |
210 | msleep(1); | ||
211 | b43_radio_set(dev, B2055_CAL_MISC, 0x1); | 209 | b43_radio_set(dev, B2055_CAL_MISC, 0x1); |
212 | msleep(1); | 210 | msleep(1); |
213 | b43_radio_set(dev, B2055_CAL_MISC, 0x40); | 211 | b43_radio_set(dev, B2055_CAL_MISC, 0x40); |
214 | msleep(1); | 212 | for (i = 0; i < 200; i++) { |
215 | for (i = 0; i < 100; i++) { | 213 | val = b43_radio_read(dev, B2055_CAL_COUT2); |
216 | val = b43_radio_read16(dev, B2055_CAL_COUT2); | 214 | if (val & 0x80) { |
217 | if (val & 0x80) | 215 | i = 0; |
218 | break; | 216 | break; |
217 | } | ||
219 | udelay(10); | 218 | udelay(10); |
220 | } | 219 | } |
221 | msleep(1); | 220 | if (i) |
221 | b43err(dev->wl, "radio post init timeout\n"); | ||
222 | b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F); | 222 | b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F); |
223 | msleep(1); | ||
224 | nphy_channel_switch(dev, dev->phy.channel); | 223 | nphy_channel_switch(dev, dev->phy.channel); |
225 | b43_radio_write16(dev, B2055_C1_RX_BB_LPF, 0x9); | 224 | b43_radio_write(dev, B2055_C1_RX_BB_LPF, 0x9); |
226 | b43_radio_write16(dev, B2055_C2_RX_BB_LPF, 0x9); | 225 | b43_radio_write(dev, B2055_C2_RX_BB_LPF, 0x9); |
227 | b43_radio_write16(dev, B2055_C1_RX_BB_MIDACHP, 0x83); | 226 | b43_radio_write(dev, B2055_C1_RX_BB_MIDACHP, 0x83); |
228 | b43_radio_write16(dev, B2055_C2_RX_BB_MIDACHP, 0x83); | 227 | b43_radio_write(dev, B2055_C2_RX_BB_MIDACHP, 0x83); |
228 | b43_radio_maskset(dev, B2055_C1_LNA_GAINBST, 0xFFF8, 0x6); | ||
229 | b43_radio_maskset(dev, B2055_C2_LNA_GAINBST, 0xFFF8, 0x6); | ||
230 | if (!nphy->gain_boost) { | ||
231 | b43_radio_set(dev, B2055_C1_RX_RFSPC1, 0x2); | ||
232 | b43_radio_set(dev, B2055_C2_RX_RFSPC1, 0x2); | ||
233 | } else { | ||
234 | b43_radio_mask(dev, B2055_C1_RX_RFSPC1, 0xFFFD); | ||
235 | b43_radio_mask(dev, B2055_C2_RX_RFSPC1, 0xFFFD); | ||
236 | } | ||
237 | udelay(2); | ||
229 | } | 238 | } |
230 | 239 | ||
231 | /* | 240 | /* |