b43: N-PHY: fix RSSI selection
PATCH 1/3 b43: N-PHY: fix RSSI selection
Signed-off-by Rafa? Mi?ecki <[email protected]>
--- drivers/net/wireless/b43/phy_n.c | 38 +++++++++++++++++++++++++------------- 1 files changed, 25 insertions(+), 13 deletions(-)
drivers/net/wireless/b43/phy_n.c +25 -13
@@ -1822,27 +1822,39 @@ static void b43_nphy_rev2_rssi_select(struct b43_wldev *dev, u8 code, u8 type) (type + 1) << 4); } -/* TODO use some definitions */ if (code ==0 ) { -b43_phy_maskset (dev,B43_NPHY_AFECTL_OVER ,0xCFFF ,0 ); +b43_phy_mask (dev,B43_NPHY_AFECTL_OVER , ~0x3000 );if (type <3 ) { -b43_phy_maskset (dev,B43_NPHY_RFCTL_CMD ,0xFEC7 ,0 ); -b43_phy_maskset (dev,B43_NPHY_RFCTL_OVER ,0xEFDC ,0 ); -b43_phy_maskset (dev,B43_NPHY_RFCTL_CMD ,0xFFFE ,0 ); +b43_phy_mask (dev,B43_NPHY_RFCTL_CMD , + ~(B43_NPHY_RFCTL_CMD_RXEN | +B43_NPHY_RFCTL_CMD_CORESEL )); +b43_phy_mask (dev,B43_NPHY_RFCTL_OVER , + ~(0x1 <<12 | +0x1 <<5 | +0x1 <<1 | +0x1 )); +b43_phy_mask (dev,B43_NPHY_RFCTL_CMD , + ~B43_NPHY_RFCTL_CMD_START );udelay (20 ); -b43_phy_maskset (dev,B43_NPHY_RFCTL_OVER ,0xFFFE ,0 ); +b43_phy_mask (dev,B43_NPHY_RFCTL_OVER , ~0x1 ); } }else { -b43_phy_maskset (dev,B43_NPHY_AFECTL_OVER ,0xCFFF , -0x3000 ); +b43_phy_set (dev,B43_NPHY_AFECTL_OVER ,0x3000 );if (type <3 ) {b43_phy_maskset (dev,B43_NPHY_RFCTL_CMD , -0xFEC7 ,0x0180 ); -b43_phy_maskset (dev,B43_NPHY_RFCTL_OVER , -0xEFDC , (code <<1 |0x1021 )); -b43_phy_maskset (dev,B43_NPHY_RFCTL_CMD ,0xFFFE ,0x1 ); + ~(B43_NPHY_RFCTL_CMD_RXEN | +B43_NPHY_RFCTL_CMD_CORESEL ), + (B43_NPHY_RFCTL_CMD_RXEN | + code <<B43_NPHY_RFCTL_CMD_CORESEL_SHIFT )); +b43_phy_set (dev,B43_NPHY_RFCTL_OVER , + (0x1 <<12 | +0x1 <<5 | +0x1 <<1 | +0x1 )); +b43_phy_set (dev,B43_NPHY_RFCTL_CMD , +B43_NPHY_RFCTL_CMD_START );udelay (20 ); -b43_phy_maskset (dev,B43_NPHY_RFCTL_OVER ,0xFFFE ,0 ); +b43_phy_mask (dev,B43_NPHY_RFCTL_OVER , ~0x1 ); } } }
Signature · 1 line
1.6.3.3
PATCH 2/3 b43: N-PHY: use defines for RSSI types
Signed-off-by Rafa? Mi?ecki <[email protected]>
--- drivers/net/wireless/b43/phy_n.c | 73 +++++++++++++++++++++++-------------- 1 files changed, 45 insertions(+), 28 deletions(-)
drivers/net/wireless/b43/phy_n.c +45 -28
@@ -67,6 +67,16 @@ enum b43_nphy_rf_sequence { B43_RFSEQ_UPDATE_GAINU, }; +enum b43_nphy_rssi_type { +B43_NPHY_RSSI_X =0 , +B43_NPHY_RSSI_Y , +B43_NPHY_RSSI_Z , +B43_NPHY_RSSI_PWRDET , +B43_NPHY_RSSI_TSSI_I , +B43_NPHY_RSSI_TSSI_Q , +B43_NPHY_RSSI_TBD , +}; +static void b43_nphy_stay_in_carrier_search (struct b43_wldev *dev,bool enable); static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd,
@@ -1739,7 +1749,8 @@ static void b43_nphy_bphy_init(struct b43_wldev *dev)/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ScaleOffsetRssi */ static void b43_nphy_scale_offset_rssi (struct b43_wldev *dev,u16 scale, -s8 offset,u8 core,u8 rail,u8 type) +s8 offset,u8 core,u8 rail, +enum b43_nphy_rssi_type type) {u16 tmp;bool core1or5 = (core ==1 ) || (core ==5 );
@@ -1748,53 +1759,59 @@ static void b43_nphy_scale_offset_rssi(struct b43_wldev *dev, u16 scale, offset =clamp_val (offset,-32 ,31 ); tmp = ((scale &0x3F ) <<8 ) | (offset &0x3F ); -if (core1or5 && (rail ==0 ) && (type ==2 )) +if (core1or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_Z ))b43_phy_write (dev,B43_NPHY_RSSIMC_0I_RSSI_Z , tmp); -if (core1or5 && (rail ==1 ) && (type ==2 )) +if (core1or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_Z ))b43_phy_write (dev,B43_NPHY_RSSIMC_0Q_RSSI_Z , tmp); -if (core2or5 && (rail ==0 ) && (type ==2 )) +if (core2or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_Z ))b43_phy_write (dev,B43_NPHY_RSSIMC_1I_RSSI_Z , tmp); -if (core2or5 && (rail ==1 ) && (type ==2 )) +if (core2or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_Z ))b43_phy_write (dev,B43_NPHY_RSSIMC_1Q_RSSI_Z , tmp); -if (core1or5 && (rail ==0 ) && (type ==0 )) + +if (core1or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_X ))b43_phy_write (dev,B43_NPHY_RSSIMC_0I_RSSI_X , tmp); -if (core1or5 && (rail ==1 ) && (type ==0 )) +if (core1or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_X ))b43_phy_write (dev,B43_NPHY_RSSIMC_0Q_RSSI_X , tmp); -if (core2or5 && (rail ==0 ) && (type ==0 )) +if (core2or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_X ))b43_phy_write (dev,B43_NPHY_RSSIMC_1I_RSSI_X , tmp); -if (core2or5 && (rail ==1 ) && (type ==0 )) +if (core2or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_X ))b43_phy_write (dev,B43_NPHY_RSSIMC_1Q_RSSI_X , tmp); -if (core1or5 && (rail ==0 ) && (type ==1 )) + +if (core1or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_Y ))b43_phy_write (dev,B43_NPHY_RSSIMC_0I_RSSI_Y , tmp); -if (core1or5 && (rail ==1 ) && (type ==1 )) +if (core1or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_Y ))b43_phy_write (dev,B43_NPHY_RSSIMC_0Q_RSSI_Y , tmp); -if (core2or5 && (rail ==0 ) && (type ==1 )) +if (core2or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_Y ))b43_phy_write (dev,B43_NPHY_RSSIMC_1I_RSSI_Y , tmp); -if (core2or5 && (rail ==1 ) && (type ==1 )) +if (core2or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_Y ))b43_phy_write (dev,B43_NPHY_RSSIMC_1Q_RSSI_Y , tmp); -if (core1or5 && (rail ==0 ) && (type ==6 )) + +if (core1or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_TBD ))b43_phy_write (dev,B43_NPHY_RSSIMC_0I_TBD , tmp); -if (core1or5 && (rail ==1 ) && (type ==6 )) +if (core1or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_TBD ))b43_phy_write (dev,B43_NPHY_RSSIMC_0Q_TBD , tmp); -if (core2or5 && (rail ==0 ) && (type ==6 )) +if (core2or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_TBD ))b43_phy_write (dev,B43_NPHY_RSSIMC_1I_TBD , tmp); -if (core2or5 && (rail ==1 ) && (type ==6 )) +if (core2or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_TBD ))b43_phy_write (dev,B43_NPHY_RSSIMC_1Q_TBD , tmp); -if (core1or5 && (rail ==0 ) && (type ==3 )) + +if (core1or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_PWRDET ))b43_phy_write (dev,B43_NPHY_RSSIMC_0I_PWRDET , tmp); -if (core1or5 && (rail ==1 ) && (type ==3 )) +if (core1or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_PWRDET ))b43_phy_write (dev,B43_NPHY_RSSIMC_0Q_PWRDET , tmp); -if (core2or5 && (rail ==0 ) && (type ==3 )) +if (core2or5 && (rail ==0 ) && (type ==B43_NPHY_RSSI_PWRDET ))b43_phy_write (dev,B43_NPHY_RSSIMC_1I_PWRDET , tmp); -if (core2or5 && (rail ==1 ) && (type ==3 )) +if (core2or5 && (rail ==1 ) && (type ==B43_NPHY_RSSI_PWRDET ))b43_phy_write (dev,B43_NPHY_RSSIMC_1Q_PWRDET , tmp); -if (core1or5 && (type ==4 )) + +if (core1or5 && (type ==B43_NPHY_RSSI_TSSI_I ))b43_phy_write (dev,B43_NPHY_RSSIMC_0I_TSSI , tmp); -if (core2or5 && (type ==4 )) +if (core2or5 && (type ==B43_NPHY_RSSI_TSSI_I ))b43_phy_write (dev,B43_NPHY_RSSIMC_1I_TSSI , tmp); -if (core1or5 && (type ==5 )) + +if (core1or5 && (type ==B43_NPHY_RSSI_TSSI_Q ))b43_phy_write (dev,B43_NPHY_RSSIMC_0Q_TSSI , tmp); -if (core2or5 && (type ==5 )) +if (core2or5 && (type ==B43_NPHY_RSSI_TSSI_Q ))b43_phy_write (dev,B43_NPHY_RSSIMC_1Q_TSSI , tmp); }
@@ -2246,9 +2263,9 @@ static void b43_nphy_rssi_cal(struct b43_wldev *dev)if (dev->phy.rev >=3 ) {b43_nphy_rev3_rssi_cal (dev); }else { -b43_nphy_rev2_rssi_cal (dev,2 ); -b43_nphy_rev2_rssi_cal (dev,0 ); -b43_nphy_rev2_rssi_cal (dev,1 ); +b43_nphy_rev2_rssi_cal (dev,B43_NPHY_RSSI_Z ); +b43_nphy_rev2_rssi_cal (dev,B43_NPHY_RSSI_X ); +b43_nphy_rev2_rssi_cal (dev,B43_NPHY_RSSI_Y ); } }
Signature · 1 line
1.6.3.3
PATCH 3/3 b43: N-PHY: fix code path on PHY init
In reply to Rafał MiłeckiSigned-off-by Rafa? Mi?ecki <[email protected]>
---
John: this introduces 2 lines over 80 chars, but I really dislike idea of breaking line between argument, and so having start of function name in one line and comparing result to zero in another.
Are you OK with this?
--- drivers/net/wireless/b43/phy_n.c | 17 +++++++---------- 1 files changed, 7 insertions(+), 10 deletions(-)
drivers/net/wireless/b43/phy_n.c +7 -10
@@ -3498,19 +3498,16 @@ int b43_phy_initn(struct b43_wldev *dev)/* TODO N PHY Pre Calibrate TX Gain */ target =b43_nphy_get_tx_gains (dev); } - } +if (!b43_nphy_cal_tx_iq_lo (dev, target, true, false)) +if (b43_nphy_cal_rx_iq (dev, target,2 ,0 ) ==0 ) +b43_nphy_save_cal (dev); + }else if (nphy->mphase_cal_phase_id ==0 ) + ;/* N PHY Periodic Calibration with arg 3 */ + }else { +b43_nphy_restore_cal (dev); } } -if (!b43_nphy_cal_tx_iq_lo (dev, target, true, false)) { -if (b43_nphy_cal_rx_iq (dev, target,2 ,0 ) ==0 ) -b43_nphy_save_cal (dev); -else if (nphy->mphase_cal_phase_id ==0 ) - ;/* N PHY Periodic Calibration with argument 3 */ - }else { -b43_nphy_restore_cal (dev); - } -b43_nphy_tx_pwr_ctrl_coef_setup (dev);b43_nphy_tx_power_ctrl (dev, tx_pwr_state);b43_phy_write (dev,B43_NPHY_TXMACIF_HOLDOFF ,0x0015 );
Signature · 1 line
1.6.3.3