linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: Re: [rt2x00-users] [PATCH 2/4] rt2800: radio 3xxx: program RF_R1 during channel switch
Date: Tue, 31 Jan 2012 09:14:22 +0100	[thread overview]
Message-ID: <20120131081422.GB2438@redhat.com> (raw)
In-Reply-To: <4F271479.4090303@gmail.com>

On Mon, Jan 30, 2012 at 11:06:49PM +0100, Gertjan van Wingerde wrote:
> On 01/30/12 16:17, Stanislaw Gruszka wrote:
> > +	rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);
> > +	rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0);
> > +	rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0);
> > +	if (rt2x00_rt(rt2x00dev, RT3390)) {
> > +		rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD,
> > +				  rt2x00dev->default_ant.rx_chain_num == 1);
> > +		rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD,
> > +				  rt2x00dev->default_ant.tx_chain_num == 1);
> > +	} else {
> > +		rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0);
> > +		rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0);
> > +		rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0);
> > +		rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0);
> > +
> > +		switch (rt2x00dev->default_ant.tx_chain_num) {
> > +		case 1:
> > +			rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1);
> > +			/* fall through */
> > +		case 2:
> > +			rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1);
> > +			break;
> > +		}
> > +
> > +		switch (rt2x00dev->default_ant.rx_chain_num) {
> > +		case 1:
> > +			rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1);
> > +			/* fall through */
> > +		case 2:
> > +			rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1);
> > +			break;
> > +		}
> > +	}
> > +	rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
> > +
> >  	rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr);
> >  	rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
> >  	rt2800_rfcsr_write(rt2x00dev, 23, rfcsr);
> 
> To be honest, I think that this can be simplied to a single case for
> both RT30xx and RT33xx. Just take the RT30xx branch of the added
> if-statement and it should just work fine on both chipset families.
> 
> Yes, I am aware the Ralink driver has slightly different code here, but
> that just seems to be because they work with knowledge of the
> limitations of RT33xx, which ensures that tx_chain_num and rx_chain_num
> can never be 2 on that chipset, but still handling it doesn't harm. It
> would merely result in better readable code.

Not only the code is different, but RF_R1 register value we program
is different for 30xx and 33xx when chain_num == 1 (changed by
RFCSR1_{RX2,TX2)_PD bit).

I'm not against merging these two cases and program different values
into register than Ralink driver do, but maybe in the next linux
release (counting from release of that change), so any breakage
eventually caused by that merge could be easily detected.

Stanislaw

  reply	other threads:[~2012-01-31  8:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-30 15:17 [PATCH 1/4] rt2800: radio 3xxx: reprogram only lower bits of RF_R3 Stanislaw Gruszka
2012-01-30 15:17 ` [PATCH 2/4] rt2800: radio 3xxx: program RF_R1 during channel switch Stanislaw Gruszka
2012-01-30 22:06   ` [rt2x00-users] " Gertjan van Wingerde
2012-01-31  8:14     ` Stanislaw Gruszka [this message]
2012-01-31 17:00       ` Gertjan van Wingerde
2012-02-01 15:21         ` Stanislaw Gruszka
2012-01-30 15:17 ` [PATCH 3/4] rt2800: radio 3xxx: add channel switch calibration routines Stanislaw Gruszka
2012-02-01 10:30   ` Helmut Schaa
2012-01-30 15:17 ` [PATCH 4/4] rt2800: radio 3xxxx: channel switch RX/TX calibration fixes Stanislaw Gruszka
2012-01-30 22:12   ` [rt2x00-users] " Gertjan van Wingerde
2012-02-01 15:17   ` [PATCH 5/4] rt2800: document RF_R03 register bits [7:4] Stanislaw Gruszka
2012-02-01 17:00     ` Helmut Schaa
2012-02-01 19:11     ` [rt2x00-users] " Gertjan van Wingerde
2012-02-01 10:27 ` [PATCH 1/4] rt2800: radio 3xxx: reprogram only lower bits of RF_R3 Helmut Schaa

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=20120131081422.GB2438@redhat.com \
    --to=sgruszka@redhat.com \
    --cc=gwingerde@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 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).