linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support
@ 2013-06-22 15:42 Gabor Juhos
  2013-06-22 15:42 ` [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Gabor Juhos @ 2013-06-22 15:42 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes
  2013-06-22 15:42 [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
@ 2013-06-22 15:42 ` Gabor Juhos
  2013-06-24 13:01   ` Helmut Schaa
  2013-06-24 17:32   ` Gertjan van Wingerde
  2013-06-22 15:42 ` [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices Gabor Juhos
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 15+ messages in thread
From: Gabor Juhos @ 2013-06-22 15:42 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos

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 <juhosg@openwrt.org>
---
 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices
  2013-06-22 15:42 [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
  2013-06-22 15:42 ` [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
@ 2013-06-22 15:42 ` Gabor Juhos
  2013-06-24 13:00   ` Helmut Schaa
  2013-06-24 17:33   ` Gertjan van Wingerde
  2013-06-22 15:42 ` [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
  2013-06-24 16:00 ` [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Stanislaw Gruszka
  3 siblings, 2 replies; 15+ messages in thread
From: Gabor Juhos @ 2013-06-22 15:42 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos

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 <juhosg@openwrt.org>
---
 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
  2013-06-22 15:42 [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
  2013-06-22 15:42 ` [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
  2013-06-22 15:42 ` [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices Gabor Juhos
@ 2013-06-22 15:42 ` Gabor Juhos
  2013-06-24 13:02   ` Helmut Schaa
  2013-06-24 17:42   ` Gertjan van Wingerde
  2013-06-24 16:00 ` [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Stanislaw Gruszka
  3 siblings, 2 replies; 15+ messages in thread
From: Gabor Juhos @ 2013-06-22 15:42 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices
  2013-06-22 15:42 ` [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices Gabor Juhos
@ 2013-06-24 13:00   ` Helmut Schaa
  2013-06-24 19:00     ` Gabor Juhos
  2013-06-24 17:33   ` Gertjan van Wingerde
  1 sibling, 1 reply; 15+ messages in thread
From: Helmut Schaa @ 2013-06-24 13:00 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: John Linville, linux-wireless, rt2x00 Users List

On Sat, Jun 22, 2013 at 5:42 PM, Gabor Juhos <juhosg@openwrt.org> 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 <juhosg@openwrt.org>
> ---
>  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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes
  2013-06-22 15:42 ` [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
@ 2013-06-24 13:01   ` Helmut Schaa
  2013-06-24 17:32   ` Gertjan van Wingerde
  1 sibling, 0 replies; 15+ messages in thread
From: Helmut Schaa @ 2013-06-24 13:01 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: John Linville, linux-wireless, rt2x00 Users List

On Sat, Jun 22, 2013 at 5:42 PM, Gabor Juhos <juhosg@openwrt.org> 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 <juhosg@openwrt.org>

Fine with me.
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>

> ---
>  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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
  2013-06-22 15:42 ` [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
@ 2013-06-24 13:02   ` Helmut Schaa
  2013-06-24 17:42   ` Gertjan van Wingerde
  1 sibling, 0 replies; 15+ messages in thread
From: Helmut Schaa @ 2013-06-24 13:02 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: John Linville, linux-wireless, rt2x00 Users List

On Sat, Jun 22, 2013 at 5:42 PM, Gabor Juhos <juhosg@openwrt.org> wrote:
> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

Looks also good to me.

Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>

> ---
>  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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support
  2013-06-22 15:42 [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
                   ` (2 preceding siblings ...)
  2013-06-22 15:42 ` [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
@ 2013-06-24 16:00 ` Stanislaw Gruszka
  2013-06-24 19:09   ` Gabor Juhos
  3 siblings, 1 reply; 15+ messages in thread
From: Stanislaw Gruszka @ 2013-06-24 16:00 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: John Linville, linux-wireless, users

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 <stf_xl@wp.pl>

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes
  2013-06-22 15:42 ` [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
  2013-06-24 13:01   ` Helmut Schaa
@ 2013-06-24 17:32   ` Gertjan van Wingerde
  1 sibling, 0 replies; 15+ messages in thread
From: Gertjan van Wingerde @ 2013-06-24 17:32 UTC (permalink / raw)
  To: Gabor Juhos
  Cc: John Linville, linux-wireless@vger.kernel.org,
	users@rt2x00.serialmonkey.com, Gabor Juhos



Sent from my iPad

On 22 jun. 2013, at 17:42, Gabor Juhos <juhosg@openwrt.org> 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 <juhosg@openwrt.org>

Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>

> ---
> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices
  2013-06-22 15:42 ` [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices Gabor Juhos
  2013-06-24 13:00   ` Helmut Schaa
@ 2013-06-24 17:33   ` Gertjan van Wingerde
  1 sibling, 0 replies; 15+ messages in thread
From: Gertjan van Wingerde @ 2013-06-24 17:33 UTC (permalink / raw)
  To: Gabor Juhos
  Cc: John Linville, linux-wireless@vger.kernel.org,
	users@rt2x00.serialmonkey.com, Gabor Juhos

Hi Gabor,

Sent from my iPad

On 22 jun. 2013, at 17:42, Gabor Juhos <juhosg@openwrt.org> 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 <juhosg@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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
  2013-06-22 15:42 ` [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
  2013-06-24 13:02   ` Helmut Schaa
@ 2013-06-24 17:42   ` Gertjan van Wingerde
  2013-06-24 19:17     ` Gabor Juhos
  1 sibling, 1 reply; 15+ messages in thread
From: Gertjan van Wingerde @ 2013-06-24 17:42 UTC (permalink / raw)
  To: Gabor Juhos
  Cc: John Linville, linux-wireless@vger.kernel.org,
	users@rt2x00.serialmonkey.com, Gabor Juhos

Hi Gabor,

Sent from my iPad

On 22 jun. 2013, at 17:42, Gabor Juhos <juhosg@openwrt.org> wrote:

> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
> ---
> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices
  2013-06-24 13:00   ` Helmut Schaa
@ 2013-06-24 19:00     ` Gabor Juhos
  0 siblings, 0 replies; 15+ messages in thread
From: Gabor Juhos @ 2013-06-24 19:00 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: John Linville, linux-wireless, rt2x00 Users List

2013.06.24. 15:00 keltezéssel, Helmut Schaa írta:
> On Sat, Jun 22, 2013 at 5:42 PM, Gabor Juhos <juhosg@openwrt.org> 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 <juhosg@openwrt.org>
>> ---
>>  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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support
  2013-06-24 16:00 ` [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Stanislaw Gruszka
@ 2013-06-24 19:09   ` Gabor Juhos
  2013-06-25 19:18     ` Stanislaw Gruszka
  0 siblings, 1 reply; 15+ messages in thread
From: Gabor Juhos @ 2013-06-24 19:09 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: John Linville, linux-wireless, users

> 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 <stf_xl@wp.pl>

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
  2013-06-24 17:42   ` Gertjan van Wingerde
@ 2013-06-24 19:17     ` Gabor Juhos
  0 siblings, 0 replies; 15+ messages in thread
From: Gabor Juhos @ 2013-06-24 19:17 UTC (permalink / raw)
  To: Gertjan van Wingerde
  Cc: John Linville, linux-wireless@vger.kernel.org,
	users@rt2x00.serialmonkey.com

Hi Gertjan,

> Sent from my iPad
> 
> On 22 jun. 2013, at 17:42, Gabor Juhos <juhosg@openwrt.org> wrote:
> 
>> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>> ---
>> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support
  2013-06-24 19:09   ` Gabor Juhos
@ 2013-06-25 19:18     ` Stanislaw Gruszka
  0 siblings, 0 replies; 15+ messages in thread
From: Stanislaw Gruszka @ 2013-06-25 19:18 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: John Linville, linux-wireless, users

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-06-25 19:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-22 15:42 [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
2013-06-22 15:42 ` [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
2013-06-24 13:01   ` Helmut Schaa
2013-06-24 17:32   ` Gertjan van Wingerde
2013-06-22 15:42 ` [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices Gabor Juhos
2013-06-24 13:00   ` Helmut Schaa
2013-06-24 19:00     ` Gabor Juhos
2013-06-24 17:33   ` Gertjan van Wingerde
2013-06-22 15:42 ` [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
2013-06-24 13:02   ` Helmut Schaa
2013-06-24 17:42   ` Gertjan van Wingerde
2013-06-24 19:17     ` Gabor Juhos
2013-06-24 16:00 ` [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Stanislaw Gruszka
2013-06-24 19:09   ` Gabor Juhos
2013-06-25 19:18     ` Stanislaw Gruszka

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).