All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gertjan van Wingerde <gwingerde@gmail.com>
To: Ivo van Doorn <ivdoorn@gmail.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: Re: [PATCH 7/9] rt2x00: Add rt3071 support in rt2800 register initialization.
Date: Sat, 10 Apr 2010 23:30:54 +0200	[thread overview]
Message-ID: <4BC0EE0E.1050702@gmail.com> (raw)
In-Reply-To: <201004090038.44150.IvDoorn@gmail.com>

On 04/09/10 00:38, Ivo van Doorn wrote:
> On Thursday 08 April 2010, Gertjan van Wingerde wrote:
>> Add RT3071 specific register initializations to rt2x00, based on the latest
>> Ralink rt3070 vendor driver.
>>
>> With this patch my RT3071 based devices start showing a sign of life.
>>
>> Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
>> ---
>>  drivers/net/wireless/rt2x00/rt2800lib.c |  105 +++++++++++++++++++++++++++---
>>  1 files changed, 94 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index 52e2422..209fd85 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -1036,7 +1036,8 @@ EXPORT_SYMBOL_GPL(rt2800_link_stats);
>>  static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev)
>>  {
>>  	if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
>> -		if (rt2x00_rt(rt2x00dev, RT3070))
>> +		if (rt2x00_rt(rt2x00dev, RT3070) ||
>> +		    rt2x00_rt(rt2x00dev, RT3071))
>>  			return 0x1c + (2 * rt2x00dev->lna_gain);
>>  		else
>>  			return 0x2e + rt2x00dev->lna_gain;
>> @@ -1085,6 +1086,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
>>  int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
>>  {
>>  	u32 reg, reg2;
>> +	u16 eeprom;
>>  	unsigned int i;
>>  
>>  	rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
>> @@ -1202,7 +1204,20 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
>>  	rt2x00_set_field32(&reg, BKOFF_SLOT_CFG_CC_DELAY_TIME, 2);
>>  	rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg);
>>  
>> -	if (rt2x00_rt(rt2x00dev, RT3070)) {
>> +	if (rt2x00_rt(rt2x00dev, RT3071)) {
>> +		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400);
>> +		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
>> +		if (rt2x00_rev(rt2x00dev) < 0x0211) {
>> +			rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
>> +			if (rt2x00_get_field16(eeprom, EEPROM_NIC_DAC_TEST))
>> +				reg = 0x0000002c;
>> +			else
>> +				reg = 0x0000000f;
>> +		} else {
>> +			reg = 0x00000000;
>> +		}
> 
> Is these some meaning to this fields, which makes it easier to use set_field32
> with some definition to indicate how the field is named to understand what
> the value means?

Nope, I'm sorry. I have no clue here. Let's keep it as is for now, as it in the
same style as the other register writes for this register set.

> 
>> -	if (rt2x00_rt(rt2x00dev, RT3070)) {
>> +	if (rt2x00_rt(rt2x00dev, RT3071)) {
>> +		rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);
>> +		rfcsr &= ~0x0c;
>> +		rfcsr |= 0x31;
>> +		rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
>> +
>> +		rt2800_rfcsr_read(rt2x00dev, 15, &rfcsr);
>> +		rfcsr &= ~0x08;
>> +		rt2800_rfcsr_write(rt2x00dev, 15, rfcsr);
>> +
>> +		rt2800_rfcsr_read(rt2x00dev, 20, &rfcsr);
>> +		rfcsr &= ~0x08;
>> +		rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
>> +
>> +		rt2800_rfcsr_read(rt2x00dev, 21, &rfcsr);
>> +		rfcsr &= ~0x08;
>> +		rt2800_rfcsr_write(rt2x00dev, 21, rfcsr);
>> +	}
> 
> Perhaps this needs some rt2x00_set_field8() magic as well. Not sure though

OK. I'll add some for macros here for these RF CSRs. It probably won't get prettier,
as they will have generic names without a real meaning.

---
Gertjan.


  reply	other threads:[~2010-04-10 21:30 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08 21:50 [PATCH 0/9] rt2x00: Align with vendor driver and add support for rt3070/rt3071/rt3090/rt3390 Gertjan van Wingerde
2010-04-08 21:50 ` [PATCH 1/9] rt2x00: Let RF chipset decide the RF channel switch method to use in rt2800 Gertjan van Wingerde
2010-04-08 22:17   ` Ivo van Doorn
2010-04-08 21:50 ` [PATCH 2/9] rt2x00: Update rt2800 register definitions towards latest definitions Gertjan van Wingerde
2010-04-08 22:17   ` Ivo van Doorn
2010-04-08 21:50 ` [PATCH 3/9] rt2x00: Align RT chipset definitions with vendor driver Gertjan van Wingerde
2010-04-08 22:28   ` Felix Fietkau
2010-04-09  5:10     ` Gertjan van Wingerde
2010-04-09  5:38       ` Gertjan van Wingerde
2010-04-09  7:42         ` Helmut Schaa
2010-04-09  5:43       ` Felix Fietkau
2010-04-09 11:32         ` Helmut Schaa
2010-04-09 11:52           ` Felix Fietkau
2010-04-09 12:23             ` Helmut Schaa
2010-04-09 12:26               ` Felix Fietkau
2010-04-09 12:30                 ` Luis Correia
2010-04-09 14:01                   ` Gabor Juhos
2010-04-09 12:32                 ` Helmut Schaa
2010-04-09 17:23                   ` Gertjan van Wingerde
2010-04-08 22:33   ` Ivo van Doorn
2010-04-08 21:50 ` [PATCH 4/9] rt2x00: Remove rt2800 version constants Gertjan van Wingerde
2010-04-08 22:32   ` Ivo van Doorn
2010-04-08 23:53     ` Julian Calaby
2010-04-09  6:54       ` Ivo Van Doorn
2010-04-09  7:00         ` Julian Calaby
2010-04-10  8:57           ` Gertjan van Wingerde
2010-04-10  9:16             ` Ivo van Doorn
2010-04-10 11:20             ` Julian Calaby
2010-04-09 21:53     ` [rt2x00-users] " Benoit PAPILLAULT
2010-04-10  8:57       ` Gertjan van Wingerde
2010-04-08 21:50 ` [PATCH 5/9] rt2x00: Align rt2800 register initialization with vendor driver Gertjan van Wingerde
2010-04-08 22:33   ` Ivo van Doorn
2010-04-10 19:14     ` Gertjan van Wingerde
2010-04-10 20:58       ` Ivo van Doorn
2010-04-08 21:50 ` [PATCH 6/9] rt2x00: Finish rt3070 support in rt2800 register initialization Gertjan van Wingerde
2010-04-08 22:33   ` Ivo van Doorn
2010-04-10 20:52     ` Gertjan van Wingerde
2010-04-08 21:50 ` [PATCH 7/9] rt2x00: Add rt3071 " Gertjan van Wingerde
2010-04-08 22:38   ` Ivo van Doorn
2010-04-10 21:30     ` Gertjan van Wingerde [this message]
2010-04-08 21:50 ` [PATCH 8/9] rt2x00: Add rt3090 " Gertjan van Wingerde
2010-04-08 22:39   ` Ivo van Doorn
2010-04-08 21:50 ` [PATCH 9/9] rt2x00: Add rt3390 " Gertjan van Wingerde
2010-04-08 22:39   ` Ivo van Doorn
2010-04-08 22:16 ` [PATCH 0/9] rt2x00: Align with vendor driver and add support for rt3070/rt3071/rt3090/rt3390 Ivo van Doorn
2010-04-10  9:01   ` Gertjan van Wingerde
2010-04-11 12:31 [PATCH v2 " Gertjan van Wingerde
2010-04-11 12:31 ` [PATCH 7/9] rt2x00: Add rt3071 support in rt2800 register initialization Gertjan van Wingerde
2010-04-11 16:57   ` Ivo van Doorn

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=4BC0EE0E.1050702@gmail.com \
    --to=gwingerde@gmail.com \
    --cc=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=users@rt2x00.serialmonkey.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.