linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/7] ath5k: Read Spur channels from EEPROM
@ 2009-04-16  0:24 Nick Kossifidis
  2009-04-16  0:25 ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Kossifidis @ 2009-04-16  0:24 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless, linville; +Cc: jirislaby, mcgrof, me, nbd

 *Read Spur channel information from EEPROM and use default channels for RF5413 compatible chips that don't have this info on EEPROM.

 Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

---
 drivers/net/wireless/ath/ath5k/eeprom.c |   37 ++++++++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath5k/eeprom.h |   20 ++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
index c0fb3b0..d204546 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -1694,9 +1694,40 @@ ath5k_eeprom_read_ctl_info(struct ath5k_hw *ah)
 	return 0;
 }
 
+static int
+ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah)
+{
+	struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
+	u32 offset;
+	u16 val;
+	int ret = 0, i;
+
+	offset = AR5K_EEPROM_CTL(ee->ee_version) +
+				AR5K_EEPROM_N_CTLS(ee->ee_version);
+
+	if (ee->ee_version < AR5K_EEPROM_VERSION_5_3) {
+		/* No spur info for 5GHz */
+		ee->ee_spur_chans[0][0] = AR5K_EEPROM_NO_SPUR;
+		/* 2 channels for 2GHz (2464/2420) */
+		ee->ee_spur_chans[0][1] = AR5K_EEPROM_5413_SPUR_CHAN_1;
+		ee->ee_spur_chans[1][1] = AR5K_EEPROM_5413_SPUR_CHAN_2;
+		ee->ee_spur_chans[2][1] = AR5K_EEPROM_NO_SPUR;
+	} else if (ee->ee_version >= AR5K_EEPROM_VERSION_5_3) {
+		for (i = 0; i < AR5K_EEPROM_N_SPUR_CHANS; i++) {
+			AR5K_EEPROM_READ(offset, val);
+			ee->ee_spur_chans[i][0] = val;
+			AR5K_EEPROM_READ(offset + AR5K_EEPROM_N_SPUR_CHANS,
+									val);
+			ee->ee_spur_chans[i][1] = val;
+			offset++;
+		}
+	}
+
+	return ret;
+}
 
 /*
- * Initialize eeprom power tables
+ * Initialize eeprom data structure
  */
 int
 ath5k_eeprom_init(struct ath5k_hw *ah)
@@ -1719,6 +1750,10 @@ ath5k_eeprom_init(struct ath5k_hw *ah)
 	if (err < 0)
 		return err;
 
+	err = ath5k_eeprom_read_spur_chans(ah);
+	if (err < 0)
+		return err;
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h
index b0c0606..df9ffa0 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.h
+++ b/drivers/net/wireless/ath/ath5k/eeprom.h
@@ -211,6 +211,23 @@
 #define AR5K_EEPROM_I_GAIN		10
 #define AR5K_EEPROM_CCK_OFDM_DELTA	15
 #define AR5K_EEPROM_N_IQ_CAL		2
+/* 5GHz/2GHz */
+enum ath5k_eeprom_freq_bands{
+	AR5K_EEPROM_BAND_5GHZ = 0,
+	AR5K_EEPROM_BAND_2GHZ = 1,
+	AR5K_EEPROM_N_FREQ_BANDS,
+};
+/* Spur chans per freq band */
+#define	AR5K_EEPROM_N_SPUR_CHANS	5
+/* fbin value for chan 2464 x2 */
+#define	AR5K_EEPROM_5413_SPUR_CHAN_1	1640
+/* fbin value for chan 2420 x2 */
+#define	AR5K_EEPROM_5413_SPUR_CHAN_2	1200
+#define	AR5K_EEPROM_SPUR_CHAN_MASK	0x3FFF
+#define	AR5K_EEPROM_NO_SPUR		0x8000
+#define	AR5K_SPUR_CHAN_WIDTH			87
+#define	AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz	3125
+#define	AR5K_SPUR_SYMBOL_WIDTH_TURBO_100Hz	6250
 
 #define AR5K_EEPROM_READ(_o, _v) do {			\
 	ret = ath5k_hw_eeprom_read(ah, (_o), &(_v));	\
@@ -436,6 +453,9 @@ struct ath5k_eeprom_info {
 	s8	ee_pga_desired_size_turbo[AR5K_EEPROM_N_MODES];
 	s8	ee_pd_gain_overlap;
 
+	/* Spur mitigation data (fbin values for spur channels) */
+	u16	ee_spur_chans[AR5K_EEPROM_N_SPUR_CHANS][AR5K_EEPROM_N_FREQ_BANDS];
+
 	u32	ee_antenna[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX];
 };
 

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

* Re: [PATCH 2/7] ath5k: Read Spur channels from EEPROM
  2009-04-16  0:24 [PATCH 2/7] ath5k: Read Spur channels from EEPROM Nick Kossifidis
@ 2009-04-16  0:25 ` Johannes Berg
  2009-04-16  0:51   ` Nick Kossifidis
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2009-04-16  0:25 UTC (permalink / raw)
  To: Nick Kossifidis
  Cc: ath5k-devel, linux-wireless, linville, jirislaby, mcgrof, me, nbd

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

On Thu, 2009-04-16 at 03:24 +0300, Nick Kossifidis wrote:
> *Read Spur channel information from EEPROM and use default channels for RF5413 compatible chips that don't have this info on EEPROM.

I think you should break the changelog at fewer columns than that.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 2/7] ath5k: Read Spur channels from EEPROM
  2009-04-16  0:25 ` Johannes Berg
@ 2009-04-16  0:51   ` Nick Kossifidis
  2009-04-16  1:04     ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Kossifidis @ 2009-04-16  0:51 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Nick Kossifidis, ath5k-devel, linux-wireless, linville, jirislaby,
	mcgrof, me, nbd

2009/4/16 Johannes Berg <johannes@sipsolutions.net>:
> On Thu, 2009-04-16 at 03:24 +0300, Nick Kossifidis wrote:
>> *Read Spur channel information from EEPROM and use default channels for RF5413 compatible chips that don't have this info on EEPROM.
>
> I think you should break the changelog at fewer columns than that.
>
> johannes
>

ACK, are 80 cols ok ?


-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

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

* Re: [PATCH 2/7] ath5k: Read Spur channels from EEPROM
  2009-04-16  0:51   ` Nick Kossifidis
@ 2009-04-16  1:04     ` Johannes Berg
  2009-04-16  6:14       ` Jiri Slaby
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2009-04-16  1:04 UTC (permalink / raw)
  To: Nick Kossifidis
  Cc: Nick Kossifidis, ath5k-devel, linux-wireless, linville, jirislaby,
	mcgrof, me, nbd

[-- Attachment #1: Type: text/plain, Size: 656 bytes --]

On Thu, 2009-04-16 at 03:51 +0300, Nick Kossifidis wrote:
> 2009/4/16 Johannes Berg <johannes@sipsolutions.net>:
> > On Thu, 2009-04-16 at 03:24 +0300, Nick Kossifidis wrote:
> >> *Read Spur channel information from EEPROM and use default channels for RF5413 compatible chips that don't have this info on EEPROM.
> >
> > I think you should break the changelog at fewer columns than that.
> >
> > johannes
> >
> 
> ACK, are 80 cols ok ?

I don't know if there's a standard on that, I tend to use around 60-70,
but 80 seems good too. It's not just the "doesn't fit terminal" argument
anyway, it's much easier to read if it's less.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 2/7] ath5k: Read Spur channels from EEPROM
  2009-04-16  1:04     ` Johannes Berg
@ 2009-04-16  6:14       ` Jiri Slaby
  2009-04-16  6:16         ` Kalle Valo
  0 siblings, 1 reply; 7+ messages in thread
From: Jiri Slaby @ 2009-04-16  6:14 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Nick Kossifidis, Nick Kossifidis, ath5k-devel, linux-wireless,
	linville, mcgrof, me, nbd

On 04/16/2009 03:04 AM, Johannes Berg wrote:
> On Thu, 2009-04-16 at 03:51 +0300, Nick Kossifidis wrote:
>> ACK, are 80 cols ok ?
> 
> I don't know if there's a standard on that, I tend to use around 60-70,
> but 80 seems good too. It's not just the "doesn't fit terminal" argument
> anyway, it's much easier to read if it's less.

When one uses git log, it gets moved few (4) columns to the right. So
something little less than 76 is usually preferred :).

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

* Re: [PATCH 2/7] ath5k: Read Spur channels from EEPROM
  2009-04-16  6:14       ` Jiri Slaby
@ 2009-04-16  6:16         ` Kalle Valo
  2009-04-20 18:25           ` John W. Linville
  0 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2009-04-16  6:16 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Johannes Berg, Nick Kossifidis, Nick Kossifidis, ath5k-devel,
	linux-wireless, linville, mcgrof, me, nbd

Jiri Slaby <jirislaby@gmail.com> writes:

> On 04/16/2009 03:04 AM, Johannes Berg wrote:
>> On Thu, 2009-04-16 at 03:51 +0300, Nick Kossifidis wrote:
>>> ACK, are 80 cols ok ?
>> 
>> I don't know if there's a standard on that, I tend to use around 60-70,
>> but 80 seems good too. It's not just the "doesn't fit terminal" argument
>> anyway, it's much easier to read if it's less.
>
> When one uses git log, it gets moved few (4) columns to the right. So
> something little less than 76 is usually preferred :).

I think in usenet 72 characters was the recommended width, right? That
way quoting was also easier.

-- 
Kalle Valo

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

* Re: [PATCH 2/7] ath5k: Read Spur channels from EEPROM
  2009-04-16  6:16         ` Kalle Valo
@ 2009-04-20 18:25           ` John W. Linville
  0 siblings, 0 replies; 7+ messages in thread
From: John W. Linville @ 2009-04-20 18:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Jiri Slaby, Johannes Berg, Nick Kossifidis, Nick Kossifidis,
	ath5k-devel, linux-wireless, mcgrof, me, nbd

On Thu, Apr 16, 2009 at 09:16:47AM +0300, Kalle Valo wrote:
> Jiri Slaby <jirislaby@gmail.com> writes:
> 
> > On 04/16/2009 03:04 AM, Johannes Berg wrote:
> >> On Thu, 2009-04-16 at 03:51 +0300, Nick Kossifidis wrote:
> >>> ACK, are 80 cols ok ?
> >> 
> >> I don't know if there's a standard on that, I tend to use around 60-70,
> >> but 80 seems good too. It's not just the "doesn't fit terminal" argument
> >> anyway, it's much easier to read if it's less.
> >
> > When one uses git log, it gets moved few (4) columns to the right. So
> > something little less than 76 is usually preferred :).
> 
> I think in usenet 72 characters was the recommended width, right? That
> way quoting was also easier.

72 is my vote...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] 7+ messages in thread

end of thread, other threads:[~2009-04-20 18:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-16  0:24 [PATCH 2/7] ath5k: Read Spur channels from EEPROM Nick Kossifidis
2009-04-16  0:25 ` Johannes Berg
2009-04-16  0:51   ` Nick Kossifidis
2009-04-16  1:04     ` Johannes Berg
2009-04-16  6:14       ` Jiri Slaby
2009-04-16  6:16         ` Kalle Valo
2009-04-20 18:25           ` 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).