linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k_hw: fix more bitfield related endian issues
@ 2010-11-20 19:22 Felix Fietkau
  2010-11-22 20:15 ` John W. Linville
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Fietkau @ 2010-11-20 19:22 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, lrodriguez

A few LNA control related flags were also specified as a bitfields, however
for some strange reason they were written in big-endian order this time.
Fix this by using flags instead.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kenrel.org
---
 drivers/net/wireless/ath/ath9k/eeprom.h     |   14 ++++++++++----
 drivers/net/wireless/ath/ath9k/eeprom_def.c |   11 ++++++-----
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 5766ce9..8a644fc 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -236,6 +236,15 @@
 #define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f)
 #define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03)
 
+#define LNA_CTL_BUF_MODE	BIT(0)
+#define LNA_CTL_ISEL_LO		BIT(1)
+#define LNA_CTL_ISEL_HI		BIT(2)
+#define LNA_CTL_BUF_IN		BIT(3)
+#define LNA_CTL_FEM_BAND	BIT(4)
+#define LNA_CTL_LOCAL_BIAS	BIT(5)
+#define LNA_CTL_FORCE_XPA	BIT(6)
+#define LNA_CTL_USE_ANT1	BIT(7)
+
 enum eeprom_param {
 	EEP_NFTHRESH_5,
 	EEP_NFTHRESH_2,
@@ -381,10 +390,7 @@ struct modal_eep_header {
 	u8 xatten2Margin[AR5416_MAX_CHAINS];
 	u8 ob_ch1;
 	u8 db_ch1;
-	u8 useAnt1:1,
-	    force_xpaon:1,
-	    local_bias:1,
-	    femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1;
+	u8 lna_ctl;
 	u8 miscBits;
 	u16 xpaBiasLvlFreq[3];
 	u8 futureModal[6];
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index a819ddc..b1b48ef 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -451,9 +451,10 @@ static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
 		ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
 					  AR_AN_TOP2_LOCALBIAS,
 					  AR_AN_TOP2_LOCALBIAS_S,
-					  pModal->local_bias);
+					  !!(pModal->lna_ctl &
+					     LNA_CTL_LOCAL_BIAS));
 		REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
-			      pModal->force_xpaon);
+			      !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA));
 	}
 
 	REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
@@ -1432,9 +1433,9 @@ static u8 ath9k_hw_def_get_num_ant_config(struct ath_hw *ah,
 
 	num_ant_config = 1;
 
-	if (pBase->version >= 0x0E0D)
-		if (pModal->useAnt1)
-			num_ant_config += 1;
+	if (pBase->version >= 0x0E0D &&
+	    (pModal->lna_ctl & LNA_CTL_USE_ANT1))
+		num_ant_config += 1;
 
 	return num_ant_config;
 }
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath9k_hw: fix more bitfield related endian issues
  2010-11-20 19:22 [PATCH] ath9k_hw: fix more bitfield related endian issues Felix Fietkau
@ 2010-11-22 20:15 ` John W. Linville
  2010-11-22 21:06   ` Felix Fietkau
  0 siblings, 1 reply; 4+ messages in thread
From: John W. Linville @ 2010-11-22 20:15 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, lrodriguez

On Sat, Nov 20, 2010 at 08:22:50PM +0100, Felix Fietkau wrote:
> A few LNA control related flags were also specified as a bitfields, however
> for some strange reason they were written in big-endian order this time.
> Fix this by using flags instead.
> 
> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
> Cc: stable@kenrel.org

Why does this merit stable@kernel.org (misspelled, BTW) inclusion?

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath9k_hw: fix more bitfield related endian issues
  2010-11-22 20:15 ` John W. Linville
@ 2010-11-22 21:06   ` Felix Fietkau
  2010-11-29 19:51     ` John W. Linville
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Fietkau @ 2010-11-22 21:06 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, lrodriguez

On 2010-11-22 9:15 PM, John W. Linville wrote:
> On Sat, Nov 20, 2010 at 08:22:50PM +0100, Felix Fietkau wrote:
>> A few LNA control related flags were also specified as a bitfields, however
>> for some strange reason they were written in big-endian order this time.
>> Fix this by using flags instead.
>> 
>> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
>> Cc: stable@kenrel.org
Oops.

> Why does this merit stable@kernel.org (misspelled, BTW) inclusion?
Trivial bug that can easily mess up baseband settings in some cases. Not
sure if it could also mess with tx power.

- Felix

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath9k_hw: fix more bitfield related endian issues
  2010-11-22 21:06   ` Felix Fietkau
@ 2010-11-29 19:51     ` John W. Linville
  0 siblings, 0 replies; 4+ messages in thread
From: John W. Linville @ 2010-11-29 19:51 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, lrodriguez

On Mon, Nov 22, 2010 at 10:06:59PM +0100, Felix Fietkau wrote:
> On 2010-11-22 9:15 PM, John W. Linville wrote:
> > On Sat, Nov 20, 2010 at 08:22:50PM +0100, Felix Fietkau wrote:
> >> A few LNA control related flags were also specified as a bitfields, however
> >> for some strange reason they were written in big-endian order this time.
> >> Fix this by using flags instead.
> >> 
> >> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
> >> Cc: stable@kenrel.org
> Oops.
> 
> > Why does this merit stable@kernel.org (misspelled, BTW) inclusion?
> Trivial bug that can easily mess up baseband settings in some cases. Not
> sure if it could also mess with tx power.

See my reply to the related bug.  Should this go to 2.6.37?

Thanks,

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-29 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-20 19:22 [PATCH] ath9k_hw: fix more bitfield related endian issues Felix Fietkau
2010-11-22 20:15 ` John W. Linville
2010-11-22 21:06   ` Felix Fietkau
2010-11-29 19:51     ` John W. Linville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).