All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@gmail.com>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, Jiri Slaby <jirislaby@gmail.com>,
	Nick Kossifidis <mickflemm@gmail.com>
Subject: [PATCH 1/6] ath5k: Ported new initval changes from OpenBSD to ath5k
Date: Fri, 5 Oct 2007 21:16:57 -0400	[thread overview]
Message-ID: <20071006011657.GA24862@pogo> (raw)
In-Reply-To: <20071006010449.GA25022@pogo>

Ported new initval changes from OpenBSD to ath5k to ar5212_ini[] and
ar5212_ini_mode[]. This also adds an O(log(N)) bitswap for one byte
on ath5k_hw_bitswap(), thanks to Tom from OpenBSD. These changes
have been tested.

Changes-licensed-under: ISC
Signed-off-by: Luis R. Rodriguez <mcgrof@gmail.com>
---
 drivers/net/wireless/ath5k/hw.h       |   14 +++++++++---
 drivers/net/wireless/ath5k/initvals.c |   34 +++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath5k/hw.h b/drivers/net/wireless/ath5k/hw.h
index d48754c..24da1c8 100644
--- a/drivers/net/wireless/ath5k/hw.h
+++ b/drivers/net/wireless/ath5k/hw.h
@@ -427,13 +427,11 @@ struct ath5k_hw_tx_status {
 #define AR5K_INIT_CFG	0x00000000
 #endif
 
-/*#define AR5K_REG_READ(_reg)	ath5k_hw_reg_read(hal, _reg)
-
-#define AR5K_REG_WRITE(_reg, _val)	ath5k_hw_reg_write(hal, _val, _reg)*/
-
+/* Shift and then mask */
 #define AR5K_REG_SM(_val, _flags)					\
 	(((_val) << _flags##_S) & (_flags))
 
+/* Mask and then shift */
 #define AR5K_REG_MS(_val, _flags)					\
 	(((_val) & (_flags)) >> _flags##_S)
 
@@ -579,6 +577,14 @@ static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
 {
 	u32 retval = 0, bit, i;
 
+	/* O(log(N)) bitswap for one byte */
+	if (bits == 8) {
+		val = ((val & 0xF0) >>  4) | ((val & 0x0F) <<  4);
+		val = ((val & 0xCC) >>  2) | ((val & 0x33) <<  2);
+		val = ((val & 0xAA) >>  1) | ((val & 0x55) <<  1);
+		return val;
+	}
+
 	for (i = 0; i < bits; i++) {
 		bit = (val >> i) & 1;
 		retval = (retval << 1) | bit;
diff --git a/drivers/net/wireless/ath5k/initvals.c b/drivers/net/wireless/ath5k/initvals.c
index 11aeacc..1f96a86 100644
--- a/drivers/net/wireless/ath5k/initvals.c
+++ b/drivers/net/wireless/ath5k/initvals.c
@@ -710,6 +710,12 @@ static const struct ath5k_ini ar5212_ini[] = {
 	{ AR5K_PHY(657), 0x00007bb6 },
 	{ AR5K_PHY(658), 0x0fff3ffc },
 	{ AR5K_PHY_CCKTXCTL, 0x00000000 },
+	{ AR5K_BB_GAIN(0),  0x00000000 },	/* 0x9b00 */
+	{ AR5K_BB_GAIN(10), 0x0000000c },	/* 0x9b28 */
+	{ AR5K_BB_GAIN(14), 0x00000012 },	/* 0x9b38 */
+	{ AR5K_BB_GAIN(25), 0x00000021 },	/* 0x9b64 */
+	{ AR5K_BB_GAIN(35), 0x0000002d },	/* 0x9b8c */
+	{ AR5K_BB_GAIN(39), 0x00000033 },	/* 0x9b9c */
 };
 
 /* Initial mode-specific settings for AR5212 */
@@ -747,6 +753,34 @@ static const struct ath5k_ini_mode ar5212_ini_mode[] = {
 		{ 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 } },
 	{ AR5K_TIME_OUT,
 		{ 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 } },
+	{ 0x9804,
+		{ 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 } },
+	{ 0x9820,
+		{ 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 } },
+	{ 0x9834,
+		{ 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
+	{ 0x9838,
+		{ 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
+	{ 0x9844,
+		{ 0x1372161c, 0x13721c25, 0x13721728, 0x137216a2, 0x13721c25 } },
+	{ 0x9850,
+		{ 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
+	{ 0x9858,
+		{ 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e } },
+	{ 0x9860,
+		{ 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d10, 0x00009d10 } },
+	{ 0x9864,
+		{ 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
+	{ 0x9868,
+		{ 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 } },
+	{ 0x9918,
+		{ 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 } },
+	{ 0x9924,
+		{ 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 } },
+	{ 0xa180,
+		{ 0x10ff14ff, 0x10ff14ff, 0x10ff10ff, 0x10ff19ff, 0x10ff19ff } },
+	{ 0xa230,
+		{ 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 } },
 };
 
 /* Initial mode-specific settings for AR5212 + RF5111 */
-- 
1.5.2.5


  reply	other threads:[~2007-10-06  1:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-06  1:04 [PATCH 0/6] ath5k: initvals, radar, promiscuous bug and multicast Luis R. Rodriguez
2007-10-06  1:16 ` Luis R. Rodriguez [this message]
2007-10-06  1:18   ` [PATCH 2/6] ath5k: Enable radar detection Luis R. Rodriguez
2007-10-06  1:19     ` [PATCH 3/6] ath5k: Fix a bug which pushed us to enable the promiscuous filter Luis R. Rodriguez
2007-10-06  1:19       ` [PATCH 4/6] ath5k: Add proper support for multicast Luis R. Rodriguez
2007-10-06  1:20         ` [PATCH 5/6] ath5k: Add documenation for atheros bssid_mask Luis R. Rodriguez
2007-10-06  1:20           ` [PATCH 6/6] ath5k: Do not let the driver through for not yet supported radios Luis R. Rodriguez
2007-10-07 10:13             ` Nick Kossifidis
2007-10-08 20:48               ` Luis R. Rodriguez
2007-10-09  2:37                 ` Nick Kossifidis
2007-10-09  7:02                   ` Holger Schurig
2007-10-09  8:17                     ` Nick Kossifidis
2007-10-09 20:05           ` [PATCH 5/6] ath5k: Add documenation for atheros bssid_mask Johannes Berg
2007-10-09 20:01         ` [PATCH 4/6] ath5k: Add proper support for multicast Johannes Berg
2007-10-10 18:11           ` Luis R. Rodriguez
2007-10-07  9:56     ` [PATCH 2/6] ath5k: Enable radar detection Nick Kossifidis
2007-10-07 10:28       ` Nick Kossifidis
2007-10-08 20:34         ` Luis R. Rodriguez
2007-10-08 21:18           ` Michael Taylor
2007-10-09  7:05             ` Holger Schurig
2007-10-09  9:34               ` Johannes Berg
2007-10-09 15:59                 ` Luis R. Rodriguez
2007-10-07  9:49   ` [PATCH 1/6] ath5k: Ported new initval changes from OpenBSD to ath5k Nick Kossifidis
2007-10-08 20:38     ` Luis R. Rodriguez
2007-10-09  2:31       ` Nick Kossifidis
2007-10-09  7:17         ` Jiri Slaby
2007-10-09  8:15           ` Nick Kossifidis
2007-10-06  1:23 ` [PATCH 0/6] ath5k: initvals, radar, promiscuous bug and multicast Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071006011657.GA24862@pogo \
    --to=mcgrof@gmail.com \
    --cc=jirislaby@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mickflemm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.