* [PATCH v2 0/3] rt2x00: rt2800: prepare for three-chain device support
@ 2013-06-24 20:32 Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Gabor Juhos @ 2013-06-24 20:32 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 | 44 +++++++++++++++++++++++--------
2 files changed, 34 insertions(+), 12 deletions(-)
--
1.7.10
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes
2013-06-24 20:32 [PATCH v2 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
@ 2013-06-24 20:32 ` Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
2 siblings, 0 replies; 6+ messages in thread
From: Gabor Juhos @ 2013-06-24 20:32 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>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
Changes in v2: add Acked-by tags
---
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] 6+ messages in thread
* [PATCH v2 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices
2013-06-24 20:32 [PATCH v2 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
@ 2013-06-24 20:32 ` Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
2 siblings, 0 replies; 6+ messages in thread
From: Gabor Juhos @ 2013-06-24 20:32 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>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
Changes in v2:
- fix a typo
- add Acked-by tags
---
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..b7119e3 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 and 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] 6+ messages in thread
* [PATCH v2 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
2013-06-24 20:32 [PATCH v2 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices Gabor Juhos
@ 2013-06-24 20:32 ` Gabor Juhos
2013-06-24 20:40 ` Gertjan van Wingerde
2 siblings, 1 reply; 6+ messages in thread
From: Gabor Juhos @ 2013-06-24 20:32 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, users, Gabor Juhos
The 3T/3R devices are using the tertiary PAs/LNAs
however those are never turned on. Fix the code to
turn on those on for such devices.
Also modify the code to use switch statements to
improve readability.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
Changes in v2:
- use a switch statement to improve readability as suggested
by Gertjan
- add detailed commit description
---
drivers/net/wireless/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++--------
1 file changed, 33 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index b7119e3..25f4727 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2678,29 +2678,51 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
tx_pin = 0;
- if (rt2x00dev->default_ant.tx_chain_num > 1) {
- /* Turn on secondary PAs for 2T and for 3T devices*/
+ switch (rt2x00dev->default_ant.tx_chain_num) {
+ case 3:
+ /* Turn on tertiary PAs */
+ 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);
+ /* fall-through */
+ case 2:
+ /* Turn on secondary PAs */
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);
+ /* fall-through */
+ case 1:
+ /* Turn on primary PAs */
+ if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags))
+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
+ else
+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN,
+ rf->channel <= 14);
+ break;
}
- if (rt2x00dev->default_ant.rx_chain_num > 1) {
- /* Turn on secondary LNAs for 2R and for 3R devices */
+ switch (rt2x00dev->default_ant.rx_chain_num) {
+ case 3:
+ /* Turn on tertiary LNAs */
+ 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);
+ /* fall-through */
+ case 2:
+ /* Turn on secondary LNAs */
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);
+ /* fall-through */
+ case 1:
+ /* Turn on primary LNAs */
+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
+ break;
}
- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
- if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags))
- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
- else
- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN,
- rf->channel <= 14);
rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, rf->channel > 14);
rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
--
1.7.10
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
2013-06-24 20:32 ` [PATCH v2 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
@ 2013-06-24 20:40 ` Gertjan van Wingerde
2013-06-24 20:46 ` Gabor Juhos
0 siblings, 1 reply; 6+ messages in thread
From: Gertjan van Wingerde @ 2013-06-24 20:40 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 24 jun. 2013, at 22:32, Gabor Juhos <juhosg@openwrt.org> wrote:
> The 3T/3R devices are using the tertiary PAs/LNAs
> however those are never turned on. Fix the code to
> turn on those on for such devices.
>
> Also modify the code to use switch statements to
> improve readability.
>
> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Just one more thing. See below.
> ---
> Changes in v2:
> - use a switch statement to improve readability as suggested
> by Gertjan
> - add detailed commit description
> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++--------
> 1 file changed, 33 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index b7119e3..25f4727 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -2678,29 +2678,51 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
>
> tx_pin = 0;
>
> - if (rt2x00dev->default_ant.tx_chain_num > 1) {
> - /* Turn on secondary PAs for 2T and for 3T devices*/
> + switch (rt2x00dev->default_ant.tx_chain_num) {
> + case 3:
> + /* Turn on tertiary PAs */
> + 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);
> + /* fall-through */
> + case 2:
> + /* Turn on secondary PAs */
> 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);
> + /* fall-through */
> + case 1:
> + /* Turn on primary PAs */
> + if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags))
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
> + else
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN,
> + rf->channel <= 14);
> + break;
> }
>
> - if (rt2x00dev->default_ant.rx_chain_num > 1) {
> - /* Turn on secondary LNAs for 2R and for 3R devices */
> + switch (rt2x00dev->default_ant.rx_chain_num) {
> + case 3:
> + /* Turn on tertiary LNAs */
> + 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);
> + /* fall-through */
> + case 2:
> + /* Turn on secondary LNAs */
> 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);
> + /* fall-through */
> + case 1:
> + /* Turn on primary LNAs */
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
> + break;
> }
>
> - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
> - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
> - if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags))
> - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
> - else
> - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN,
> - rf->channel <= 14);
> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, rf->channel > 14);
I guess you forgot to move this setting of the primary PA of the 5GHz band inside the switch?
>
> rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
> --
> 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] 6+ messages in thread
* Re: [PATCH v2 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
2013-06-24 20:40 ` Gertjan van Wingerde
@ 2013-06-24 20:46 ` Gabor Juhos
0 siblings, 0 replies; 6+ messages in thread
From: Gabor Juhos @ 2013-06-24 20:46 UTC (permalink / raw)
To: Gertjan van Wingerde
Cc: John Linville, linux-wireless@vger.kernel.org,
users@rt2x00.serialmonkey.com
2013.06.24. 22:40 keltezéssel, Gertjan van Wingerde írta:
> Hi Gabor,
>
> Sent from my iPad
>
> On 24 jun. 2013, at 22:32, Gabor Juhos <juhosg@openwrt.org> wrote:
>
>> The 3T/3R devices are using the tertiary PAs/LNAs
>> however those are never turned on. Fix the code to
>> turn on those on for such devices.
>>
>> Also modify the code to use switch statements to
>> improve readability.
>>
>> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>
> Just one more thing. See below.
>
>> ---
>> Changes in v2:
>> - use a switch statement to improve readability as suggested
>> by Gertjan
>> - add detailed commit description
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++--------
>> 1 file changed, 33 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index b7119e3..25f4727 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -2678,29 +2678,51 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
>>
>> tx_pin = 0;
>>
>> - if (rt2x00dev->default_ant.tx_chain_num > 1) {
>> - /* Turn on secondary PAs for 2T and for 3T devices*/
>> + switch (rt2x00dev->default_ant.tx_chain_num) {
>> + case 3:
>> + /* Turn on tertiary PAs */
>> + 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);
>> + /* fall-through */
>> + case 2:
>> + /* Turn on secondary PAs */
>> 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);
>> + /* fall-through */
>> + case 1:
>> + /* Turn on primary PAs */
>> + if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags))
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
>> + else
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN,
>> + rf->channel <= 14);
>> + break;
>> }
>>
>> - if (rt2x00dev->default_ant.rx_chain_num > 1) {
>> - /* Turn on secondary LNAs for 2R and for 3R devices */
>> + switch (rt2x00dev->default_ant.rx_chain_num) {
>> + case 3:
>> + /* Turn on tertiary LNAs */
>> + 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);
>> + /* fall-through */
>> + case 2:
>> + /* Turn on secondary LNAs */
>> 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);
>> + /* fall-through */
>> + case 1:
>> + /* Turn on primary LNAs */
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
>> + break;
>> }
>>
>> - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
>> - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
>> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
>> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
>> - if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags))
>> - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
>> - else
>> - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN,
>> - rf->channel <= 14);
>> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, rf->channel > 14);
>
> I guess you forgot to move this setting of the primary PA of the 5GHz band inside the switch?
Hm, you are right. Even though it does not change the behaviour, but it should
be moved as well. Will send yet another version.
-Gabor
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-24 20:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-24 20:32 [PATCH v2 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices Gabor Juhos
2013-06-24 20:32 ` [PATCH v2 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
2013-06-24 20:40 ` Gertjan van Wingerde
2013-06-24 20:46 ` Gabor Juhos
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).