Commit 39e75857 authored by Ivo van Doorn's avatar Ivo van Doorn Committed by David S. Miller

[PATCH] rt2x00: SW diversity should default to antenna B

Although ANTENNA_SW_DIVERSITY should never be send
to the driver, we should still handle it to prevent bugs.
But instead of defaulting to ANTENNA_HW_DIVERSITY we
should default to ANTENNA_B instead.
Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent addc81bd
...@@ -409,13 +409,19 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -409,13 +409,19 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
* Configure the TX antenna. * Configure the TX antenna.
*/ */
switch (ant->tx) { switch (ant->tx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY: case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 1); rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 1);
break; break;
case ANTENNA_A: case ANTENNA_A:
rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 0); rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 0);
break; break;
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 2); rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 2);
break; break;
...@@ -425,13 +431,19 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -425,13 +431,19 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
* Configure the RX antenna. * Configure the RX antenna.
*/ */
switch (ant->rx) { switch (ant->rx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY: case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
break; break;
case ANTENNA_A: case ANTENNA_A:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 0); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 0);
break; break;
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
break; break;
......
...@@ -438,17 +438,19 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -438,17 +438,19 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,
* Configure the TX antenna. * Configure the TX antenna.
*/ */
switch (ant->tx) { switch (ant->tx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2);
rt2x00_set_field32(&reg, BBPCSR1_CCK, 2);
rt2x00_set_field32(&reg, BBPCSR1_OFDM, 2);
break;
case ANTENNA_A: case ANTENNA_A:
rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 0); rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 0);
rt2x00_set_field32(&reg, BBPCSR1_CCK, 0); rt2x00_set_field32(&reg, BBPCSR1_CCK, 0);
rt2x00_set_field32(&reg, BBPCSR1_OFDM, 0); rt2x00_set_field32(&reg, BBPCSR1_OFDM, 0);
break; break;
case ANTENNA_HW_DIVERSITY:
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2);
rt2x00_set_field32(&reg, BBPCSR1_CCK, 2); rt2x00_set_field32(&reg, BBPCSR1_CCK, 2);
...@@ -460,13 +462,17 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -460,13 +462,17 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,
* Configure the RX antenna. * Configure the RX antenna.
*/ */
switch (ant->rx) { switch (ant->rx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2);
break;
case ANTENNA_A: case ANTENNA_A:
rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0);
break; break;
case ANTENNA_HW_DIVERSITY:
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2);
break; break;
......
...@@ -401,7 +401,6 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -401,7 +401,6 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
* Configure the TX antenna. * Configure the TX antenna.
*/ */
switch (ant->tx) { switch (ant->tx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY: case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 1); rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 1);
rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 1); rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 1);
...@@ -412,6 +411,13 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -412,6 +411,13 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 0); rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 0);
rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 0); rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 0);
break; break;
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2);
rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 2); rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 2);
...@@ -423,13 +429,19 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -423,13 +429,19 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
* Configure the RX antenna. * Configure the RX antenna.
*/ */
switch (ant->rx) { switch (ant->rx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY: case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 1); rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 1);
break; break;
case ANTENNA_A: case ANTENNA_A:
rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0);
break; break;
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2);
break; break;
......
...@@ -425,7 +425,6 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, ...@@ -425,7 +425,6 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
!rt2x00_rf(&rt2x00dev->chip, RF5225)); !rt2x00_rf(&rt2x00dev->chip, RF5225));
switch (ant->rx) { switch (ant->rx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY: case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
...@@ -440,6 +439,13 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, ...@@ -440,6 +439,13 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
else else
rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); rt2x00_set_field8(&r77, BBP_R77_PAIR, 3);
break; break;
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
...@@ -473,7 +479,6 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, ...@@ -473,7 +479,6 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
!test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags));
switch (ant->rx) { switch (ant->rx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY: case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
break; break;
...@@ -481,6 +486,13 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, ...@@ -481,6 +486,13 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); rt2x00_set_field8(&r77, BBP_R77_PAIR, 3);
break; break;
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); rt2x00_set_field8(&r77, BBP_R77_PAIR, 0);
......
...@@ -409,7 +409,6 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, ...@@ -409,7 +409,6 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0);
switch (ant->rx) { switch (ant->rx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY: case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
...@@ -424,6 +423,13 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, ...@@ -424,6 +423,13 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
else else
rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); rt2x00_set_field8(&r77, BBP_R77_PAIR, 3);
break; break;
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
...@@ -456,7 +462,6 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, ...@@ -456,7 +462,6 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
!test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags));
switch (ant->rx) { switch (ant->rx) {
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY: case ANTENNA_HW_DIVERSITY:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
break; break;
...@@ -464,6 +469,13 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, ...@@ -464,6 +469,13 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); rt2x00_set_field8(&r77, BBP_R77_PAIR, 3);
break; break;
case ANTENNA_SW_DIVERSITY:
/*
* NOTE: We should never come here because rt2x00lib is
* supposed to catch this and send us the correct antenna
* explicitely. However we are nog going to bug about this.
* Instead, just default to antenna B.
*/
case ANTENNA_B: case ANTENNA_B:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); rt2x00_set_field8(&r77, BBP_R77_PAIR, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment