All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: John Linville <linville@tuxdriver.com>
Cc: "linux-wireless" <linux-wireless@vger.kernel.org>,
	rt2400-devel@lists.sourceforge.net
Subject: [PATCH 9/15] rt2x00: Split EEPROM_NIC_TX_RX_FIXED
Date: Sat, 20 Dec 2008 10:57:47 +0100	[thread overview]
Message-ID: <200812201057.47712.IvDoorn@gmail.com> (raw)
In-Reply-To: <200812201057.02583.IvDoorn@gmail.com>

The 2 bits in EEPROM_NIC_TX_RX_FIXED each influence
a different antenna. We might as well split the
definition and directly read the correct bit.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
 drivers/net/wireless/rt2x00/rt61pci.c |   25 ++++++-------------------
 drivers/net/wireless/rt2x00/rt61pci.h |    3 ++-
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 2b72010..875acb3 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2232,7 +2232,8 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
 	if (word == 0xffff) {
 		rt2x00_set_field16(&word, EEPROM_NIC_ENABLE_DIVERSITY, 0);
 		rt2x00_set_field16(&word, EEPROM_NIC_TX_DIVERSITY, 0);
-		rt2x00_set_field16(&word, EEPROM_NIC_TX_RX_FIXED, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_RX_FIXED, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_TX_FIXED, 0);
 		rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
 		rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
 		rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
@@ -2376,24 +2377,10 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	 */
 	if (rt2x00_rf(&rt2x00dev->chip, RF2529) &&
 	    !test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) {
-		switch (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_RX_FIXED)) {
-		case 0:
-			rt2x00dev->default_ant.tx = ANTENNA_B;
-			rt2x00dev->default_ant.rx = ANTENNA_A;
-			break;
-		case 1:
-			rt2x00dev->default_ant.tx = ANTENNA_B;
-			rt2x00dev->default_ant.rx = ANTENNA_B;
-			break;
-		case 2:
-			rt2x00dev->default_ant.tx = ANTENNA_A;
-			rt2x00dev->default_ant.rx = ANTENNA_A;
-			break;
-		case 3:
-			rt2x00dev->default_ant.tx = ANTENNA_A;
-			rt2x00dev->default_ant.rx = ANTENNA_B;
-			break;
-		}
+		rt2x00dev->default_ant.rx =
+		    ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED);
+		rt2x00dev->default_ant.tx =
+		    ANTENNA_B - rt2x00_get_field16(eeprom, EEPROM_NIC_TX_FIXED);
 
 		if (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_DIVERSITY))
 			rt2x00dev->default_ant.tx = ANTENNA_SW_DIVERSITY;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.h b/drivers/net/wireless/rt2x00/rt61pci.h
index 86590c6..cd86def 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.h
+++ b/drivers/net/wireless/rt2x00/rt61pci.h
@@ -1190,7 +1190,8 @@ struct hw_pairwise_ta_entry {
 #define EEPROM_NIC			0x0011
 #define EEPROM_NIC_ENABLE_DIVERSITY	FIELD16(0x0001)
 #define EEPROM_NIC_TX_DIVERSITY		FIELD16(0x0002)
-#define EEPROM_NIC_TX_RX_FIXED		FIELD16(0x000c)
+#define EEPROM_NIC_RX_FIXED		FIELD16(0x0004)
+#define EEPROM_NIC_TX_FIXED		FIELD16(0x0008)
 #define EEPROM_NIC_EXTERNAL_LNA_BG	FIELD16(0x0010)
 #define EEPROM_NIC_CARDBUS_ACCEL	FIELD16(0x0020)
 #define EEPROM_NIC_EXTERNAL_LNA_A	FIELD16(0x0040)
-- 
1.5.6.1


  reply	other threads:[~2008-12-20 10:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-20  9:52 Please pull 'upstream' branch of rt2x00 Ivo van Doorn
2008-12-20  9:52 ` [PATCH 1/15] rt2x00: Implement Powersaving Ivo van Doorn
2008-12-20  9:53   ` [PATCH 2/15] rt2x00: Move link tuning into seperate file Ivo van Doorn
2008-12-20  9:54     ` [PATCH 3/15] rt2x00: Reduce calls to bbp_read() Ivo van Doorn
2008-12-20  9:54       ` [PATCH 4/15] rt2x00: Restrict interface between rt2x00link and drivers Ivo van Doorn
2008-12-20  9:55         ` [PATCH 5/15] rt2x00: Add mesh support Ivo van Doorn
2008-12-20  9:55           ` [PATCH 6/15] rt2x00: Add RFKILL support to rt2500usb and rt73usb Ivo van Doorn
2008-12-20  9:56             ` [PATCH 7/15] rt2x00: Rename CONFIG_CRYPTO_COPY_IV Ivo van Doorn
2008-12-20  9:57               ` [PATCH 8/15] rt2x00: Implement WDS support Ivo van Doorn
2008-12-20  9:57                 ` Ivo van Doorn [this message]
2008-12-20  9:58                   ` [PATCH 10/15] rt2x00: Move code into seperate functions Ivo van Doorn
2008-12-20  9:59                     ` [PATCH 11/15] rt2x00: Remove ENTRY_TXD_OFDM_RATE Ivo van Doorn
2008-12-20  9:59                       ` [PATCH 12/15] Allow drivers to pass the noise value during rxdone Ivo van Doorn
2008-12-20  9:59                         ` [PATCH 13/15] rt2x00: Introduce RXDONE_SIGNAL_MASK mask Ivo van Doorn
2008-12-20 10:00                           ` [PATCH 14/15] rt2x00: Fix segementation fault Ivo van Doorn
2008-12-20 10:00                             ` [PATCH 15/15] rt2x00: Release rt2x00 2.3.0 Ivo van Doorn
2008-12-23 12:19                     ` [PATCH 10/15] rt2x00: Move code into seperate functions David Shwatrz
2008-12-21 10:37                 ` [PATCH 8/15] rt2x00: Implement WDS support Johannes Berg
2008-12-21 12:07                   ` Ivo van Doorn
2008-12-21 17:53   ` [PATCH 1/15] rt2x00: Implement Powersaving David Shwatrz
2008-12-22  7:34     ` Holger Schurig

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=200812201057.47712.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=rt2400-devel@lists.sourceforge.net \
    /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.