b43: N-PHY fixes, check dependency before applying
cover b43: N-PHY fixes, check dependency before applying
Some N-PHY fixes coming from wl observations and specs changes.
Please note this patchset depends on following patches:
[PATCH 1/2] ssb: extract FEM info from SPROM [PATCH 2/2] bcma: extract FEM info from SPROM send 3 days ago.
Rafał Miłecki (7):
b43: N-PHY: random trivial fixes for typos, missing writes
b43: N-PHY: update some init values
b43: N-PHY: workaround BCM43224 hw bug in writing table id 9
b43: N-PHY: add table for antenna software control
b43: N-PHY: determine various PHY params
b43: N-PHY: finish 2.4GHz 0x2056 radio setup
b43: N-PHY: implement spurious tone avoidance
drivers/net/wireless/b43/phy_n.c | 262 +++++++++++++++++++++++++++++--- drivers/net/wireless/b43/phy_n.h | 8 + drivers/net/wireless/b43/radio_2056.c | 25 +++- drivers/net/wireless/b43/radio_2056.h | 1 + drivers/net/wireless/b43/tables_nphy.c | 59 +++++++- drivers/net/wireless/b43/tables_nphy.h | 31 ++-- 6 files changed, 342 insertions(+), 44 deletions(-)
Signature · 1 line
1.7.3.4
PATCH 1/7 b43: N-PHY: random trivial fixes for typos, missing writes
---
There was off-by-one in tx2rx_events and tx2rx_delays arrays. Use ARRAY_SIZE to avoid such mistakes.
Also, I've never meant to write numbers in octal system :| I really forgot that leading 0 means octal :/
--- drivers/net/wireless/b43/phy_n.c | 23 +++++++++++++++-------- drivers/net/wireless/b43/tables_nphy.c | 2 +- drivers/net/wireless/b43/tables_nphy.h | 28 ++++++++++++++-------------- 3 files changed, 30 insertions(+), 23 deletions(-)
drivers/net/wireless/b43/phy_n.c +15 -8
@@ -1493,8 +1493,8 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)struct ssb_sprom *sprom = dev->dev->bus_sprom;/* TX to RX */ -u8 tx2rx_events[9 ] = {0x4 ,0x3 ,0x6 ,0x5 ,0x2 ,0x1 ,0x8 ,0x1F }; -u8 tx2rx_delays[9 ] = {8 ,4 ,2 ,2 ,4 ,4 ,6 ,1 }; +u8 tx2rx_events[8 ] = {0x4 ,0x3 ,0x6 ,0x5 ,0x2 ,0x1 ,0x8 ,0x1F }; +u8 tx2rx_delays[8 ] = {8 ,4 ,2 ,2 ,4 ,4 ,6 ,1 };/* RX to TX */ u8 rx2tx_events_ipa[9 ] = {0x0 ,0x1 ,0x2 ,0x8 ,0x5 ,0x6 ,0xF ,0x3 ,0x1F };
@@ -1505,6 +1505,9 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)u16 tmp16;u32 tmp32; +b43_phy_write (dev,0x23f ,0x1f8 ); +b43_phy_write (dev,0x240 ,0x1f8 ); + tmp32 =b43_ntab_read (dev,B43_NTAB32 (30 ,0 )); tmp32 &=0xffffff ;b43_ntab_write (dev,B43_NTAB32 (30 ,0 ), tmp32);
@@ -1520,12 +1523,13 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)b43_phy_write (dev,0x2AE ,0x000C );/* TX to RX */ -b43_nphy_set_rf_sequence (dev,1 , tx2rx_events, tx2rx_delays,9 ); +b43_nphy_set_rf_sequence (dev,1 , tx2rx_events, tx2rx_delays, +ARRAY_SIZE (tx2rx_events));/* RX to TX */ if (b43_nphy_ipa (dev)) -b43_nphy_set_rf_sequence (dev,1 , rx2tx_events_ipa, - rx2tx_delays_ipa,9 ); +b43_nphy_set_rf_sequence (dev,0 , rx2tx_events_ipa, + rx2tx_delays_ipa,ARRAY_SIZE (rx2tx_events_ipa));if (nphy->hw_phyrxchain !=3 && nphy->hw_phyrxchain != nphy->hw_phytxchain) {if (b43_nphy_ipa (dev)) {
@@ -1533,7 +1537,8 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev) rx2tx_delays[6 ] =1 ; rx2tx_events[7 ] =0x1F ; } -b43_nphy_set_rf_sequence (dev,1 , rx2tx_events, rx2tx_delays,9 ); +b43_nphy_set_rf_sequence (dev,1 , rx2tx_events, rx2tx_delays, +ARRAY_SIZE (rx2tx_events)); } tmp16 = (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) ?
@@ -1547,8 +1552,8 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)b43_nphy_gain_ctrl_workarounds (dev); -b43_ntab_write (dev,B43_NTAB32 (8 ,0 ),2 ); -b43_ntab_write (dev,B43_NTAB32 (8 ,16 ),2 ); +b43_ntab_write (dev,B43_NTAB16 (8 ,0 ),2 ); +b43_ntab_write (dev,B43_NTAB16 (8 ,16 ),2 );/* TODO */
@@ -1560,6 +1565,8 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)b43_radio_write (dev,B2056_RX1 |B2056_RX_MIXA_BIAS_AUX ,0x07 );b43_radio_write (dev,B2056_RX0 |B2056_RX_MIXA_LOB_BIAS ,0x88 );b43_radio_write (dev,B2056_RX1 |B2056_RX_MIXA_LOB_BIAS ,0x88 ); +b43_radio_write (dev,B2056_RX0 |B2056_RX_MIXA_CMFB_IDAC ,0x00 ); +b43_radio_write (dev,B2056_RX1 |B2056_RX_MIXA_CMFB_IDAC ,0x00 );b43_radio_write (dev,B2056_RX0 |B2056_RX_MIXG_CMFB_IDAC ,0x00 );b43_radio_write (dev,B2056_RX1 |B2056_RX_MIXG_CMFB_IDAC ,0x00 );
drivers/net/wireless/b43/tables_nphy.c +1 -1
@@ -2652,7 +2652,7 @@ const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[] = {const s16 tbl_tx_filter_coef_rev4[7 ][15 ] = { {-377 ,137 ,-407 ,208 ,-1527 ,956 ,93 ,186 ,93 ,230 , --44 ,230 ,20 ,-191 ,201 }, +-44 ,230 ,201 ,-191 ,201 }, {-77 ,20 ,-98 ,49 ,-93 ,60 ,56 ,111 ,56 ,26 ,-5 ,26 ,34 ,-32 ,34 },
drivers/net/wireless/b43/tables_nphy.h +14 -14
@@ -127,25 +127,25 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(#define B43_NTAB_C1_LOFEEDTH_SIZE 128/* Static N-PHY tables, PHY revision >= 3 */ -#define B43_NTAB_FRAMESTRUCT_R3 B43_NTAB32(10, 000)/* frame struct */ -#define B43_NTAB_PILOT_R3 B43_NTAB16(11, 000)/* pilot */ -#define B43_NTAB_TMAP_R3 B43_NTAB32(12, 000)/* TM AP */ -#define B43_NTAB_INTLEVEL_R3 B43_NTAB32(13, 000)/* INT LV */ -#define B43_NTAB_TDTRN_R3 B43_NTAB32(14, 000)/* TD TRN */ -#define B43_NTAB_NOISEVAR0_R3 B43_NTAB32(16, 000)/* noise variance 0 */ +#define B43_NTAB_FRAMESTRUCT_R3 B43_NTAB32(10, 0)/* frame struct */ +#define B43_NTAB_PILOT_R3 B43_NTAB16(11, 0)/* pilot */ +#define B43_NTAB_TMAP_R3 B43_NTAB32(12, 0)/* TM AP */ +#define B43_NTAB_INTLEVEL_R3 B43_NTAB32(13, 0)/* INT LV */ +#define B43_NTAB_TDTRN_R3 B43_NTAB32(14, 0)/* TD TRN */ +#define B43_NTAB_NOISEVAR0_R3 B43_NTAB32(16, 0)/* noise variance 0 */ #define B43_NTAB_NOISEVAR1_R3 B43_NTAB32(16, 128)/* noise variance 1 */ -#define B43_NTAB_MCS_R3 B43_NTAB16(18, 000)/* MCS */ +#define B43_NTAB_MCS_R3 B43_NTAB16(18, 0)/* MCS */ #define B43_NTAB_TDI20A0_R3 B43_NTAB32(19, 128)/* TDI 20/0 */ #define B43_NTAB_TDI20A1_R3 B43_NTAB32(19, 256)/* TDI 20/1 */ #define B43_NTAB_TDI40A0_R3 B43_NTAB32(19, 640)/* TDI 40/0 */ #define B43_NTAB_TDI40A1_R3 B43_NTAB32(19, 768)/* TDI 40/1 */ -#define B43_NTAB_PILOTLT_R3 B43_NTAB32(20, 000)/* PLT lookup */ -#define B43_NTAB_CHANEST_R3 B43_NTAB32(22, 000)/* channel estimate */ -#define B43_NTAB_FRAMELT_R3 B43_NTAB8 (24, 000)/* frame lookup */ -#define B43_NTAB_C0_ESTPLT_R3 B43_NTAB8 (26, 000)/* estimated power lookup 0 */ -#define B43_NTAB_C1_ESTPLT_R3 B43_NTAB8 (27, 000)/* estimated power lookup 1 */ -#define B43_NTAB_C0_ADJPLT_R3 B43_NTAB8 (26, 064)/* adjusted power lookup 0 */ -#define B43_NTAB_C1_ADJPLT_R3 B43_NTAB8 (27, 064)/* adjusted power lookup 1 */ +#define B43_NTAB_PILOTLT_R3 B43_NTAB32(20, 0)/* PLT lookup */ +#define B43_NTAB_CHANEST_R3 B43_NTAB32(22, 0)/* channel estimate */ +#define B43_NTAB_FRAMELT_R3 B43_NTAB8(24, 0)/* frame lookup */ +#define B43_NTAB_C0_ESTPLT_R3 B43_NTAB8(26, 0)/* estimated power lookup 0 */ +#define B43_NTAB_C1_ESTPLT_R3 B43_NTAB8(27, 0)/* estimated power lookup 1 */ +#define B43_NTAB_C0_ADJPLT_R3 B43_NTAB8(26, 64)/* adjusted power lookup 0 */ +#define B43_NTAB_C1_ADJPLT_R3 B43_NTAB8(27, 64)/* adjusted power lookup 1 */ #define B43_NTAB_C0_GAINCTL_R3 B43_NTAB32(26, 192)/* gain control lookup 0 */ #define B43_NTAB_C1_GAINCTL_R3 B43_NTAB32(27, 192)/* gain control lookup 1 */ #define B43_NTAB_C0_IQLT_R3 B43_NTAB32(26, 320)/* I/Q lookup 0 */
Signature · 1 line
1.7.3.4
PATCH 2/7 b43: N-PHY: update some init values
In reply to Rafał MiłeckiChanges were obtained from MMIO dump from 5.100.82.112.
--- drivers/net/wireless/b43/phy_n.c | 24 ++++++++++++------------ drivers/net/wireless/b43/radio_2056.c | 10 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/net/wireless/b43/phy_n.c +12 -12
@@ -1591,18 +1591,18 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev) 0x70); } -b43_phy_write (dev,0x224 ,0x039C ); -b43_phy_write (dev,0x225 ,0x0357 ); -b43_phy_write (dev,0x226 ,0x0317 ); -b43_phy_write (dev,0x227 ,0x02D7 ); -b43_phy_write (dev,0x228 ,0x039C ); -b43_phy_write (dev,0x229 ,0x0357 ); -b43_phy_write (dev,0x22A ,0x0317 ); -b43_phy_write (dev,0x22B ,0x02D7 ); -b43_phy_write (dev,0x22C ,0x039C ); -b43_phy_write (dev,0x22D ,0x0357 ); -b43_phy_write (dev,0x22E ,0x0317 ); -b43_phy_write (dev,0x22F ,0x02D7 ); +b43_phy_write (dev,0x224 ,0x03eb ); +b43_phy_write (dev,0x225 ,0x03eb ); +b43_phy_write (dev,0x226 ,0x0341 ); +b43_phy_write (dev,0x227 ,0x0341 ); +b43_phy_write (dev,0x228 ,0x042b ); +b43_phy_write (dev,0x229 ,0x042b ); +b43_phy_write (dev,0x22a ,0x0381 ); +b43_phy_write (dev,0x22b ,0x0381 ); +b43_phy_write (dev,0x22c ,0x042b ); +b43_phy_write (dev,0x22d ,0x042b ); +b43_phy_write (dev,0x22e ,0x0381 ); +b43_phy_write (dev,0x22f ,0x0381 ); }static void b43_nphy_workarounds_rev1_2 (struct b43_wldev *dev)
drivers/net/wireless/b43/radio_2056.c +5 -5
@@ -1572,14 +1572,14 @@ static const struct b2056_inittab_entry b2056_inittab_rev6_syn[] = { [B2056_SYN_PLL_XTAL5] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, [B2056_SYN_PLL_XTAL6] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, [B2056_SYN_PLL_REFDIV] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_PFD] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, + [B2056_SYN_PLL_PFD] = { .ghz5 = 0x0006, .ghz2 = 0x0006, UPLOAD, }, [B2056_SYN_PLL_CP1] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_CP2] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, + [B2056_SYN_PLL_CP2] = { .ghz5 = 0x003f, .ghz2 = 0x003f, UPLOAD, }, [B2056_SYN_PLL_CP3] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER1] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER2] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, + [B2056_SYN_PLL_LOOPFILTER1] = { .ghz5 = 0x0006, .ghz2 = 0x0006, UPLOAD, }, + [B2056_SYN_PLL_LOOPFILTER2] = { .ghz5 = 0x0006, .ghz2 = 0x0006, UPLOAD, }, [B2056_SYN_PLL_LOOPFILTER3] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER4] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, + [B2056_SYN_PLL_LOOPFILTER4] = { .ghz5 = 0x002b, .ghz2 = 0x002b, UPLOAD, }, [B2056_SYN_PLL_LOOPFILTER5] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, [B2056_SYN_PLL_MMD1] = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, }, [B2056_SYN_PLL_MMD2] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
Signature · 1 line
1.7.3.4
PATCH 3/7 b43: N-PHY: workaround BCM43224 hw bug in writing table id 9
In reply to Rafał Miłecki--- drivers/net/wireless/b43/tables_nphy.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/tables_nphy.c +7 -0
@@ -2932,6 +2932,13 @@ void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset,b43_phy_write (dev,B43_NPHY_TABLE_ADDR , offset);for (i =0 ; i < nr_elements; i++) { +/* Auto increment broken + caching issue on BCM43224? */ +if ((offset >>10 ) ==9 && dev->dev->chip_id ==43224 && + dev->dev->chip_rev ==1 ) { +b43_phy_read (dev,B43_NPHY_TABLE_DATALO ); +b43_phy_write (dev,B43_NPHY_TABLE_ADDR , offset + i); + } +switch (type) {case B43_NTAB_8BIT : value = *data;
Signature · 1 line
1.7.3.4
PATCH 4/7 b43: N-PHY: add table for antenna software control
In reply to Rafał Miłecki--- drivers/net/wireless/b43/tables_nphy.c | 50 +++++++++++++++++++++++++++++++- drivers/net/wireless/b43/tables_nphy.h | 3 ++ 2 files changed, 52 insertions(+), 1 deletions(-)
drivers/net/wireless/b43/tables_nphy.c +49 -1
@@ -2171,6 +2171,48 @@ static const u16 b43_ntab_loftlt1_r3[] = { 0x0000, 0x0000, }; +/* volatile tables, PHY revision >= 3 */ + +/* indexed by antswctl2g */ +static const u16 b43_ntab_antswctl2g_r3[4 ][32 ] = { + { +0x0082 ,0x0082 ,0x0211 ,0x0222 ,0x0328 , +0x0000 ,0x0000 ,0x0000 ,0x0144 ,0x0000 , +0x0000 ,0x0000 ,0x0188 ,0x0000 ,0x0000 , +0x0000 ,0x0082 ,0x0082 ,0x0211 ,0x0222 , +0x0328 ,0x0000 ,0x0000 ,0x0000 ,0x0144 , +0x0000 ,0x0000 ,0x0000 ,0x0188 ,0x0000 , +0x0000 ,0x0000 , + }, + { +0x0022 ,0x0022 ,0x0011 ,0x0022 ,0x0022 , +0x0000 ,0x0000 ,0x0000 ,0x0011 ,0x0000 , +0x0000 ,0x0000 ,0x0022 ,0x0000 ,0x0000 , +0x0000 ,0x0022 ,0x0022 ,0x0011 ,0x0022 , +0x0022 ,0x0000 ,0x0000 ,0x0000 ,0x0011 , +0x0000 ,0x0000 ,0x0000 ,0x0022 ,0x0000 , +0x0000 ,0x0000 , + }, + { +0x0088 ,0x0088 ,0x0044 ,0x0088 ,0x0088 , +0x0000 ,0x0000 ,0x0000 ,0x0044 ,0x0000 , +0x0000 ,0x0000 ,0x0088 ,0x0000 ,0x0000 , +0x0000 ,0x0088 ,0x0088 ,0x0044 ,0x0088 , +0x0088 ,0x0000 ,0x0000 ,0x0000 ,0x0044 , +0x0000 ,0x0000 ,0x0000 ,0x0088 ,0x0000 , +0x0000 ,0x0000 , + }, + { +0x0022 ,0x0022 ,0x0011 ,0x0022 ,0x0000 , +0x0000 ,0x0000 ,0x0000 ,0x0011 ,0x0000 , +0x0000 ,0x0000 ,0x0022 ,0x0000 ,0x0000 , +0x03cc ,0x0022 ,0x0022 ,0x0011 ,0x0022 , +0x0000 ,0x0000 ,0x0000 ,0x0000 ,0x0011 , +0x0000 ,0x0000 ,0x0000 ,0x0022 ,0x0000 , +0x0000 ,0x03cc , + } +}; +/* TX gain tables */ const u32 b43_ntab_tx_gain_rev0_1_2[] = {0x03cc2b44 ,0x03cc2b42 ,0x03cc2a44 ,0x03cc2a42 ,
@@ -3006,6 +3048,8 @@ void b43_nphy_rev0_1_2_tables_init(struct b43_wldev *dev) }while (0 ) void b43_nphy_rev3plus_tables_init(struct b43_wldev *dev) { +struct ssb_sprom *sprom = dev->dev->bus_sprom; +/* Static tables */ ntab_upload_r3 (dev,B43_NTAB_FRAMESTRUCT_R3 , b43_ntab_framestruct_r3);ntab_upload_r3 (dev,B43_NTAB_PILOT_R3 , b43_ntab_pilot_r3);
@@ -3036,7 +3080,11 @@ void b43_nphy_rev3plus_tables_init(struct b43_wldev *dev)ntab_upload_r3 (dev,B43_NTAB_C1_LOFEEDTH_R3 , b43_ntab_loftlt1_r3);/* Volatile tables */ -/* TODO */ +if (sprom->fem.ghz2.antswlut <ARRAY_SIZE (b43_ntab_antswctl2g_r3)) +ntab_upload_r3 (dev,B43_NTAB_ANT_SW_CTL_R3 , + b43_ntab_antswctl2g_r3[sprom->fem.ghz2.antswlut]); +else +B43_WARN_ON (1 ); } struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
drivers/net/wireless/b43/tables_nphy.h +3 -0
@@ -126,6 +126,9 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(#define B43_NTAB_C1_LOFEEDTH B43_NTAB16(0x1B, 0x1C0)/* Local Oscillator Feed Through Lookup Table Core 1 */ #define B43_NTAB_C1_LOFEEDTH_SIZE 128 +/* Volatile N-PHY tables, PHY revision >= 3 */ +#define B43_NTAB_ANT_SW_CTL_R3 B43_NTAB16( 9, 0)/* antenna software control */ +/* Static N-PHY tables, PHY revision >= 3 */ #define B43_NTAB_FRAMESTRUCT_R3 B43_NTAB32(10, 0)/* frame struct */ #define B43_NTAB_PILOT_R3 B43_NTAB16(11, 0)/* pilot */
Signature · 1 line
1.7.3.4
PATCH 5/7 b43: N-PHY: determine various PHY params
In reply to Rafał Miłecki--- drivers/net/wireless/b43/phy_n.c | 35 +++++++++++++++++++++++++++++++++++ drivers/net/wireless/b43/phy_n.h | 8 ++++++++ 2 files changed, 43 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_n.c +35 -0
@@ -4062,10 +4062,13 @@ static void b43_nphy_op_prepare_structs(struct b43_wldev *dev) {struct b43_phy *phy = &dev->phy;struct b43_phy_n *nphy = phy->n; +struct ssb_sprom *sprom = dev->dev->bus_sprom;memset (nphy,0 ,sizeof (*nphy)); nphy->hang_avoid = (phy->rev ==3 || phy->rev ==4 ); + nphy->spur_avoid = (phy->rev >=3 ) ? +B43_SPUR_AVOID_AUTO :B43_SPUR_AVOID_DISABLE ; nphy->gain_boost = true;/* this way we follow wl, assume it is true */ nphy->txrx_chain =2 ;/* sth different than 0 and 1 for now */ nphy->phyrxchain =3 ;/* to avoid b43_nphy_set_rx_core_state like wl */
@@ -4074,6 +4077,38 @@ static void b43_nphy_op_prepare_structs(struct b43_wldev *dev)* 0x7f == 127 and we check for 128 when restoring TX pwr ctl. */ nphy->tx_pwr_idx[0 ] =128 ; nphy->tx_pwr_idx[1 ] =128 ; + +/* Hardware TX power control and 5GHz power gain */ + nphy->txpwrctrl = false; + nphy->pwg_gain_5ghz = false; +if (dev->phy.rev >=3 || + (dev->dev->board_vendor ==PCI_VENDOR_ID_APPLE && + (dev->dev->core_rev ==11 || dev->dev->core_rev ==12 ))) { + nphy->txpwrctrl = true; + nphy->pwg_gain_5ghz = true; + }else if (sprom->revision >=4 ) { +if (dev->phy.rev >=2 && + (sprom->boardflags2_lo &B43_BFL2_TXPWRCTRL_EN )) { + nphy->txpwrctrl = true; +#ifdef CONFIG_B43_SSB +if (dev->dev->bus_type ==B43_BUS_SSB && + dev->dev->sdev->bus->bustype ==SSB_BUSTYPE_PCI ) { +struct pci_dev *pdev = + dev->dev->sdev->bus->host_pci; +if (pdev->device ==0x4328 || + pdev->device ==0x432a ) + nphy->pwg_gain_5ghz = true; + } +#endif + }else if (sprom->boardflags2_lo &B43_BFL2_5G_PWRGAIN ) { + nphy->pwg_gain_5ghz = true; + } + } + +if (dev->phy.rev >=3 ) { + nphy->ipa2g_on = sprom->fem.ghz2.extpa_gain ==2 ; + nphy->ipa5g_on = sprom->fem.ghz5.extpa_gain ==2 ; + } }static void b43_nphy_op_free (struct b43_wldev *dev)
drivers/net/wireless/b43/phy_n.h +8 -0
@@ -716,6 +716,12 @@struct b43_wldev ; +enum b43_nphy_spur_avoid { +B43_SPUR_AVOID_DISABLE , +B43_SPUR_AVOID_AUTO , +B43_SPUR_AVOID_FORCE , +}; +struct b43_chanspec {u16 center_freq;enum nl80211_channel_type channel_type;
@@ -785,6 +791,7 @@ struct b43_phy_n {u16 mphase_txcal_bestcoeffs[11 ];bool txpwrctrl; +bool pwg_gain_5ghz;u8 tx_pwr_idx[2 ];u16 adj_pwr_tbl[84 ];u16 txcal_bbmult;
@@ -803,6 +810,7 @@ struct b43_phy_n {u16 classifier_state;u16 clip_state[2 ]; +enum b43_nphy_spur_avoid spur_avoid;bool aband_spurwar_en;bool gband_spurwar_en;
Signature · 1 line
1.7.3.4
PATCH 6/7 b43: N-PHY: finish 2.4GHz 0x2056 radio setup
In reply to Rafał Miłecki--- drivers/net/wireless/b43/phy_n.c | 90 ++++++++++++++++++++++++++++++++- drivers/net/wireless/b43/radio_2056.c | 15 ++++++ drivers/net/wireless/b43/radio_2056.h | 1 + 3 files changed, 105 insertions(+), 1 deletions(-)
drivers/net/wireless/b43/phy_n.c +89 -1
@@ -228,10 +228,98 @@ static void b43_chantab_radio_2056_upload(struct b43_wldev *dev,static void b43_radio_2056_setup (struct b43_wldev *dev,const struct b43_nphy_channeltab_entry_rev3 *e) { +struct ssb_sprom *sprom = dev->dev->bus_sprom; +enum ieee80211_band band =b43_current_band (dev->wl); +u16 offset; +u8 i; +u16 bias, cbias, pag_boost, pgag_boost, mixg_boost, padg_boost; +B43_WARN_ON (dev->phy.rev <3 );b43_chantab_radio_2056_upload (dev, e); -/* TODO */ +b2056_upload_syn_pll_cp2 (dev, band ==IEEE80211_BAND_5GHZ ); + +if (sprom->boardflags2_lo &B43_BFL2_GPLL_WAR && +b43_current_band (dev->wl) ==IEEE80211_BAND_2GHZ ) { +b43_radio_write (dev,B2056_SYN_PLL_LOOPFILTER1 ,0x1F ); +b43_radio_write (dev,B2056_SYN_PLL_LOOPFILTER2 ,0x1F ); +if (dev->dev->chip_id ==0x4716 ) { +b43_radio_write (dev,B2056_SYN_PLL_LOOPFILTER4 ,0x14 ); +b43_radio_write (dev,B2056_SYN_PLL_CP2 ,0 ); + }else { +b43_radio_write (dev,B2056_SYN_PLL_LOOPFILTER4 ,0x0B ); +b43_radio_write (dev,B2056_SYN_PLL_CP2 ,0x14 ); + } + } +if (sprom->boardflags2_lo &B43_BFL2_APLL_WAR && +b43_current_band (dev->wl) ==IEEE80211_BAND_5GHZ ) { +b43_radio_write (dev,B2056_SYN_PLL_LOOPFILTER1 ,0x1F ); +b43_radio_write (dev,B2056_SYN_PLL_LOOPFILTER2 ,0x1F ); +b43_radio_write (dev,B2056_SYN_PLL_LOOPFILTER4 ,0x05 ); +b43_radio_write (dev,B2056_SYN_PLL_CP2 ,0x0C ); + } + +if (dev->phy.n->ipa2g_on && band ==IEEE80211_BAND_2GHZ ) { +for (i =0 ; i <2 ; i++) { + offset = i ?B2056_TX1 :B2056_TX0 ; +if (dev->phy.rev >=5 ) { +b43_radio_write (dev, + offset |B2056_TX_PADG_IDAC ,0xcc ); + +if (dev->dev->chip_id ==0x4716 ) { + bias =0x40 ; + cbias =0x45 ; + pag_boost =0x5 ; + pgag_boost =0x33 ; + mixg_boost =0x55 ; + }else { + bias =0x25 ; + cbias =0x20 ; + pag_boost =0x4 ; + pgag_boost =0x03 ; + mixg_boost =0x65 ; + } + padg_boost =0x77 ; + +b43_radio_write (dev, + offset |B2056_TX_INTPAG_IMAIN_STAT , + bias); +b43_radio_write (dev, + offset |B2056_TX_INTPAG_IAUX_STAT , + bias); +b43_radio_write (dev, + offset |B2056_TX_INTPAG_CASCBIAS , + cbias); +b43_radio_write (dev, + offset |B2056_TX_INTPAG_BOOST_TUNE , + pag_boost); +b43_radio_write (dev, + offset |B2056_TX_PGAG_BOOST_TUNE , + pgag_boost); +b43_radio_write (dev, + offset |B2056_TX_PADG_BOOST_TUNE , + padg_boost); +b43_radio_write (dev, + offset |B2056_TX_MIXG_BOOST_TUNE , + mixg_boost); + }else { + bias = dev->phy.is_40mhz ?0x40 :0x20 ; +b43_radio_write (dev, + offset |B2056_TX_INTPAG_IMAIN_STAT , + bias); +b43_radio_write (dev, + offset |B2056_TX_INTPAG_IAUX_STAT , + bias); +b43_radio_write (dev, + offset |B2056_TX_INTPAG_CASCBIAS , +0x30 ); + } +b43_radio_write (dev, offset |B2056_TX_PA_SPARE1 ,0xee ); + } + }else if (dev->phy.n->ipa5g_on && band ==IEEE80211_BAND_5GHZ ) { +/* TODO */ + } +udelay (50 );/* VCO calibration */ b43_radio_write (dev,B2056_SYN_PLL_VCOCAL12 ,0x00 );
drivers/net/wireless/b43/radio_2056.c +15 -0
@@ -9055,6 +9055,21 @@ void b2056_upload_inittabs(struct b43_wldev *dev, B2056_RX1, pts->rx, pts->rx_length); } +void b2056_upload_syn_pll_cp2 (struct b43_wldev *dev,bool ghz5) +{ +struct b2056_inittabs_pts *pts; +const struct b2056_inittab_entry *e; + +if (dev->phy.rev >=ARRAY_SIZE (b2056_inittabs)) { +B43_WARN_ON (1 ); +return ; + } + pts = &b2056_inittabs[dev->phy.rev]; + e = &pts->syn[B2056_SYN_PLL_CP2 ]; + +b43_radio_write (dev,B2056_SYN_PLL_CP2 , ghz5 ? e->ghz5 : e->ghz2); +} +const struct b43_nphy_channeltab_entry_rev3 *b43_nphy_get_chantabent_rev3 (struct b43_wldev *dev,u16 freq) {
drivers/net/wireless/b43/radio_2056.h +1 -0
@@ -1090,6 +1090,7 @@ struct b43_nphy_channeltab_entry_rev3 {void b2056_upload_inittabs (struct b43_wldev *dev,bool ghz5,bool ignore_uploadflag); +void b2056_upload_syn_pll_cp2 (struct b43_wldev *dev,bool ghz5);/* Get the NPHY Channel Switch Table entry for a channel. * Returns NULL on failure to find an entry. */
Signature · 1 line
1.7.3.4
PATCH 7/7 b43: N-PHY: implement spurious tone avoidance
In reply to Rafał Miłecki--- drivers/net/wireless/b43/phy_n.c | 90 +++++++++++++++++++++++++++++++++++++- 1 files changed, 88 insertions(+), 2 deletions(-)
drivers/net/wireless/b43/phy_n.c +88 -2
@@ -4023,6 +4023,58 @@ int b43_phy_initn(struct b43_wldev *dev)return 0 ; } +static void b43_nphy_pmu_spur_avoid (struct b43_wldev *dev,bool avoid) +{ +struct bcma_drv_cc *cc = &dev->dev->bdev->bus->drv_cc; +u32 pmu_ctl; +if (dev->dev->chip_id ==43224 || dev->dev->chip_id ==43225 ) { +if (avoid) { +bcma_chipco_pll_write (cc,0x0 ,0x11500010 ); +bcma_chipco_pll_write (cc,0x1 ,0x000C0C06 ); +bcma_chipco_pll_write (cc,0x2 ,0x0F600a08 ); +bcma_chipco_pll_write (cc,0x3 ,0x00000000 ); +bcma_chipco_pll_write (cc,0x4 ,0x2001E920 ); +bcma_chipco_pll_write (cc,0x5 ,0x88888815 ); + }else { +bcma_chipco_pll_write (cc,0x0 ,0x11100010 ); +bcma_chipco_pll_write (cc,0x1 ,0x000c0c06 ); +bcma_chipco_pll_write (cc,0x2 ,0x03000a08 ); +bcma_chipco_pll_write (cc,0x3 ,0x00000000 ); +bcma_chipco_pll_write (cc,0x4 ,0x200005c0 ); +bcma_chipco_pll_write (cc,0x5 ,0x88888815 ); + } + pmu_ctl =BCMA_CC_PMU_CTL_PLL_UPD ; + }else if (dev->dev->chip_id ==0x4716 ) { +if (avoid) { +bcma_chipco_pll_write (cc,0x0 ,0x11500060 ); +bcma_chipco_pll_write (cc,0x1 ,0x080C0C06 ); +bcma_chipco_pll_write (cc,0x2 ,0x0F600000 ); +bcma_chipco_pll_write (cc,0x3 ,0x00000000 ); +bcma_chipco_pll_write (cc,0x4 ,0x2001E924 ); +bcma_chipco_pll_write (cc,0x5 ,0x88888815 ); + }else { +bcma_chipco_pll_write (cc,0x0 ,0x11100060 ); +bcma_chipco_pll_write (cc,0x1 ,0x080c0c06 ); +bcma_chipco_pll_write (cc,0x2 ,0x03000000 ); +bcma_chipco_pll_write (cc,0x3 ,0x00000000 ); +bcma_chipco_pll_write (cc,0x4 ,0x200005c0 ); +bcma_chipco_pll_write (cc,0x5 ,0x88888815 ); + } + pmu_ctl =BCMA_CC_PMU_CTL_PLL_UPD |BCMA_CC_PMU_CTL_NOILPONW ; + }else if (dev->dev->chip_id ==0x4322 || dev->dev->chip_id ==0x4340 || + dev->dev->chip_id ==0x4341 ) { +bcma_chipco_pll_write (cc,0x0 ,0x11100070 ); +bcma_chipco_pll_write (cc,0x1 ,0x1014140a ); +bcma_chipco_pll_write (cc,0x5 ,0x88888854 ); +if (avoid) +bcma_chipco_pll_write (cc,0x2 ,0x05201828 ); +else +bcma_chipco_pll_write (cc,0x2 ,0x05001828 ); + pmu_ctl =BCMA_CC_PMU_CTL_PLL_UPD ; + } +bcma_cc_set32 (cc,BCMA_CC_PMU_CTL , pmu_ctl); +} +/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */ static void b43_nphy_channel_setup(struct b43_wldev *dev, const struct b43_phy_n_sfo_cfg *e,
@@ -4030,6 +4082,7 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev, {struct b43_phy *phy = &dev->phy;struct b43_phy_n *nphy = dev->phy.n; +int ch = new_channel->hw_value;u16 old_band_5ghz;u32 tmp32;
@@ -4069,8 +4122,41 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev,b43_nphy_tx_lp_fbw (dev); -if (dev->phy.rev >=3 &&0 ) { -/* TODO */ +if (dev->phy.rev >=3 && + dev->phy.n->spur_avoid !=B43_SPUR_AVOID_DISABLE ) { +bool avoid = false; +if (dev->phy.n->spur_avoid ==B43_SPUR_AVOID_FORCE ) { + avoid = true; + }else if (!b43_channel_type_is_40mhz (phy->channel_type)) { +if ((ch >=5 && ch <=8 ) || ch ==13 || ch ==14 ) + avoid = true; + }else {/* 40MHz */ +if (nphy->aband_spurwar_en && + (ch ==38 || ch ==102 || ch ==118 )) + avoid = dev->dev->chip_id ==0x4716 ; + } + +b43_nphy_pmu_spur_avoid (dev, avoid); + +if (dev->dev->chip_id ==43222 || dev->dev->chip_id ==43224 || + dev->dev->chip_id ==43225 ) { +b43_write16 (dev,B43_MMIO_TSF_CLK_FRAC_LOW , + avoid ?0x5341 :0x8889 ); +b43_write16 (dev,B43_MMIO_TSF_CLK_FRAC_HIGH ,0x8 ); + } + +if (dev->phy.rev ==3 || dev->phy.rev ==4 ) + ;/* TODO: reset PLL */ + +if (avoid) +b43_phy_set (dev,B43_NPHY_BBCFG ,B43_NPHY_BBCFG_RSTRX ); +else +b43_phy_mask (dev,B43_NPHY_BBCFG , + ~B43_NPHY_BBCFG_RSTRX &0xFFFF ); + +b43_nphy_reset_cca (dev); + +/* wl sets useless phy_isspuravoid here */ }b43_phy_write (dev,B43_NPHY_NDATAT_DUP40 ,0x3830 );
Signature · 1 line
1.7.3.4
PATCH 7/7 b43: N-PHY: implement spurious tone avoidance
Quoted 54 lines · Rafa? Mi?ecki
Signed-off-by Rafa? Mi?ecki<[email protected]>--- drivers/net/wireless/b43/phy_n.c | 90 +++++++++++++++++++++++++++++++++++++- 1 files changed, 88 insertions(+), 2 deletions(-)drivers/net/wireless/b43/phy_n.c +40
-0@@ -4023,6 +4023,58 @@ int b43_phy_initn(struct b43_wldev *dev)return 0 ; } +static void b43_nphy_pmu_spur_avoid (struct b43_wldev *dev,bool avoid) +{ +struct bcma_drv_cc *cc =&dev->dev->bdev->bus->drv_cc; +u32 pmu_ctl; +if (dev->dev->chip_id ==43224 || dev->dev->chip_id ==43225 ) { +if (avoid) { +bcma_chipco_pll_write (cc,0x0 ,0x11500010 ); +bcma_chipco_pll_write (cc,0x1 ,0x000C0C06 ); +bcma_chipco_pll_write (cc,0x2 ,0x0F600a08 ); +bcma_chipco_pll_write (cc,0x3 ,0x00000000 ); +bcma_chipco_pll_write (cc,0x4 ,0x2001E920 ); +bcma_chipco_pll_write (cc,0x5 ,0x88888815 ); + }else { +bcma_chipco_pll_write (cc,0x0 ,0x11100010 ); +bcma_chipco_pll_write (cc,0x1 ,0x000c0c06 ); +bcma_chipco_pll_write (cc,0x2 ,0x03000a08 ); +bcma_chipco_pll_write (cc,0x3 ,0x00000000 ); +bcma_chipco_pll_write (cc,0x4 ,0x200005c0 ); +bcma_chipco_pll_write (cc,0x5 ,0x88888815 ); + } + pmu_ctl =BCMA_CC_PMU_CTL_PLL_UPD ; + }else if (dev->dev->chip_id ==0x4716 ) { +if (avoid) { +bcma_chipco_pll_write (cc,0x0 ,0x11500060 ); +bcma_chipco_pll_write (cc,0x1 ,0x080C0C06 ); +bcma_chipco_pll_write (cc,0x2 ,0x0F600000 ); +bcma_chipco_pll_write (cc,0x3 ,0x00000000 ); +bcma_chipco_pll_write (cc,0x4 ,0x2001E924 ); +bcma_chipco_pll_write (cc,0x5 ,0x88888815 ); + }else { +bcma_chipco_pll_write (cc,0x0 ,0x11100060 ); +bcma_chipco_pll_write (cc,0x1 ,0x080c0c06 ); +bcma_chipco_pll_write (cc,0x2 ,0x03000000 ); +bcma_chipco_pll_write (cc,0x3 ,0x00000000 ); +bcma_chipco_pll_write (cc,0x4 ,0x200005c0 ); +bcma_chipco_pll_write (cc,0x5 ,0x88888815 ); + } + pmu_ctl =BCMA_CC_PMU_CTL_PLL_UPD |BCMA_CC_PMU_CTL_NOILPONW ; + }else if (dev->dev->chip_id ==0x4322 || dev->dev->chip_id ==0x4340 || + dev->dev->chip_id ==0x4341 ) {
drivers/net/wireless/b43/phy_n.c int b43_phy_initn(struct b43_wldev *dev) · line 4075
Quoted 10 lines
drivers/net/wireless/b43/phy_n.c +10
-0+bcma_chipco_pll_write (cc,0x0 ,0x11100070 ); +bcma_chipco_pll_write (cc,0x1 ,0x1014140a ); +bcma_chipco_pll_write (cc,0x5 ,0x88888854 ); +if (avoid) +bcma_chipco_pll_write (cc,0x2 ,0x05201828 ); +else +bcma_chipco_pll_write (cc,0x2 ,0x05001828 ); + pmu_ctl =BCMA_CC_PMU_CTL_PLL_UPD ; + } +bcma_cc_set32 (cc,BCMA_CC_PMU_CTL , pmu_ctl);
My gcc is brain dead here and outputs
CC [M] drivers/net/wireless/b43/phy_n.odrivers/net/wireless/b43/phy_n.c: In function ?b43_nphy_channel_setup.isra.14?:drivers/net/wireless/b43/phy_n.c:4075:2: warning: ?pmu_ctl? may be used uninitialized in this function [-Wuninitialized] drivers/net/wireless/b43/phy_n.c:4029:6: note: ?pmu_ctl? was declared here
The variable is clearly set in all paths, but I still get the warning.
Larry
Re: [PATCH 7/7] b43: N-PHY: implement spurious tone avoidance
Larry,
2011/12/11 Larry Finger <[email protected]>:
Quoted 18 lines · Rafał Miłecki
Quoted 17 lines
Signed-off-by Rafał Miłecki<[email protected]>---
drivers/net/wireless/b43/phy_n.c | 90
+++++++++++++++++++++++++++++++++++++-1 files changed, 88 insertions(+), 2 deletions(-)drivers/net/wireless/b43/phy_n.c +0
-0@@ -4023,6 +4023,58 @@ int b43_phy_initn(struct b43_wldev *dev) return 0; }
Quoted 5 lines
Quoted 1 line
[snip]
My gcc is brain dead here and outputs
[snip] variable may be used uninitialised warning
It's not brain dead =)
Quoted 1 line
The variable is clearly set in all paths, but I still get the warning.
It's set in all paths, but there is no way to guarantee that one of the paths will be taken - they all have conditions.
Something like the following might be better:
Quoted 4 lines
Quoted 4 lines
drivers/net/wireless/b43/phy_n.c +3
-0+static void b43_nphy_pmu_spur_avoid (struct b43_wldev *dev,bool avoid) +{ +struct bcma_drv_cc *cc =&dev->dev->bdev->bus->drv_cc;
Quoted 14 lines
Quoted 5 lines
drivers/net/wireless/b43/phy_n.c +3
-0+u32 pmu_ctl; +if (dev->dev->chip_id ==43224 || dev->dev->chip_id ==43225 ) { + } else if (dev->dev->chip_id == 0x4322 || dev->dev->chip_id ==
0x4340||drivers/net/wireless/b43/phy_n.c int b43_phy_initn(struct b43_wldev *dev) · line 4073
Quoted 9 lines
drivers/net/wireless/b43/phy_n.c +9
-0+ dev->dev->chip_id == 0x4341) { +bcma_chipco_pll_write (cc,0x0 ,0x11100070 ); +bcma_chipco_pll_write (cc,0x1 ,0x1014140a ); +bcma_chipco_pll_write (cc,0x5 ,0x88888854 ); +if (avoid) +bcma_chipco_pll_write (cc,0x2 ,0x05201828 ); +else +bcma_chipco_pll_write (cc,0x2 ,0x05001828 ); + pmu_ctl =BCMA_CC_PMU_CTL_PLL_UPD ;
+ } else {
+ B43_WARN_ON(1);
+
+ return;
+ }
+
Quoted 1 line
Quoted 1 line
+
bcma_cc_set32(cc, BCMA_CC_PMU_CTL, pmu_ctl);
Thanks,
Signature · 5 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/ .Plan: http://sites.google.com/site/juliancalaby/
cover b43: N-PHY fixes, check dependency before applying
In reply to Rafał MiłeckiQuoted 16 lines · Rafa? Mi?ecki
Some N-PHY fixes coming from wl observations and specs changes.
Please note this patchset depends on following patches:
[PATCH 1/2] ssb: extract FEM info from SPROM [PATCH 2/2] bcma: extract FEM info from SPROM send 3 days ago.Rafa? Mi?ecki (7):
b43: N-PHY: random trivial fixes for typos, missing writes
b43: N-PHY: update some init values
b43: N-PHY: workaround BCM43224 hw bug in writing table id 9
b43: N-PHY: add table for antenna software control
b43: N-PHY: determine various PHY params
b43: N-PHY: finish 2.4GHz0x2056radio setup
b43: N-PHY: implement spurious tone avoidance
Quoted 7 lines
drivers/net/wireless/b43/phy_n.c | 262 +++++++++++++++++++++++++++++--- drivers/net/wireless/b43/phy_n.h | 8 + drivers/net/wireless/b43/radio_2056.c | 25 +++- drivers/net/wireless/b43/radio_2056.h | 1 + drivers/net/wireless/b43/tables_nphy.c | 59 +++++++- drivers/net/wireless/b43/tables_nphy.h | 31 ++-- 6 files changed, 342 insertions(+), 44 deletions(-)
This set of patches improved the performance of my BCM43224.
netperf TCP_MAERTS (RX) 15.0 => 24.5 Mbps
netperf TCP_STREAM (TX) 6.0 => 13.1 Mbps
I have mac80211 debug on, and I see a lot of
wlan13: detected beacon loss from AP - sending probe request
These occur at 1 second intervals. This particular AP does not have a setting for the beacon interval, but I think it is at 100 ms.
Larry
cover b43: N-PHY fixes, check dependency before applying
In reply to Rafał MiłeckiRafa?,
I checked the network traffic on the 43224 using kismet. The beacons are clearly seen in the capture; however, they appear not to get back to mac80211. I'll look for the reason.
Larry