From: Gabor Juhos <juhosg@openwrt.org>
To: stf_xl@wp.pl
Cc: "" <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: Re: [PATCH 02/11] rt2800: move rf init calibration code
Date: Wed, 10 Apr 2013 09:12:22 +0200 [thread overview]
Message-ID: <516510D6.5090700@openwrt.org> (raw)
In-Reply-To: <1365519930-3230-3-git-send-email-stf_xl@wp.pl>
Hi Stanislaw,
> From: Stanislaw Gruszka <stf_xl@wp.pl>
>
> Add separate functions for rf init calibration code and use it in
> proper init rf routines.
>
> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 53 ++++++++++++++++++-------------
> 1 files changed, 31 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index d092b47..334973a 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -4425,6 +4425,18 @@ static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev)
> rt2800_rfcsr_write(rt2x00dev, 30, reg);
> }
>
> +static void rt2800_rf_init_calibration_53xx(struct rt2x00_dev *rt2x00dev)
> +{
> + u8 rfcsr;
> +
> + rt2800_rfcsr_read(rt2x00dev, 2, &rfcsr);
> + rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1);
> + rt2800_rfcsr_write(rt2x00dev, 2, rfcsr);
> + msleep(1);
> + rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 0);
> + rt2800_rfcsr_write(rt2x00dev, 2, rfcsr);
> +}
> +
> static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev)
> {
> rt2800_rfcsr_write(rt2x00dev, 0, 0x50);
> @@ -4463,6 +4475,19 @@ static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev)
>
> static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
> {
> + u8 rfcsr;
> +
> + /*
> + * Init RF calibration.
> + * XXX: vendor driver do this only for 3070 ?
> + */
> + rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
> + rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1);
> + rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
> + msleep(1);
> + rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
> + rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
> +
> rt2800_rfcsr_write(rt2x00dev, 4, 0x40);
> rt2800_rfcsr_write(rt2x00dev, 5, 0x03);
> rt2800_rfcsr_write(rt2x00dev, 6, 0x02);
> @@ -4486,6 +4511,8 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
>
> static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
> {
> + rt2800_rf_init_calibration_53xx(rt2x00dev);
> +
> rt2800_rfcsr_write(rt2x00dev, 1, 0x0f);
> rt2800_rfcsr_write(rt2x00dev, 2, 0x80);
> rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
> @@ -4674,6 +4701,8 @@ static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
>
> static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
> {
> + rt2800_rf_init_calibration_53xx(rt2x00dev);
> +
> rt2800_rfcsr_write(rt2x00dev, 1, 0x0f);
> rt2800_rfcsr_write(rt2x00dev, 2, 0x80);
> rt2800_rfcsr_write(rt2x00dev, 3, 0x88);
> @@ -4760,6 +4789,8 @@ static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
>
> static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev)
> {
> + rt2800_rf_init_calibration_53xx(rt2x00dev);
> +
> rt2800_rfcsr_write(rt2x00dev, 1, 0x17);
> rt2800_rfcsr_write(rt2x00dev, 2, 0x80);
> rt2800_rfcsr_write(rt2x00dev, 3, 0x88);
> @@ -4882,28 +4913,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
> !rt2800_is_305x_soc(rt2x00dev))
> return 0;
>
> - /*
> - * Init RF calibration.
> - */
> -
> - if (rt2x00_rt(rt2x00dev, RT3290) ||
> - rt2x00_rt(rt2x00dev, RT5390) ||
> - rt2x00_rt(rt2x00dev, RT5392)) {
> - rt2800_rfcsr_read(rt2x00dev, 2, &rfcsr);
> - rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1);
> - rt2800_rfcsr_write(rt2x00dev, 2, rfcsr);
> - msleep(1);
> - rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 0);
> - rt2800_rfcsr_write(rt2x00dev, 2, rfcsr);
> - } else {
> - rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
> - rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1);
> - rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
> - msleep(1);
> - rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
> - rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
> - }
The code in the else branch is required by the 305x_soc devices. However the
change moves it into the 'rt2800_init_rfcsr_30xx' function and that is only
called for RT3070, RT3071, RT3090.
Either add the code into the 'rt2800_init_rfcsr_305x_soc function' as well or
create a helper function and call that from 'rt2800_init_rfcsr_30xx' and from
'rt2800_init_rfcsr_305x_soc'.
> -
> if (rt2800_is_305x_soc(rt2x00dev)) {
> rt2800_init_rfcsr_305x_soc(rt2x00dev);
> return 0;
>
-Gabor
next prev parent reply other threads:[~2013-04-10 7:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-09 15:05 [PATCH 0/11] rt2800: cleanup rfcsr init procedures stf_xl
2013-04-09 15:05 ` [PATCH 01/11] rt2800: merge 5xxx normal mode setup stf_xl
[not found] ` <3B6ED6A8-A24C-4F0C-941C-7A24F55172DA@gmail.com>
2013-04-14 20:20 ` Gertjan van Wingerde
2013-04-09 15:05 ` [PATCH 02/11] rt2800: move rf init calibration code stf_xl
2013-04-10 7:12 ` Gabor Juhos [this message]
2013-04-10 15:15 ` Stanislaw Gruszka
[not found] ` <F57510E7-8DE6-4BA4-8256-2144DDE5B30D@gmail.com>
2013-04-14 20:14 ` Gertjan van Wingerde
2013-04-09 15:05 ` [PATCH 03/11] rt2800: move RFCSR29_RSSI_GAIN to 3290 specific rfcsr init stf_xl
[not found] ` <413EC3EA-0BB4-42CC-A95A-52468DC35C67@gmail.com>
2013-04-14 20:15 ` Gertjan van Wingerde
2013-04-09 15:05 ` [PATCH 04/11] rt2800: move 30xx common rf init code stf_xl
[not found] ` <A636A59B-CC0A-41E2-98A8-0165993938FA@gmail.com>
2013-04-14 20:15 ` Gertjan van Wingerde
2013-04-09 15:05 ` [PATCH 05/11] rt2800: move GPIO_SWITCH setup to 3390 specific rfcsr init stf_xl
[not found] ` <5FA86BE2-7773-4D09-B891-6B1C80DCED72@gmail.com>
2013-04-14 20:16 ` Gertjan van Wingerde
2013-04-09 15:05 ` [PATCH 06/11] rt2800: move RFCSR6_R2 & LDO_CFG0 setup to 3572 " stf_xl
[not found] ` <66918CCA-AAE0-47BF-B989-58A019810AC7@gmail.com>
2013-04-14 20:17 ` Gertjan van Wingerde
2013-04-09 15:05 ` [PATCH 07/11] rt2800: add rt2800_rx_filter_calibration procedure stf_xl
[not found] ` <948863C1-A75D-4625-A880-5589875479D0@gmail.com>
2013-04-14 20:17 ` Gertjan van Wingerde
2013-04-17 8:23 ` Stanislaw Gruszka
2013-04-09 15:05 ` [PATCH 08/11] rt2800: move RF_R27 setup to individual rfcsr init subroutines stf_xl
[not found] ` <742363D2-2E4F-40E5-81BB-69252F998D43@gmail.com>
2013-04-14 20:18 ` Gertjan van Wingerde
2013-04-09 15:05 ` [PATCH 09/11] rt2800: add rt2800_led_open_drain_enable subroutine stf_xl
[not found] ` <0E1FF2EE-1777-42C7-9052-51895C784968@gmail.com>
2013-04-14 20:18 ` Gertjan van Wingerde
2013-04-09 15:05 ` [PATCH 10/11] rt2800: add rt2800_normal_mode_setup_3xxx subroutine stf_xl
[not found] ` <D7DE287D-EED7-4657-B388-ADCCDB823A8B@gmail.com>
2013-04-14 20:19 ` Gertjan van Wingerde
2013-04-09 15:05 ` [PATCH 11/11] rt2800: cleanup rt2800_init_rfcsr stf_xl
[not found] ` <35BCCCCF-97E2-42EE-839F-89DB7542719B@gmail.com>
2013-04-14 20:20 ` Gertjan van Wingerde
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=516510D6.5090700@openwrt.org \
--to=juhosg@openwrt.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=stf_xl@wp.pl \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.