[rt2x00-users] [RFC/RFT 4/4] rt2800: radio 3xxxx: channel switch RX/TX calibration fixes

Gertjan van Wingerde gwingerde at gmail.com
Wed Jan 25 08:55:40 AEDT 2012


On 01/24/12 15:06, Stanislaw Gruszka wrote:
> Signed-off-by: Stanislaw Gruszka <sgruszka at redhat.com>

NAK. This doesn't seem to be correct for any chipset.

The change to the RFCSR24 programming is correct, but the RFCSR31
programming seems odd here, as the Ralink driver does not program
both RF CSRs with the same value, and on RT33xx it seems that fixed
values are programmed into these RF CSRs (although this is difficult to
determine due to the flow inside the Ralink driver.

On RT30xx I'm wondering why the Ralink driver is programming RFCSR31 at
all, as it doesn't seem to be programmed with any sane value (it is
taking the value of an uninitialized stack variable.
I would argue that RFCSR31 is only to be programmed for RT33xx, and that
the Ralink RT30xx code for this is just sloppy and doing unnecessary things.

Please double-check my analysis as the Ralink code for this is not very
accessible.

> ---
>  drivers/net/wireless/rt2x00/rt2800.h    |    8 ++++++++
>  drivers/net/wireless/rt2x00/rt2800lib.c |   15 +++++++++++----
>  2 files changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
> index abf2ae5..c92fb2e 100644
> --- a/drivers/net/wireless/rt2x00/rt2800.h
> +++ b/drivers/net/wireless/rt2x00/rt2800.h
> @@ -1872,6 +1872,13 @@ struct mac_iveiv_entry {
>  #define RFCSR23_FREQ_OFFSET		FIELD8(0x7f)
>  
>  /*
> + * RFCSR 24:
> + */
> +#define RFCSR24_TX_AGC_FC		FIELD8(0x1f)
> +#define RFCSR24_TX_H20M			FIELD8(0x20)
> +#define RFCSR24_TX_CALIB		FIELD8(0x7f)
> +
> +/*
>   * RFCSR 27:
>   */
>  #define RFCSR27_R1			FIELD8(0x03)
> @@ -1892,6 +1899,7 @@ struct mac_iveiv_entry {
>   */
>  #define RFCSR31_RX_AGC_FC		FIELD8(0x1f)
>  #define RFCSR31_RX_H20M			FIELD8(0x20)
> +#define RFCSR31_RX_CALIB		FIELD8(0x7f)
>  
>  /*
>   * RFCSR 38:
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index 506d691..262584a 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -1645,7 +1645,7 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
>  					 struct rf_channel *rf,
>  					 struct channel_info *info)
>  {
> -	u8 rfcsr;
> +	u8 rfcsr, calib;
>  
>  	rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1);
>  
> @@ -1681,13 +1681,20 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
>  	rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
>  	rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
>  
> -
>  	rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr);
>  	rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
>  	rt2800_rfcsr_write(rt2x00dev, 23, rfcsr);
>  
> -	rt2800_rfcsr_write(rt2x00dev, 24,
> -			      rt2x00dev->calibration[conf_is_ht40(conf)]);
> +	calib = rt2x00dev->calibration[conf_is_ht40(conf)];
> +
> +	rt2800_rfcsr_read(rt2x00dev, 24, &rfcsr);
> +	rt2x00_set_field8(&rfcsr, RFCSR24_TX_CALIB, calib);
> +	rt2800_rfcsr_write(rt2x00dev, 24, rfcsr);
> +
> +	/* FIXME: difference for 3390 */
> +	rt2800_rfcsr_read(rt2x00dev, 31, &rfcsr);
> +	rt2x00_set_field8(&rfcsr, RFCSR31_RX_CALIB, calib);
> +	rt2800_rfcsr_write(rt2x00dev, 31, rfcsr);
>  
>  	rt2800_rfcsr_read(rt2x00dev, 7, &rfcsr);
>  	rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);


-- 
---
Gertjan




More information about the users mailing list