提交 a4fe07d9 编写于 作者: I Ivo van Doorn 提交者: John W. Linville

rt2x00: Start bugging when rt2x00lib doesn't filter SW diversity

rt2x00lib should filter SW diversity out before sending any configuration
changes to the driver. When rt2x00lib fails to do this, it is important
that such events are reported because it _must_ be fixed.
So upgrading the error level to a BUG_ON() which will make sure
this bug gets noticed whenever it happens.
Signed-off-by: NIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 a7f3a06c
...@@ -417,6 +417,13 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -417,6 +417,13 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
u8 r1; u8 r1;
u8 r4; u8 r4;
/*
* We should never come here because rt2x00lib is supposed
* to catch this and send us the correct antenna explicitely.
*/
BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
ant->tx == ANTENNA_SW_DIVERSITY);
rt2400pci_bbp_read(rt2x00dev, 4, &r4); rt2400pci_bbp_read(rt2x00dev, 4, &r4);
rt2400pci_bbp_read(rt2x00dev, 1, &r1); rt2400pci_bbp_read(rt2x00dev, 1, &r1);
...@@ -430,14 +437,8 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -430,14 +437,8 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
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:
default:
rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 2); rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 2);
break; break;
} }
...@@ -452,14 +453,8 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -452,14 +453,8 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
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:
default:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
break; break;
} }
......
...@@ -444,6 +444,13 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -444,6 +444,13 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,
u8 r14; u8 r14;
u8 r2; u8 r2;
/*
* We should never come here because rt2x00lib is supposed
* to catch this and send us the correct antenna explicitely.
*/
BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
ant->tx == ANTENNA_SW_DIVERSITY);
rt2x00pci_register_read(rt2x00dev, BBPCSR1, &reg); rt2x00pci_register_read(rt2x00dev, BBPCSR1, &reg);
rt2500pci_bbp_read(rt2x00dev, 14, &r14); rt2500pci_bbp_read(rt2x00dev, 14, &r14);
rt2500pci_bbp_read(rt2x00dev, 2, &r2); rt2500pci_bbp_read(rt2x00dev, 2, &r2);
...@@ -457,15 +464,8 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -457,15 +464,8 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,
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:
default:
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);
rt2x00_set_field32(&reg, BBPCSR1_OFDM, 2); rt2x00_set_field32(&reg, BBPCSR1_OFDM, 2);
...@@ -479,15 +479,8 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -479,15 +479,8 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,
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:
default:
rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2);
break; break;
} }
......
...@@ -437,6 +437,13 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -437,6 +437,13 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
u16 csr5; u16 csr5;
u16 csr6; u16 csr6;
/*
* We should never come here because rt2x00lib is supposed
* to catch this and send us the correct antenna explicitely.
*/
BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
ant->tx == ANTENNA_SW_DIVERSITY);
rt2500usb_bbp_read(rt2x00dev, 2, &r2); rt2500usb_bbp_read(rt2x00dev, 2, &r2);
rt2500usb_bbp_read(rt2x00dev, 14, &r14); rt2500usb_bbp_read(rt2x00dev, 14, &r14);
rt2500usb_register_read(rt2x00dev, PHY_CSR5, &csr5); rt2500usb_register_read(rt2x00dev, PHY_CSR5, &csr5);
...@@ -456,14 +463,8 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -456,14 +463,8 @@ 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:
default:
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);
rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 2); rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 2);
...@@ -480,14 +481,8 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -480,14 +481,8 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
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:
default:
rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2);
break; break;
} }
......
...@@ -481,14 +481,8 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, ...@@ -481,14 +481,8 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
else else
rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 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:
default:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ)
...@@ -530,14 +524,8 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, ...@@ -530,14 +524,8 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 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:
default:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
break; break;
...@@ -575,10 +563,6 @@ static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev, ...@@ -575,10 +563,6 @@ static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev,
rt61pci_bbp_read(rt2x00dev, 4, &r4); rt61pci_bbp_read(rt2x00dev, 4, &r4);
rt61pci_bbp_read(rt2x00dev, 77, &r77); rt61pci_bbp_read(rt2x00dev, 77, &r77);
/* FIXME: Antenna selection for the rf 2529 is very confusing in the
* legacy driver. The code below should be ok for non-diversity setups.
*/
/* /*
* Configure the RX antenna. * Configure the RX antenna.
*/ */
...@@ -588,15 +572,14 @@ static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev, ...@@ -588,15 +572,14 @@ static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 0); rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 0);
break; break;
case ANTENNA_SW_DIVERSITY:
case ANTENNA_HW_DIVERSITY: case ANTENNA_HW_DIVERSITY:
/* /*
* NOTE: We should never come here because rt2x00lib is * FIXME: Antenna selection for the rf 2529 is very confusing
* supposed to catch this and send us the correct antenna * in the legacy driver. Just default to antenna B until the
* explicitely. However we are nog going to bug about this. * legacy code can be properly translated into rt2x00 code.
* Instead, just default to antenna B.
*/ */
case ANTENNA_B: case ANTENNA_B:
default:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 1); rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 1);
...@@ -647,6 +630,13 @@ static void rt61pci_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -647,6 +630,13 @@ static void rt61pci_config_antenna(struct rt2x00_dev *rt2x00dev,
unsigned int i; unsigned int i;
u32 reg; u32 reg;
/*
* We should never come here because rt2x00lib is supposed
* to catch this and send us the correct antenna explicitely.
*/
BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
ant->tx == ANTENNA_SW_DIVERSITY);
if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
sel = antenna_sel_a; sel = antenna_sel_a;
lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
......
...@@ -497,14 +497,8 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, ...@@ -497,14 +497,8 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
else else
rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 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:
default:
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ)
...@@ -545,14 +539,8 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, ...@@ -545,14 +539,8 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
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:
default:
rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
break; break;
...@@ -602,6 +590,13 @@ static void rt73usb_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -602,6 +590,13 @@ static void rt73usb_config_antenna(struct rt2x00_dev *rt2x00dev,
unsigned int i; unsigned int i;
u32 reg; u32 reg;
/*
* We should never come here because rt2x00lib is supposed
* to catch this and send us the correct antenna explicitely.
*/
BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
ant->tx == ANTENNA_SW_DIVERSITY);
if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
sel = antenna_sel_a; sel = antenna_sel_a;
lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册