2013-06-22 15:42:25

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support

Gabor Juhos (3):
rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes
rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices
rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices

drivers/net/wireless/rt2x00/rt2800.h | 2 +-
drivers/net/wireless/rt2x00/rt2800lib.c | 22 ++++++++++++++++++----
2 files changed, 19 insertions(+), 5 deletions(-)

--
1.7.10



2013-06-24 13:00:07

by Helmut Schaa

[permalink] [raw]
Subject: Re: [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices

On Sat, Jun 22, 2013 at 5:42 PM, Gabor Juhos <[email protected]> wrote:
> The secondary PAs/LNAs are turned on only for 2T/2R
> devices, however these are used for 3T/3R devices as
> well. Always turn those on if the device uses more
> than one tx/rx chains.
>
> Signed-off-by: Gabor Juhos <[email protected]>
> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index 4072242..f4cd3d8 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -2678,16 +2678,16 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
>
> tx_pin = 0;
>
> - /* Turn on unused PA or LNA when not using 1T or 1R */
> - if (rt2x00dev->default_ant.tx_chain_num == 2) {
> + if (rt2x00dev->default_ant.tx_chain_num > 1) {
> + /* Turn on secondary PAs for 2T adn for 3T devices*/

Typo adn -> and.

Otherwise looks good to me.
Helmut

2013-06-24 13:02:20

by Helmut Schaa

[permalink] [raw]
Subject: Re: [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices

On Sat, Jun 22, 2013 at 5:42 PM, Gabor Juhos <[email protected]> wrote:
> Signed-off-by: Gabor Juhos <[email protected]>

Looks also good to me.

Acked-by: Helmut Schaa <[email protected]>

> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index f4cd3d8..664e9e1 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -2684,12 +2684,26 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
> rf->channel > 14);
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN,
> rf->channel <= 14);
> +
> + if (rt2x00dev->default_ant.tx_chain_num > 2) {
> + /* Turn on tertiary PAs for 3T devices */
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A2_EN,
> + rf->channel > 14);
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G2_EN,
> + rf->channel <= 14);
> + }
> }
>
> if (rt2x00dev->default_ant.rx_chain_num > 1) {
> /* Turn on secondary LNAs for 2R and for 3R devices */
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
> +
> + if (rt2x00dev->default_ant.rx_chain_num > 2) {
> + /* Turn on tertiary LNAs for 3R devices */
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1);
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1);
> + }
> }
>
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
> --
> 1.7.10
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-06-24 17:32:11

by Gertjan van Wingerde

[permalink] [raw]
Subject: Re: [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes



Sent from my iPad

On 22 jun. 2013, at 17:42, Gabor Juhos <[email protected]> wrote:

> Ralink 3T chipsets are using a different EEPROM
> layout than the others. The EEPROM on these devices
> contain more data than the others which does not fit
> into 272 byte which the rt2800 driver actually uses.
>
> The Ralink reference driver defines EEPROM_SIZE to
> 512/1024 bytes for PCI/USB devices respectively.
>
> Increase the EEPROM_SIZE constant to 512 bytes, in
> order to make room for EEPROM data of 3T devices.
>
> Signed-off-by: Gabor Juhos <[email protected]>

Acked-by: Gertjan van Wingerde <[email protected]>

> ---
> drivers/net/wireless/rt2x00/rt2800.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
> index fe43d01..d78c495 100644
> --- a/drivers/net/wireless/rt2x00/rt2800.h
> +++ b/drivers/net/wireless/rt2x00/rt2800.h
> @@ -100,7 +100,7 @@
> #define CSR_REG_BASE 0x1000
> #define CSR_REG_SIZE 0x0800
> #define EEPROM_BASE 0x0000
> -#define EEPROM_SIZE 0x0110
> +#define EEPROM_SIZE 0x0200
> #define BBP_BASE 0x0000
> #define BBP_SIZE 0x00ff
> #define RF_BASE 0x0004
> --
> 1.7.10
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-06-24 19:08:58

by Gabor Juhos

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support

> On Sat, Jun 22, 2013 at 05:42:11PM +0200, Gabor Juhos wrote:
>> Gabor Juhos (3):
>> rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes
>> rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices
>> rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
>>
>> drivers/net/wireless/rt2x00/rt2800.h | 2 +-
>> drivers/net/wireless/rt2x00/rt2800lib.c | 22 ++++++++++++++++++----
>> 2 files changed, 19 insertions(+), 5 deletions(-)
>
> This series also looks good to me.
>
> Acked-by: Stanislaw Gruszka <[email protected]>

Thanks!

> BTW: Do you plan to create more 3T/3R patches soon ?

Yes, I have more patches in the queue.

> I plan to work on adding support for RT3573 usb device (but stuck on other
> work so far unfortunetly). Anyway I don't want to duplicate efforts, so would
> like to know about your plans.

I'm testing these patches on a Linksys AE3000 device which also uses the RT3573
chip. I have an almost complete patch-set which allows me to use the device in
STA and in AP mode, however I still have to resolve a few problems.

-Gabor

2013-06-24 17:42:56

by Gertjan van Wingerde

[permalink] [raw]
Subject: Re: [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices

Hi Gabor,

Sent from my iPad

On 22 jun. 2013, at 17:42, Gabor Juhos <[email protected]> wrote:

> Signed-off-by: Gabor Juhos <[email protected]>
> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index f4cd3d8..664e9e1 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -2684,12 +2684,26 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
> rf->channel > 14);
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN,
> rf->channel <= 14);
> +
> + if (rt2x00dev->default_ant.tx_chain_num > 2) {
> + /* Turn on tertiary PAs for 3T devices */
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A2_EN,
> + rf->channel > 14);
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G2_EN,
> + rf->channel <= 14);
> + }
> }
>
> if (rt2x00dev->default_ant.rx_chain_num > 1) {
> /* Turn on secondary LNAs for 2R and for 3R devices */
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
> +
> + if (rt2x00dev->default_ant.rx_chain_num > 2) {
> + /* Turn on tertiary LNAs for 3R devices */
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1);
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1);
> + }
> }

Stylistic I would prefer the if outside of if block you included it in.
Something like:

if (tx_chain_num > 2) {
/* Turn on tertiary PAs for 3T devices */
}
if (tx_chain_num > 1) {
/* Turn on secondary PAs for 2T and for 3T devices */
}
/* Turn on primary PAs for 1T, 2T and for 3T devices */

At least to me this is easier to read.

Alternatively it could be changed to a switch statement wit fall-through cases for the number of RX/TX streams.

>
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
> --
> 1.7.10
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-06-22 15:42:21

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes

Ralink 3T chipsets are using a different EEPROM
layout than the others. The EEPROM on these devices
contain more data than the others which does not fit
into 272 byte which the rt2800 driver actually uses.

The Ralink reference driver defines EEPROM_SIZE to
512/1024 bytes for PCI/USB devices respectively.

Increase the EEPROM_SIZE constant to 512 bytes, in
order to make room for EEPROM data of 3T devices.

Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index fe43d01..d78c495 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -100,7 +100,7 @@
#define CSR_REG_BASE 0x1000
#define CSR_REG_SIZE 0x0800
#define EEPROM_BASE 0x0000
-#define EEPROM_SIZE 0x0110
+#define EEPROM_SIZE 0x0200
#define BBP_BASE 0x0000
#define BBP_SIZE 0x00ff
#define RF_BASE 0x0004
--
1.7.10


2013-06-24 15:58:06

by Stanislaw Gruszka

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support

On Sat, Jun 22, 2013 at 05:42:11PM +0200, Gabor Juhos wrote:
> Gabor Juhos (3):
> rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes
> rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices
> rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
>
> drivers/net/wireless/rt2x00/rt2800.h | 2 +-
> drivers/net/wireless/rt2x00/rt2800lib.c | 22 ++++++++++++++++++----
> 2 files changed, 19 insertions(+), 5 deletions(-)

This series also looks good to me.

Acked-by: Stanislaw Gruszka <[email protected]>

BTW: Do you plan to create more 3T/3R patches soon ? I plan to work on
adding support for RT3573 usb device (but stuck on other work so far
unfortunetly). Anyway I don't want to duplicate efforts, so would like
to know about your plans.

Thanks
Stanislaw


2013-06-25 19:16:30

by Stanislaw Gruszka

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support

On Mon, Jun 24, 2013 at 09:09:02PM +0200, Gabor Juhos wrote:
> I'm testing these patches on a Linksys AE3000 device which also uses the RT3573
> chip. I have an almost complete patch-set which allows me to use the device in
> STA and in AP mode, however I still have to resolve a few problems.

Cool, waiting for the post ... :-)

Stanislaw

2013-06-24 17:33:47

by Gertjan van Wingerde

[permalink] [raw]
Subject: Re: [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices

Hi Gabor,

Sent from my iPad

On 22 jun. 2013, at 17:42, Gabor Juhos <[email protected]> wrote:

> The secondary PAs/LNAs are turned on only for 2T/2R
> devices, however these are used for 3T/3R devices as
> well. Always turn those on if the device uses more
> than one tx/rx chains.
>
> Signed-off-by: Gabor Juhos <[email protected]openwrt.org>

Looks good to me. However, please resubmit with the typo noticed by Helmut fixed.

You can add my Acked-by in that resubmission.

> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index 4072242..f4cd3d8 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -2678,16 +2678,16 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
>
> tx_pin = 0;
>
> - /* Turn on unused PA or LNA when not using 1T or 1R */
> - if (rt2x00dev->default_ant.tx_chain_num == 2) {
> + if (rt2x00dev->default_ant.tx_chain_num > 1) {
> + /* Turn on secondary PAs for 2T adn for 3T devices*/
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN,
> rf->channel > 14);
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN,
> rf->channel <= 14);
> }
>
> - /* Turn on unused PA or LNA when not using 1T or 1R */
> - if (rt2x00dev->default_ant.rx_chain_num == 2) {
> + if (rt2x00dev->default_ant.rx_chain_num > 1) {
> + /* Turn on secondary LNAs for 2R and for 3R devices */
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
> }
> --
> 1.7.10
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-06-24 19:00:50

by Gabor Juhos

[permalink] [raw]
Subject: Re: [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices

2013.06.24. 15:00 keltez?ssel, Helmut Schaa ?rta:
> On Sat, Jun 22, 2013 at 5:42 PM, Gabor Juhos <[email protected]> wrote:
>> The secondary PAs/LNAs are turned on only for 2T/2R
>> devices, however these are used for 3T/3R devices as
>> well. Always turn those on if the device uses more
>> than one tx/rx chains.
>>
>> Signed-off-by: Gabor Juhos <[email protected]>
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index 4072242..f4cd3d8 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -2678,16 +2678,16 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
>>
>> tx_pin = 0;
>>
>> - /* Turn on unused PA or LNA when not using 1T or 1R */
>> - if (rt2x00dev->default_ant.tx_chain_num == 2) {
>> + if (rt2x00dev->default_ant.tx_chain_num > 1) {
>> + /* Turn on secondary PAs for 2T adn for 3T devices*/
>
> Typo adn -> and.
>
> Otherwise looks good to me.

Thanks, I will send a fixed version.

-Gabor

2013-06-24 19:17:55

by Gabor Juhos

[permalink] [raw]
Subject: Re: [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices

Hi Gertjan,

> Sent from my iPad
>
> On 22 jun. 2013, at 17:42, Gabor Juhos <[email protected]> wrote:
>
>> Signed-off-by: Gabor Juhos <[email protected]>
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index f4cd3d8..664e9e1 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -2684,12 +2684,26 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
>> rf->channel > 14);
>> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN,
>> rf->channel <= 14);
>> +
>> + if (rt2x00dev->default_ant.tx_chain_num > 2) {
>> + /* Turn on tertiary PAs for 3T devices */
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A2_EN,
>> + rf->channel > 14);
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G2_EN,
>> + rf->channel <= 14);
>> + }
>> }
>>
>> if (rt2x00dev->default_ant.rx_chain_num > 1) {
>> /* Turn on secondary LNAs for 2R and for 3R devices */
>> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
>> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
>> +
>> + if (rt2x00dev->default_ant.rx_chain_num > 2) {
>> + /* Turn on tertiary LNAs for 3R devices */
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1);
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1);
>> + }
>> }
>
> Stylistic I would prefer the if outside of if block you included it in.
> Something like:
>
> if (tx_chain_num > 2) {
> /* Turn on tertiary PAs for 3T devices */
> }
> if (tx_chain_num > 1) {
> /* Turn on secondary PAs for 2T and for 3T devices */
> }
> /* Turn on primary PAs for 1T, 2T and for 3T devices */

> At least to me this is easier to read.

Yes it would be more readable. The only disadvantage of separated if statements
is that both conditions will be evaluated on 1T devices.

> Alternatively it could be changed to a switch statement wit fall-through
> cases for the number of RX/TX streams.

This sounds more reasonable, I will change the code to use switch statements.

Thanks,
Gabor

2013-06-24 13:01:10

by Helmut Schaa

[permalink] [raw]
Subject: Re: [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes

On Sat, Jun 22, 2013 at 5:42 PM, Gabor Juhos <[email protected]> wrote:
> Ralink 3T chipsets are using a different EEPROM
> layout than the others. The EEPROM on these devices
> contain more data than the others which does not fit
> into 272 byte which the rt2800 driver actually uses.
>
> The Ralink reference driver defines EEPROM_SIZE to
> 512/1024 bytes for PCI/USB devices respectively.
>
> Increase the EEPROM_SIZE constant to 512 bytes, in
> order to make room for EEPROM data of 3T devices.
>
> Signed-off-by: Gabor Juhos <[email protected]>

Fine with me.
Acked-by: Helmut Schaa <[email protected]>

> ---
> drivers/net/wireless/rt2x00/rt2800.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
> index fe43d01..d78c495 100644
> --- a/drivers/net/wireless/rt2x00/rt2800.h
> +++ b/drivers/net/wireless/rt2x00/rt2800.h
> @@ -100,7 +100,7 @@
> #define CSR_REG_BASE 0x1000
> #define CSR_REG_SIZE 0x0800
> #define EEPROM_BASE 0x0000
> -#define EEPROM_SIZE 0x0110
> +#define EEPROM_SIZE 0x0200
> #define BBP_BASE 0x0000
> #define BBP_SIZE 0x00ff
> #define RF_BASE 0x0004
> --
> 1.7.10
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-06-22 15:42:22

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices

Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index f4cd3d8..664e9e1 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2684,12 +2684,26 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
rf->channel > 14);
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN,
rf->channel <= 14);
+
+ if (rt2x00dev->default_ant.tx_chain_num > 2) {
+ /* Turn on tertiary PAs for 3T devices */
+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A2_EN,
+ rf->channel > 14);
+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G2_EN,
+ rf->channel <= 14);
+ }
}

if (rt2x00dev->default_ant.rx_chain_num > 1) {
/* Turn on secondary LNAs for 2R and for 3R devices */
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
+
+ if (rt2x00dev->default_ant.rx_chain_num > 2) {
+ /* Turn on tertiary LNAs for 3R devices */
+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1);
+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1);
+ }
}

rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
--
1.7.10


2013-06-22 15:42:22

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices

The secondary PAs/LNAs are turned on only for 2T/2R
devices, however these are used for 3T/3R devices as
well. Always turn those on if the device uses more
than one tx/rx chains.

Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 4072242..f4cd3d8 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2678,16 +2678,16 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,

tx_pin = 0;

- /* Turn on unused PA or LNA when not using 1T or 1R */
- if (rt2x00dev->default_ant.tx_chain_num == 2) {
+ if (rt2x00dev->default_ant.tx_chain_num > 1) {
+ /* Turn on secondary PAs for 2T adn for 3T devices*/
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN,
rf->channel > 14);
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN,
rf->channel <= 14);
}

- /* Turn on unused PA or LNA when not using 1T or 1R */
- if (rt2x00dev->default_ant.rx_chain_num == 2) {
+ if (rt2x00dev->default_ant.rx_chain_num > 1) {
+ /* Turn on secondary LNAs for 2R and for 3R devices */
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
}
--
1.7.10