aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/rtl8187se/r8185b_init.c76
1 files changed, 26 insertions, 50 deletions
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c
index 005fb0bce486..2ca857d4244f 100644
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -284,62 +284,38 @@ bool SetAntennaConfig87SE(struct net_device *dev,
284{ 284{
285 struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 285 struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
286 bool bAntennaSwitched = true; 286 bool bAntennaSwitched = true;
287 u8 ant_diversity_offset = 0x00; /* 0x00 = disabled, 0x80 = enabled */
287 288
288 /* printk("SetAntennaConfig87SE(): DefaultAnt(%d), bAntDiversity(%d)\n", DefaultAnt, bAntDiversity); */ 289 /* printk("SetAntennaConfig87SE(): DefaultAnt(%d), bAntDiversity(%d)\n", DefaultAnt, bAntDiversity); */
289 290
290 /* Threshold for antenna diversity. */ 291 /* Threshold for antenna diversity. */
291 write_phy_cck(dev, 0x0c, 0x09); /* Reg0c : 09 */ 292 write_phy_cck(dev, 0x0c, 0x09); /* Reg0c : 09 */
292 293
293 if (bAntDiversity) { /* Enable Antenna Diversity. */ 294 if (bAntDiversity) /* Enable Antenna Diversity. */
294 if (DefaultAnt == 1) { /* aux antenna */ 295 ant_diversity_offset = 0x80;
295 296
296 /* Mac register, aux antenna */ 297 if (DefaultAnt == 1) { /* aux Antenna */
297 write_nic_byte(dev, ANTSEL, 0x00); 298 /* Mac register, aux antenna */
298 299 write_nic_byte(dev, ANTSEL, 0x00);
299 /* Config CCK RX antenna. */ 300
300 write_phy_cck(dev, 0x11, 0xbb); /* Reg11 : bb */ 301 /* Config CCK RX antenna. */
301 write_phy_cck(dev, 0x01, 0xc7); /* Reg01 : c7 */ 302 write_phy_cck(dev, 0x11, 0xbb); /* Reg11 : bb */
302 303 write_phy_cck(dev, 0x01, 0x47|ant_diversity_offset); /* Reg01 : 47 | ant_diversity_offset */
303 /* Config OFDM RX antenna. */ 304
304 write_phy_ofdm(dev, 0x0D, 0x54); /* Reg0d : 54 */ 305 /* Config OFDM RX antenna. */
305 write_phy_ofdm(dev, 0x18, 0xb2); /* Reg18 : b2 */ 306 write_phy_ofdm(dev, 0x0D, 0x54); /* Reg0d : 54 */
306 } else { /* use main antenna */ 307 write_phy_ofdm(dev, 0x18, 0x32|ant_diversity_offset); /* Reg18 : 32 */
307 /* Mac register, main antenna */ 308 } else { /* main Antenna */
308 write_nic_byte(dev, ANTSEL, 0x03); 309 /* Mac register, main antenna */
309 /* base band */ 310 write_nic_byte(dev, ANTSEL, 0x03);
310 /* Config CCK RX antenna. */ 311
311 write_phy_cck(dev, 0x11, 0x9b); /* Reg11 : 9b */ 312 /* Config CCK RX antenna. */
312 write_phy_cck(dev, 0x01, 0xc7); /* Reg01 : c7 */ 313 write_phy_cck(dev, 0x11, 0x9b); /* Reg11 : 9b */
313 314 write_phy_cck(dev, 0x01, 0x47|ant_diversity_offset); /* Reg01 : 47 */
314 /* Config OFDM RX antenna. */ 315
315 write_phy_ofdm(dev, 0x0d, 0x5c); /* Reg0d : 5c */ 316 /* Config OFDM RX antenna. */
316 write_phy_ofdm(dev, 0x18, 0xb2); /* Reg18 : b2 */ 317 write_phy_ofdm(dev, 0x0D, 0x5c); /* Reg0d : 5c */
317 } 318 write_phy_ofdm(dev, 0x18, 0x32|ant_diversity_offset); /*Reg18 : 32 */
318 } else {
319 /* Disable Antenna Diversity. */
320 if (DefaultAnt == 1) { /* aux Antenna */
321 /* Mac register, aux antenna */
322 write_nic_byte(dev, ANTSEL, 0x00);
323
324 /* Config CCK RX antenna. */
325 write_phy_cck(dev, 0x11, 0xbb); /* Reg11 : bb */
326 write_phy_cck(dev, 0x01, 0x47); /* Reg01 : 47 */
327
328 /* Config OFDM RX antenna. */
329 write_phy_ofdm(dev, 0x0D, 0x54); /* Reg0d : 54 */
330 write_phy_ofdm(dev, 0x18, 0x32); /* Reg18 : 32 */
331 } else { /* main Antenna */
332 /* Mac register, main antenna */
333 write_nic_byte(dev, ANTSEL, 0x03);
334
335 /* Config CCK RX antenna. */
336 write_phy_cck(dev, 0x11, 0x9b); /* Reg11 : 9b */
337 write_phy_cck(dev, 0x01, 0x47); /* Reg01 : 47 */
338
339 /* Config OFDM RX antenna. */
340 write_phy_ofdm(dev, 0x0D, 0x5c); /* Reg0d : 5c */
341 write_phy_ofdm(dev, 0x18, 0x32); /*Reg18 : 32 */
342 }
343 } 319 }
344 priv->CurrAntennaIndex = DefaultAnt; /* Update default settings. */ 320 priv->CurrAntennaIndex = DefaultAnt; /* Update default settings. */
345 return bAntennaSwitched; 321 return bAntennaSwitched;