aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-08-24 05:52:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-26 10:47:57 -0400
commitc750f795c721805f69254cf4dd91f67b28ff6ddc (patch)
treeb49688aa279b0e403b8b5a8cd5c6fa476d2a8c4b
parentfe8e084455f273b32cc57a5fbaf6c22ef984d657 (diff)
b43: HT-PHY: use separated function for forcing RF sequence
Comparison of the HT and N code has shown similarities in the ops performed after b43_mac_phy_clock_set. That way we understood what is happening in the HT-PHY code. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/b43/phy_ht.c32
-rw-r--r--drivers/net/wireless/b43/phy_ht.h11
2 files changed, 34 insertions, 9 deletions
diff --git a/drivers/net/wireless/b43/phy_ht.c b/drivers/net/wireless/b43/phy_ht.c
index 62a90842ebfc..c0e436c16866 100644
--- a/drivers/net/wireless/b43/phy_ht.c
+++ b/drivers/net/wireless/b43/phy_ht.c
@@ -191,6 +191,27 @@ static void b43_phy_ht_afe_unk1(struct b43_wldev *dev)
191 } 191 }
192} 192}
193 193
194static void b43_phy_ht_force_rf_sequence(struct b43_wldev *dev, u16 rf_seq)
195{
196 u8 i;
197
198 u16 save_seq_mode = b43_phy_read(dev, B43_PHY_HT_RF_SEQ_MODE);
199 b43_phy_set(dev, B43_PHY_HT_RF_SEQ_MODE, 0x3);
200
201 b43_phy_set(dev, B43_PHY_HT_RF_SEQ_TRIG, rf_seq);
202 for (i = 0; i < 200; i++) {
203 if (!(b43_phy_read(dev, B43_PHY_HT_RF_SEQ_STATUS) & rf_seq)) {
204 i = 0;
205 break;
206 }
207 msleep(1);
208 }
209 if (i)
210 b43err(dev->wl, "Forcing RF sequence timeout\n");
211
212 b43_phy_write(dev, B43_PHY_HT_RF_SEQ_MODE, save_seq_mode);
213}
214
194static void b43_phy_ht_bphy_init(struct b43_wldev *dev) 215static void b43_phy_ht_bphy_init(struct b43_wldev *dev)
195{ 216{
196 unsigned int i; 217 unsigned int i;
@@ -313,7 +334,6 @@ static void b43_phy_ht_op_prepare_structs(struct b43_wldev *dev)
313 334
314static int b43_phy_ht_op_init(struct b43_wldev *dev) 335static int b43_phy_ht_op_init(struct b43_wldev *dev)
315{ 336{
316 u8 i;
317 u16 tmp; 337 u16 tmp;
318 338
319 b43_phy_ht_tables_init(dev); 339 b43_phy_ht_tables_init(dev);
@@ -418,14 +438,8 @@ static int b43_phy_ht_op_init(struct b43_wldev *dev)
418 438
419 b43_mac_phy_clock_set(dev, true); 439 b43_mac_phy_clock_set(dev, true);
420 440
421 for (i = 0; i < 2; i++) { 441 b43_phy_ht_force_rf_sequence(dev, B43_PHY_HT_RF_SEQ_TRIG_RX2TX);
422 tmp = b43_phy_read(dev, B43_PHY_EXTG(0)); 442 b43_phy_ht_force_rf_sequence(dev, B43_PHY_HT_RF_SEQ_TRIG_RST2RX);
423 b43_phy_set(dev, B43_PHY_EXTG(0), 0x3);
424 b43_phy_set(dev, B43_PHY_EXTG(3), i ? 0x20 : 0x1);
425 /* FIXME: wait for some bit to be cleared (find out which) */
426 b43_phy_read(dev, B43_PHY_EXTG(4));
427 b43_phy_write(dev, B43_PHY_EXTG(0), tmp);
428 }
429 443
430 /* TODO: PHY op on reg 0xb0 */ 444 /* TODO: PHY op on reg 0xb0 */
431 445
diff --git a/drivers/net/wireless/b43/phy_ht.h b/drivers/net/wireless/b43/phy_ht.h
index f70af0caaa33..0661ae266101 100644
--- a/drivers/net/wireless/b43/phy_ht.h
+++ b/drivers/net/wireless/b43/phy_ht.h
@@ -19,6 +19,17 @@
19#define B43_PHY_HT_BW5 0x1D2 19#define B43_PHY_HT_BW5 0x1D2
20#define B43_PHY_HT_BW6 0x1D3 20#define B43_PHY_HT_BW6 0x1D3
21 21
22#define B43_PHY_HT_RF_SEQ_MODE B43_PHY_EXTG(0x000)
23#define B43_PHY_HT_RF_SEQ_TRIG B43_PHY_EXTG(0x003)
24#define B43_PHY_HT_RF_SEQ_TRIG_RX2TX 0x0001 /* RX2TX */
25#define B43_PHY_HT_RF_SEQ_TRIG_TX2RX 0x0002 /* TX2RX */
26#define B43_PHY_HT_RF_SEQ_TRIG_UPGH 0x0004 /* Update gain H */
27#define B43_PHY_HT_RF_SEQ_TRIG_UPGL 0x0008 /* Update gain L */
28#define B43_PHY_HT_RF_SEQ_TRIG_UPGU 0x0010 /* Update gain U */
29#define B43_PHY_HT_RF_SEQ_TRIG_RST2RX 0x0020 /* Reset to RX */
30#define B43_PHY_HT_RF_SEQ_STATUS B43_PHY_EXTG(0x004)
31/* Values for the status are the same as for the trigger */
32
22#define B43_PHY_HT_RF_CTL1 B43_PHY_EXTG(0x010) 33#define B43_PHY_HT_RF_CTL1 B43_PHY_EXTG(0x010)
23 34
24#define B43_PHY_HT_AFE_CTL1 B43_PHY_EXTG(0x110) 35#define B43_PHY_HT_AFE_CTL1 B43_PHY_EXTG(0x110)