aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2007-10-13 10:26:42 -0400
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:54 -0500
commitddc827f93a2f2a7dcfda5b691d046af4dfe76427 (patch)
treedfa0c0d573e18fcc95d15984d43dcff4a7d71564 /drivers/net/wireless
parent69f81a2cac860cf183eb9ef7787525c3552d4612 (diff)
[PATCH] rt2x00: Cleanup if-statements
Cleanup if-statements for simple 1/0 register field values. This also fixes a endian bug in rt2500usb when working with the PHY_CSR2 initialization. As well as a bug in the enabling of the LED in rt73usb. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c28
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c28
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c22
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.h13
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h12
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c50
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c28
7 files changed, 83 insertions, 98 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 5b3adbae4820..fc162122617e 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -524,18 +524,10 @@ static void rt2400pci_enable_led(struct rt2x00_dev *rt2x00dev)
524 524
525 rt2x00_set_field32(&reg, LEDCSR_ON_PERIOD, 70); 525 rt2x00_set_field32(&reg, LEDCSR_ON_PERIOD, 70);
526 rt2x00_set_field32(&reg, LEDCSR_OFF_PERIOD, 30); 526 rt2x00_set_field32(&reg, LEDCSR_OFF_PERIOD, 30);
527 527 rt2x00_set_field32(&reg, LEDCSR_LINK,
528 if (rt2x00dev->led_mode == LED_MODE_TXRX_ACTIVITY) { 528 (rt2x00dev->led_mode != LED_MODE_ASUS));
529 rt2x00_set_field32(&reg, LEDCSR_LINK, 1); 529 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY,
530 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY, 0); 530 (rt2x00dev->led_mode != LED_MODE_TXRX_ACTIVITY));
531 } else if (rt2x00dev->led_mode == LED_MODE_ASUS) {
532 rt2x00_set_field32(&reg, LEDCSR_LINK, 0);
533 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY, 1);
534 } else {
535 rt2x00_set_field32(&reg, LEDCSR_LINK, 1);
536 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY, 1);
537 }
538
539 rt2x00pci_register_write(rt2x00dev, LEDCSR, reg); 531 rt2x00pci_register_write(rt2x00dev, LEDCSR, reg);
540} 532}
541 533
@@ -1110,12 +1102,12 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1110 } 1102 }
1111 1103
1112 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1104 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
1113 if (queue == IEEE80211_TX_QUEUE_DATA0) 1105 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO,
1114 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, 1); 1106 (queue == IEEE80211_TX_QUEUE_DATA0));
1115 else if (queue == IEEE80211_TX_QUEUE_DATA1) 1107 rt2x00_set_field32(&reg, TXCSR0_KICK_TX,
1116 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, 1); 1108 (queue == IEEE80211_TX_QUEUE_DATA1));
1117 else if (queue == IEEE80211_TX_QUEUE_AFTER_BEACON) 1109 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM,
1118 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, 1); 1110 (queue == IEEE80211_TX_QUEUE_AFTER_BEACON));
1119 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); 1111 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
1120} 1112}
1121 1113
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 958b148d8f50..869b1a7cec73 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -563,18 +563,10 @@ static void rt2500pci_enable_led(struct rt2x00_dev *rt2x00dev)
563 563
564 rt2x00_set_field32(&reg, LEDCSR_ON_PERIOD, 70); 564 rt2x00_set_field32(&reg, LEDCSR_ON_PERIOD, 70);
565 rt2x00_set_field32(&reg, LEDCSR_OFF_PERIOD, 30); 565 rt2x00_set_field32(&reg, LEDCSR_OFF_PERIOD, 30);
566 566 rt2x00_set_field32(&reg, LEDCSR_LINK,
567 if (rt2x00dev->led_mode == LED_MODE_TXRX_ACTIVITY) { 567 (rt2x00dev->led_mode != LED_MODE_ASUS));
568 rt2x00_set_field32(&reg, LEDCSR_LINK, 1); 568 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY,
569 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY, 0); 569 (rt2x00dev->led_mode != LED_MODE_TXRX_ACTIVITY));
570 } else if (rt2x00dev->led_mode == LED_MODE_ASUS) {
571 rt2x00_set_field32(&reg, LEDCSR_LINK, 0);
572 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY, 1);
573 } else {
574 rt2x00_set_field32(&reg, LEDCSR_LINK, 1);
575 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY, 1);
576 }
577
578 rt2x00pci_register_write(rt2x00dev, LEDCSR, reg); 570 rt2x00pci_register_write(rt2x00dev, LEDCSR, reg);
579} 571}
580 572
@@ -1244,12 +1236,12 @@ static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1244 } 1236 }
1245 1237
1246 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg); 1238 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
1247 if (queue == IEEE80211_TX_QUEUE_DATA0) 1239 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO,
1248 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, 1); 1240 (queue == IEEE80211_TX_QUEUE_DATA0));
1249 else if (queue == IEEE80211_TX_QUEUE_DATA1) 1241 rt2x00_set_field32(&reg, TXCSR0_KICK_TX,
1250 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, 1); 1242 (queue == IEEE80211_TX_QUEUE_DATA1));
1251 else if (queue == IEEE80211_TX_QUEUE_AFTER_BEACON) 1243 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM,
1252 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, 1); 1244 (queue == IEEE80211_TX_QUEUE_AFTER_BEACON));
1253 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); 1245 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
1254} 1246}
1255 1247
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 60f729044427..4f8e388700c0 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -517,18 +517,10 @@ static void rt2500usb_enable_led(struct rt2x00_dev *rt2x00dev)
517 rt2500usb_register_write(rt2x00dev, MAC_CSR21, reg); 517 rt2500usb_register_write(rt2x00dev, MAC_CSR21, reg);
518 518
519 rt2500usb_register_read(rt2x00dev, MAC_CSR20, &reg); 519 rt2500usb_register_read(rt2x00dev, MAC_CSR20, &reg);
520 520 rt2x00_set_field16(&reg, MAC_CSR20_LINK,
521 if (rt2x00dev->led_mode == LED_MODE_TXRX_ACTIVITY) { 521 (rt2x00dev->led_mode != LED_MODE_ASUS));
522 rt2x00_set_field16(&reg, MAC_CSR20_LINK, 1); 522 rt2x00_set_field16(&reg, MAC_CSR20_ACTIVITY,
523 rt2x00_set_field16(&reg, MAC_CSR20_ACTIVITY, 0); 523 (rt2x00dev->led_mode != LED_MODE_TXRX_ACTIVITY));
524 } else if (rt2x00dev->led_mode == LED_MODE_ASUS) {
525 rt2x00_set_field16(&reg, MAC_CSR20_LINK, 0);
526 rt2x00_set_field16(&reg, MAC_CSR20_ACTIVITY, 1);
527 } else {
528 rt2x00_set_field16(&reg, MAC_CSR20_LINK, 1);
529 rt2x00_set_field16(&reg, MAC_CSR20_ACTIVITY, 1);
530 }
531
532 rt2500usb_register_write(rt2x00dev, MAC_CSR20, reg); 524 rt2500usb_register_write(rt2x00dev, MAC_CSR20, reg);
533} 525}
534 526
@@ -765,9 +757,11 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev)
765 757
766 if (rt2x00_rev(&rt2x00dev->chip) >= RT2570_VERSION_C) { 758 if (rt2x00_rev(&rt2x00dev->chip) >= RT2570_VERSION_C) {
767 rt2500usb_register_read(rt2x00dev, PHY_CSR2, &reg); 759 rt2500usb_register_read(rt2x00dev, PHY_CSR2, &reg);
768 reg &= ~0x0002; 760 rt2x00_set_field16(&reg, PHY_CSR2_LNA, 0);
769 } else { 761 } else {
770 reg = 0x3002; 762 reg = 0;
763 rt2x00_set_field16(&reg, PHY_CSR2_LNA, 1);
764 rt2x00_set_field16(&reg, PHY_CSR2_LNA_MODE, 3);
771 } 765 }
772 rt2500usb_register_write(rt2x00dev, PHY_CSR2, reg); 766 rt2500usb_register_write(rt2x00dev, PHY_CSR2, reg);
773 767
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.h b/drivers/net/wireless/rt2x00/rt2500usb.h
index b18d56e73cf1..2741840fa14a 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.h
+++ b/drivers/net/wireless/rt2x00/rt2500usb.h
@@ -430,10 +430,21 @@
430 430
431/* 431/*
432 * MAC configuration registers. 432 * MAC configuration registers.
433 */
434
435/*
433 * PHY_CSR2: TX MAC configuration. 436 * PHY_CSR2: TX MAC configuration.
434 * PHY_CSR3: RX MAC configuration. 437 * NOTE: Both register fields are complete dummy,
438 * documentation and legacy drivers are unclear un
439 * what this register means or what fields exists.
435 */ 440 */
436#define PHY_CSR2 0x04c4 441#define PHY_CSR2 0x04c4
442#define PHY_CSR2_LNA FIELD16(0x0002)
443#define PHY_CSR2_LNA_MODE FIELD16(0x3000)
444
445/*
446 * PHY_CSR3: RX MAC configuration.
447 */
437#define PHY_CSR3 0x04c6 448#define PHY_CSR3 0x04c6
438 449
439/* 450/*
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index e7533e2ccd2e..4054e5460634 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -133,20 +133,20 @@
133 */ 133 */
134static inline int is_rts_frame(u16 fc) 134static inline int is_rts_frame(u16 fc)
135{ 135{
136 return !!(((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && 136 return (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
137 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)); 137 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS));
138} 138}
139 139
140static inline int is_cts_frame(u16 fc) 140static inline int is_cts_frame(u16 fc)
141{ 141{
142 return !!(((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && 142 return (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
143 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_CTS)); 143 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_CTS));
144} 144}
145 145
146static inline int is_probe_resp(u16 fc) 146static inline int is_probe_resp(u16 fc)
147{ 147{
148 return !!(((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && 148 return (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) &&
149 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP)); 149 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP));
150} 150}
151 151
152/* 152/*
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index aebc96344cd8..c57d39002bfb 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -428,7 +428,7 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
428 case ANTENNA_HW_DIVERSITY: 428 case ANTENNA_HW_DIVERSITY:
429 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); 429 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
430 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 430 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
431 !!(rt2x00dev->curr_hwmode != HWMODE_A)); 431 (rt2x00dev->curr_hwmode != HWMODE_A));
432 break; 432 break;
433 case ANTENNA_A: 433 case ANTENNA_A:
434 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); 434 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
@@ -646,17 +646,17 @@ static void rt61pci_config_antenna(struct rt2x00_dev *rt2x00dev,
646 if (rt2x00dev->curr_hwmode == HWMODE_A) { 646 if (rt2x00dev->curr_hwmode == HWMODE_A) {
647 sel = antenna_sel_a; 647 sel = antenna_sel_a;
648 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 648 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
649
650 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_BG, 0);
651 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_A, 1);
652 } else { 649 } else {
653 sel = antenna_sel_bg; 650 sel = antenna_sel_bg;
654 lna = test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); 651 lna = test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
655
656 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_BG, 1);
657 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_A, 0);
658 } 652 }
659 653
654 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_BG,
655 (rt2x00dev->curr_hwmode == HWMODE_B ||
656 rt2x00dev->curr_hwmode == HWMODE_G));
657 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_A,
658 (rt2x00dev->curr_hwmode == HWMODE_A));
659
660 for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++) 660 for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++)
661 rt61pci_bbp_write(rt2x00dev, sel[i].word, sel[i].value[lna]); 661 rt61pci_bbp_write(rt2x00dev, sel[i].word, sel[i].value[lna]);
662 662
@@ -727,7 +727,6 @@ static void rt61pci_config(struct rt2x00_dev *rt2x00dev,
727static void rt61pci_enable_led(struct rt2x00_dev *rt2x00dev) 727static void rt61pci_enable_led(struct rt2x00_dev *rt2x00dev)
728{ 728{
729 u32 reg; 729 u32 reg;
730 u16 led_reg;
731 u8 arg0; 730 u8 arg0;
732 u8 arg1; 731 u8 arg1;
733 732
@@ -736,15 +735,14 @@ static void rt61pci_enable_led(struct rt2x00_dev *rt2x00dev)
736 rt2x00_set_field32(&reg, MAC_CSR14_OFF_PERIOD, 30); 735 rt2x00_set_field32(&reg, MAC_CSR14_OFF_PERIOD, 30);
737 rt2x00pci_register_write(rt2x00dev, MAC_CSR14, reg); 736 rt2x00pci_register_write(rt2x00dev, MAC_CSR14, reg);
738 737
739 led_reg = rt2x00dev->led_reg; 738 rt2x00_set_field16(&rt2x00dev->led_reg, MCU_LEDCS_RADIO_STATUS, 1);
740 rt2x00_set_field16(&led_reg, MCU_LEDCS_RADIO_STATUS, 1); 739 rt2x00_set_field16(&rt2x00dev->led_reg, MCU_LEDCS_LINK_A_STATUS,
741 if (rt2x00dev->rx_status.phymode == MODE_IEEE80211A) 740 (rt2x00dev->rx_status.phymode == MODE_IEEE80211A));
742 rt2x00_set_field16(&led_reg, MCU_LEDCS_LINK_A_STATUS, 1); 741 rt2x00_set_field16(&rt2x00dev->led_reg, MCU_LEDCS_LINK_BG_STATUS,
743 else 742 (rt2x00dev->rx_status.phymode != MODE_IEEE80211A));
744 rt2x00_set_field16(&led_reg, MCU_LEDCS_LINK_BG_STATUS, 1);
745 743
746 arg0 = led_reg & 0xff; 744 arg0 = rt2x00dev->led_reg & 0xff;
747 arg1 = (led_reg >> 8) & 0xff; 745 arg1 = (rt2x00dev->led_reg >> 8) & 0xff;
748 746
749 rt61pci_mcu_request(rt2x00dev, MCU_LED, 0xff, arg0, arg1); 747 rt61pci_mcu_request(rt2x00dev, MCU_LED, 0xff, arg0, arg1);
750} 748}
@@ -1655,16 +1653,16 @@ static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1655 } 1653 }
1656 1654
1657 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg); 1655 rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg);
1658 if (queue == IEEE80211_TX_QUEUE_DATA0) 1656 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC0,
1659 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC0, 1); 1657 (queue == IEEE80211_TX_QUEUE_DATA0));
1660 else if (queue == IEEE80211_TX_QUEUE_DATA1) 1658 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC1,
1661 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC1, 1); 1659 (queue == IEEE80211_TX_QUEUE_DATA1));
1662 else if (queue == IEEE80211_TX_QUEUE_DATA2) 1660 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC2,
1663 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC2, 1); 1661 (queue == IEEE80211_TX_QUEUE_DATA2));
1664 else if (queue == IEEE80211_TX_QUEUE_DATA3) 1662 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC3,
1665 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_AC3, 1); 1663 (queue == IEEE80211_TX_QUEUE_DATA3));
1666 else if (queue == IEEE80211_TX_QUEUE_DATA4) 1664 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_MGMT,
1667 rt2x00_set_field32(&reg, TX_CNTL_CSR_KICK_TX_MGMT, 1); 1665 (queue == IEEE80211_TX_QUEUE_DATA4));
1668 rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); 1666 rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg);
1669} 1667}
1670 1668
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 18324210c13a..e3d5e78661ea 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -200,8 +200,8 @@ rf_write:
200 * all others contain 20 bits. 200 * all others contain 20 bits.
201 */ 201 */
202 rt2x00_set_field32(&reg, PHY_CSR4_NUMBER_OF_BITS, 202 rt2x00_set_field32(&reg, PHY_CSR4_NUMBER_OF_BITS,
203 20 + !!(rt2x00_rf(&rt2x00dev->chip, RF5225) || 203 20 + (rt2x00_rf(&rt2x00dev->chip, RF5225) ||
204 rt2x00_rf(&rt2x00dev->chip, RF2527))); 204 rt2x00_rf(&rt2x00dev->chip, RF2527)));
205 rt2x00_set_field32(&reg, PHY_CSR4_IF_SELECT, 0); 205 rt2x00_set_field32(&reg, PHY_CSR4_IF_SELECT, 0);
206 rt2x00_set_field32(&reg, PHY_CSR4_BUSY, 1); 206 rt2x00_set_field32(&reg, PHY_CSR4_BUSY, 1);
207 207
@@ -412,7 +412,7 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
412 case ANTENNA_HW_DIVERSITY: 412 case ANTENNA_HW_DIVERSITY:
413 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); 413 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
414 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 414 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
415 !!(rt2x00dev->curr_hwmode != HWMODE_A)); 415 (rt2x00dev->curr_hwmode != HWMODE_A));
416 break; 416 break;
417 case ANTENNA_A: 417 case ANTENNA_A:
418 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); 418 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
@@ -531,17 +531,17 @@ static void rt73usb_config_antenna(struct rt2x00_dev *rt2x00dev,
531 if (rt2x00dev->curr_hwmode == HWMODE_A) { 531 if (rt2x00dev->curr_hwmode == HWMODE_A) {
532 sel = antenna_sel_a; 532 sel = antenna_sel_a;
533 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 533 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
534
535 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_BG, 0);
536 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_A, 1);
537 } else { 534 } else {
538 sel = antenna_sel_bg; 535 sel = antenna_sel_bg;
539 lna = test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); 536 lna = test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
540
541 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_BG, 1);
542 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_A, 0);
543 } 537 }
544 538
539 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_BG,
540 (rt2x00dev->curr_hwmode == HWMODE_B ||
541 rt2x00dev->curr_hwmode == HWMODE_G));
542 rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_A,
543 (rt2x00dev->curr_hwmode == HWMODE_A));
544
545 for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++) 545 for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++)
546 rt73usb_bbp_write(rt2x00dev, sel[i].word, sel[i].value[lna]); 546 rt73usb_bbp_write(rt2x00dev, sel[i].word, sel[i].value[lna]);
547 547
@@ -614,12 +614,10 @@ static void rt73usb_enable_led(struct rt2x00_dev *rt2x00dev)
614 rt73usb_register_write(rt2x00dev, MAC_CSR14, reg); 614 rt73usb_register_write(rt2x00dev, MAC_CSR14, reg);
615 615
616 rt2x00_set_field16(&rt2x00dev->led_reg, MCU_LEDCS_RADIO_STATUS, 1); 616 rt2x00_set_field16(&rt2x00dev->led_reg, MCU_LEDCS_RADIO_STATUS, 1);
617 if (rt2x00dev->rx_status.phymode == MODE_IEEE80211A) 617 rt2x00_set_field16(&rt2x00dev->led_reg, MCU_LEDCS_LINK_A_STATUS,
618 rt2x00_set_field16(&rt2x00dev->led_reg, 618 (rt2x00dev->rx_status.phymode == MODE_IEEE80211A));
619 MCU_LEDCS_LINK_A_STATUS, 1); 619 rt2x00_set_field16(&rt2x00dev->led_reg, MCU_LEDCS_LINK_BG_STATUS,
620 else 620 (rt2x00dev->rx_status.phymode != MODE_IEEE80211A));
621 rt2x00_set_field16(&rt2x00dev->led_reg,
622 MCU_LEDCS_LINK_BG_STATUS, 1);
623 621
624 rt2x00usb_vendor_request_sw(rt2x00dev, USB_LED_CONTROL, 0x0000, 622 rt2x00usb_vendor_request_sw(rt2x00dev, USB_LED_CONTROL, 0x0000,
625 rt2x00dev->led_reg, REGISTER_TIMEOUT); 623 rt2x00dev->led_reg, REGISTER_TIMEOUT);