diff mbox

[18/18] ath9k: use REG_RMW and rmw buffer in ath9k_hw_def_set_gain

Message ID 1426855138-6121-19-git-send-email-linux@rempel-privat.de (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Oleksij Rempel March 20, 2015, 12:38 p.m. UTC
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/eeprom_def.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Comments

Felix Fietkau March 20, 2015, 1:01 p.m. UTC | #1
On 2015-03-20 13:38, Oleksij Rempel wrote:
> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
> ---
>  drivers/net/wireless/ath/ath9k/eeprom_def.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
> index 0980590..4b43539 100644
> --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
> +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
> @@ -466,6 +466,7 @@ static void ath9k_hw_def_set_gain(struct ath_hw *ah,
>  				  struct ar5416_eeprom_def *eep,
>  				  u8 txRxAttenLocal, int regChainOffset, int i)
>  {
> +	ENABLE_REG_RMW_BUFFER(ah);
>  	if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
>  		txRxAttenLocal = pModal->txRxAttenCh[i];
>  
> @@ -483,16 +484,16 @@ static void ath9k_hw_def_set_gain(struct ath_hw *ah,
>  			      AR_PHY_GAIN_2GHZ_XATTEN2_DB,
>  			      pModal->xatten2Db[i]);
>  		} else {
> -			REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
> +			REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
>  			  (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
>  			   ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
>  			  | SM(pModal-> bswMargin[i],
> -			       AR_PHY_GAIN_2GHZ_BSW_MARGIN));
> -			REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
> +			       AR_PHY_GAIN_2GHZ_BSW_MARGIN), 0);
> +			REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
>  			  (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
>  			   ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
>  			  | SM(pModal->bswAtten[i],
> -			       AR_PHY_GAIN_2GHZ_BSW_ATTEN));
> +			       AR_PHY_GAIN_2GHZ_BSW_ATTEN), 0);
>  		}
>  	}
>  
> @@ -504,17 +505,19 @@ static void ath9k_hw_def_set_gain(struct ath_hw *ah,
>  		      AR_PHY_RXGAIN + regChainOffset,
>  		      AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
>  	} else {
> -		REG_WRITE(ah,
> +		REG_RMW(ah,
>  			  AR_PHY_RXGAIN + regChainOffset,
>  			  (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
>  			   ~AR_PHY_RXGAIN_TXRX_ATTEN)
> -			  | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
> -		REG_WRITE(ah,
> +			  | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN), 0);
> +		REG_RMW(ah,
>  			  AR_PHY_GAIN_2GHZ + regChainOffset,
>  			  (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
>  			   ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
> -			  SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
> +			  SM(pModal->rxTxMarginCh[i],
> +			  AR_PHY_GAIN_2GHZ_RXTX_MARGIN), 0);
>  	}
> +	REG_RMW_BUFFER_FLUSH(ah);
Same in those chunks as in the other patch, do proper conversion to
REG_RMW by eliminating the REG_READ.

- Felix
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index 0980590..4b43539 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -466,6 +466,7 @@  static void ath9k_hw_def_set_gain(struct ath_hw *ah,
 				  struct ar5416_eeprom_def *eep,
 				  u8 txRxAttenLocal, int regChainOffset, int i)
 {
+	ENABLE_REG_RMW_BUFFER(ah);
 	if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
 		txRxAttenLocal = pModal->txRxAttenCh[i];
 
@@ -483,16 +484,16 @@  static void ath9k_hw_def_set_gain(struct ath_hw *ah,
 			      AR_PHY_GAIN_2GHZ_XATTEN2_DB,
 			      pModal->xatten2Db[i]);
 		} else {
-			REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
+			REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
 			  (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
 			   ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
 			  | SM(pModal-> bswMargin[i],
-			       AR_PHY_GAIN_2GHZ_BSW_MARGIN));
-			REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
+			       AR_PHY_GAIN_2GHZ_BSW_MARGIN), 0);
+			REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
 			  (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
 			   ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
 			  | SM(pModal->bswAtten[i],
-			       AR_PHY_GAIN_2GHZ_BSW_ATTEN));
+			       AR_PHY_GAIN_2GHZ_BSW_ATTEN), 0);
 		}
 	}
 
@@ -504,17 +505,19 @@  static void ath9k_hw_def_set_gain(struct ath_hw *ah,
 		      AR_PHY_RXGAIN + regChainOffset,
 		      AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
 	} else {
-		REG_WRITE(ah,
+		REG_RMW(ah,
 			  AR_PHY_RXGAIN + regChainOffset,
 			  (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
 			   ~AR_PHY_RXGAIN_TXRX_ATTEN)
-			  | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
-		REG_WRITE(ah,
+			  | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN), 0);
+		REG_RMW(ah,
 			  AR_PHY_GAIN_2GHZ + regChainOffset,
 			  (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
 			   ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
-			  SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
+			  SM(pModal->rxTxMarginCh[i],
+			  AR_PHY_GAIN_2GHZ_RXTX_MARGIN), 0);
 	}
+	REG_RMW_BUFFER_FLUSH(ah);
 }
 
 static void ath9k_hw_def_set_board_values(struct ath_hw *ah,