This patch set move code from common RFCSR init procedure to individual
chipset procedures. That make code easier to maintain and modify.
rt2800lib.c | 548 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 280 insertions(+), 268 deletions(-)
From: Stanislaw Gruszka <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index df8760f..fe0df88 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4588,6 +4588,11 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
}
rt2800_rx_filter_calibration(rt2x00dev);
+
+ if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) ||
+ rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
+ rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E))
+ rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
}
static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
@@ -4761,6 +4766,9 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
rt2800_rx_filter_calibration(rt2x00dev);
+
+ if (rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E))
+ rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
}
static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
@@ -5007,6 +5015,9 @@ static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
rt2800_bbp_write(rt2x00dev, 103, 0xc0);
rt2800_normal_mode_setup_5xxx(rt2x00dev);
+
+ if (rt2x00_rt_rev_lt(rt2x00dev, RT5592, REV_RT5592C))
+ rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
}
static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
@@ -5063,13 +5074,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
return 0;
}
- if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) ||
- rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
- rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
- rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E) ||
- rt2x00_rt_rev_lt(rt2x00dev, RT5592, REV_RT5592C))
- rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
-
rt2800_register_read(rt2x00dev, OPT_14_CSR, ®);
rt2x00_set_field32(®, OPT_14_CSR_BIT0, 1);
rt2800_register_write(rt2x00dev, OPT_14_CSR, reg);
--
1.7.4.4
From: Stanislaw Gruszka <[email protected]>
This procedure is simple switch now and return no error any longer.
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 31 ++++++-------------------------
1 files changed, 6 insertions(+), 25 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index f31b9b9..b084e90 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -5100,29 +5100,11 @@ static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
rt2800_led_open_drain_enable(rt2x00dev);
}
-static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
+static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
{
- struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
- u8 rfcsr;
- u32 reg;
-
- if (!rt2x00_rt(rt2x00dev, RT3070) &&
- !rt2x00_rt(rt2x00dev, RT3071) &&
- !rt2x00_rt(rt2x00dev, RT3090) &&
- !rt2x00_rt(rt2x00dev, RT3290) &&
- !rt2x00_rt(rt2x00dev, RT3352) &&
- !rt2x00_rt(rt2x00dev, RT3390) &&
- !rt2x00_rt(rt2x00dev, RT3572) &&
- !rt2x00_rt(rt2x00dev, RT5390) &&
- !rt2x00_rt(rt2x00dev, RT5392) &&
- !rt2x00_rt(rt2x00dev, RT5392) &&
- !rt2x00_rt(rt2x00dev, RT5592) &&
- !rt2800_is_305x_soc(rt2x00dev))
- return 0;
-
if (rt2800_is_305x_soc(rt2x00dev)) {
rt2800_init_rfcsr_305x_soc(rt2x00dev);
- return 0;
+ return;
}
switch (rt2x00dev->chip.rt) {
@@ -5151,10 +5133,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
break;
case RT5592:
rt2800_init_rfcsr_5592(rt2x00dev);
- return 0;
+ break;
}
-
- return 0;
}
int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev)
@@ -5180,10 +5160,11 @@ int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev)
}
msleep(1);
- if (unlikely(rt2800_init_bbp(rt2x00dev) ||
- rt2800_init_rfcsr(rt2x00dev)))
+ if (unlikely(rt2800_init_bbp(rt2x00dev)))
return -EIO;
+ rt2800_init_rfcsr(rt2x00dev);
+
if (rt2x00_is_usb(rt2x00dev) &&
(rt2x00_rt(rt2x00dev, RT3070) ||
rt2x00_rt(rt2x00dev, RT3071) ||
--
1.7.4.4
On Sun, Apr 14, 2013 at 10:17:56PM +0200, Gertjan van Wingerde wrote:
> >> + /*
> >> + * Set back to initial state
> >> + */
> >> + rt2800_bbp_write(rt2x00dev, 24, 0);
> >> +
> >> + rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr);
> >> + rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0);
> >> + rt2800_rfcsr_write(rt2x00dev, 22, rfcsr);
> >> +
> >> + /*
> >> + * Set BBP back to BW20
> >> + */
> >> + rt2800_bbp_read(rt2x00dev, 4, &bbp);
> >> + rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0);
> >> + rt2800_bbp_write(rt2x00dev, 4, bbp);
[snip]
> >> +
> >> + rt2800_rx_filter_calibration(rt2x00dev);
> >> }
> >
> > This looks a bit fishy to me, as the original code doesn't completely apply to RT3290, but now it does.
On vendor DPO_RT3290_LinuxSTA_V2600_20120508 we do not do this
"set back to initial state" code at all, so I'll remove
rt2800_rx_filter_calibration() from 3290 procedure.
Stanislaw
From: Stanislaw Gruszka <[email protected]>
Merge code which program the same registes at the end of rfcsr
initialization for 5592, 5392 and 5390 chips.
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 91 ++++++++++++-------------------
1 files changed, 34 insertions(+), 57 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 7deac4d..d092b47 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4396,6 +4396,35 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
return rfcsr24;
}
+static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev)
+{
+ u8 reg;
+ u16 eeprom;
+
+ rt2800_bbp_read(rt2x00dev, 138, ®);
+ /* Turn off unused DAC1 and ADC1 to reduce power consumption */
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1)
+ rt2x00_set_field8(®, BBP138_RX_ADC1, 0);
+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1)
+ rt2x00_set_field8(®, BBP138_TX_DAC1, 1);
+ rt2800_bbp_write(rt2x00dev, 138, reg);
+
+ rt2800_rfcsr_read(rt2x00dev, 38, ®);
+ rt2x00_set_field8(®, RFCSR38_RX_LO1_EN, 0);
+ rt2800_rfcsr_write(rt2x00dev, 38, reg);
+
+ rt2800_rfcsr_read(rt2x00dev, 39, ®);
+ rt2x00_set_field8(®, RFCSR39_RX_LO2_EN, 0);
+ rt2800_rfcsr_write(rt2x00dev, 39, reg);
+
+ rt2800_bbp4_mac_if_ctrl(rt2x00dev);
+
+ rt2800_rfcsr_read(rt2x00dev, 30, ®);
+ rt2x00_set_field8(®, RFCSR30_RX_VCM, 2);
+ rt2800_rfcsr_write(rt2x00dev, 30, reg);
+}
+
static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev)
{
rt2800_rfcsr_write(rt2x00dev, 0, 0x50);
@@ -4725,6 +4754,8 @@ static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 61, 0xdd);
rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
+
+ rt2800_normal_mode_setup_5xxx(rt2x00dev);
}
static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev)
@@ -4788,13 +4819,12 @@ static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 61, 0x91);
rt2800_rfcsr_write(rt2x00dev, 62, 0x39);
rt2800_rfcsr_write(rt2x00dev, 63, 0x07);
+
+ rt2800_normal_mode_setup_5xxx(rt2x00dev);
}
static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
{
- u8 reg;
- u16 eeprom;
-
rt2800_rfcsr_write(rt2x00dev, 1, 0x3F);
rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
@@ -4823,34 +4853,11 @@ static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
rt2800_adjust_freq_offset(rt2x00dev);
- rt2800_bbp_read(rt2x00dev, 138, ®);
-
- /* Turn off unused DAC1 and ADC1 to reduce power consumption */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1)
- rt2x00_set_field8(®, BBP138_RX_ADC1, 0);
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1)
- rt2x00_set_field8(®, BBP138_TX_DAC1, 1);
-
- rt2800_bbp_write(rt2x00dev, 138, reg);
-
/* Enable DC filter */
if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C))
rt2800_bbp_write(rt2x00dev, 103, 0xc0);
- rt2800_rfcsr_read(rt2x00dev, 38, ®);
- rt2x00_set_field8(®, RFCSR38_RX_LO1_EN, 0);
- rt2800_rfcsr_write(rt2x00dev, 38, reg);
-
- rt2800_rfcsr_read(rt2x00dev, 39, ®);
- rt2x00_set_field8(®, RFCSR39_RX_LO2_EN, 0);
- rt2800_rfcsr_write(rt2x00dev, 39, reg);
-
- rt2800_bbp4_mac_if_ctrl(rt2x00dev);
-
- rt2800_rfcsr_read(rt2x00dev, 30, ®);
- rt2x00_set_field8(®, RFCSR30_RX_VCM, 2);
- rt2800_rfcsr_write(rt2x00dev, 30, reg);
+ rt2800_normal_mode_setup_5xxx(rt2x00dev);
}
static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
@@ -5051,20 +5058,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
}
- if (rt2x00_rt(rt2x00dev, RT3090) ||
- rt2x00_rt(rt2x00dev, RT5592)) {
- rt2800_bbp_read(rt2x00dev, 138, &bbp);
-
- /* Turn off unused DAC1 and ADC1 to reduce power consumption */
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1)
- rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0);
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1)
- rt2x00_set_field8(&bbp, BBP138_TX_DAC1, 1);
-
- rt2800_bbp_write(rt2x00dev, 138, bbp);
- }
-
if (rt2x00_rt(rt2x00dev, RT3071) ||
rt2x00_rt(rt2x00dev, RT3090) ||
rt2x00_rt(rt2x00dev, RT3390)) {
@@ -5107,22 +5100,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 29, rfcsr);
}
- if (rt2x00_rt(rt2x00dev, RT5390) ||
- rt2x00_rt(rt2x00dev, RT5392) ||
- rt2x00_rt(rt2x00dev, RT5592)) {
- rt2800_rfcsr_read(rt2x00dev, 38, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR38_RX_LO1_EN, 0);
- rt2800_rfcsr_write(rt2x00dev, 38, rfcsr);
-
- rt2800_rfcsr_read(rt2x00dev, 39, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR39_RX_LO2_EN, 0);
- rt2800_rfcsr_write(rt2x00dev, 39, rfcsr);
-
- rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR30_RX_VCM, 2);
- rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
- }
-
return 0;
}
--
1.7.4.4
(Resending as the message didn't seem to end up on the mailing list)
> Hi Stanislaw,
>
> Sent from my iPad
>
> On 9 apr. 2013, at 17:05, [email protected] wrote:
>
>> From: Stanislaw Gruszka <[email protected]>
>>
>> Merge code which program the same registes at the end of rfcsr
>> initialization for 5592, 5392 and 5390 chips.
>>
>> Signed-off-by: Stanislaw Gruszka <[email protected]>
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 91 ++++++++++++-------------------
>> 1 files changed, 34 insertions(+), 57 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index 7deac4d..d092b47 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -4396,6 +4396,35 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
>> return rfcsr24;
>> }
>>
>> +static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev)
>> +{
>> + u8 reg;
>> + u16 eeprom;
>> +
>> + rt2800_bbp_read(rt2x00dev, 138, ®);
>> + /* Turn off unused DAC1 and ADC1 to reduce power consumption */
>> + rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
>> + if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1)
>> + rt2x00_set_field8(®, BBP138_RX_ADC1, 0);
>> + if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1)
>> + rt2x00_set_field8(®, BBP138_TX_DAC1, 1);
>> + rt2800_bbp_write(rt2x00dev, 138, reg);
>
> I would put the comment above the bbp_read call, as it applies to the whole block and makes the code better readable, IMHO.
>
>> +
>> + rt2800_rfcsr_read(rt2x00dev, 38, ®);
>> + rt2x00_set_field8(®, RFCSR38_RX_LO1_EN, 0);
>> + rt2800_rfcsr_write(rt2x00dev, 38, reg);
>> +
>> + rt2800_rfcsr_read(rt2x00dev, 39, ®);
>> + rt2x00_set_field8(®, RFCSR39_RX_LO2_EN, 0);
>> + rt2800_rfcsr_write(rt2x00dev, 39, reg);
>> +
>> + rt2800_bbp4_mac_if_ctrl(rt2x00dev);
>> +
>> + rt2800_rfcsr_read(rt2x00dev, 30, ®);
>> + rt2x00_set_field8(®, RFCSR30_RX_VCM, 2);
>> + rt2800_rfcsr_write(rt2x00dev, 30, reg);
>> +}
>> +
>> static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev)
>> {
>> rt2800_rfcsr_write(rt2x00dev, 0, 0x50);
>> @@ -4725,6 +4754,8 @@ static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
>> rt2800_rfcsr_write(rt2x00dev, 61, 0xdd);
>> rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
>> rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
>> +
>> + rt2800_normal_mode_setup_5xxx(rt2x00dev);
>> }
>>
>> static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev)
>> @@ -4788,13 +4819,12 @@ static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev)
>> rt2800_rfcsr_write(rt2x00dev, 61, 0x91);
>> rt2800_rfcsr_write(rt2x00dev, 62, 0x39);
>> rt2800_rfcsr_write(rt2x00dev, 63, 0x07);
>> +
>> + rt2800_normal_mode_setup_5xxx(rt2x00dev);
>> }
>>
>> static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
>> {
>> - u8 reg;
>> - u16 eeprom;
>> -
>> rt2800_rfcsr_write(rt2x00dev, 1, 0x3F);
>> rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
>> rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
>> @@ -4823,34 +4853,11 @@ static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
>>
>> rt2800_adjust_freq_offset(rt2x00dev);
>>
>> - rt2800_bbp_read(rt2x00dev, 138, ®);
>> -
>> - /* Turn off unused DAC1 and ADC1 to reduce power consumption */
>> - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
>> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1)
>> - rt2x00_set_field8(®, BBP138_RX_ADC1, 0);
>> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1)
>> - rt2x00_set_field8(®, BBP138_TX_DAC1, 1);
>> -
>> - rt2800_bbp_write(rt2x00dev, 138, reg);
>> -
>> /* Enable DC filter */
>> if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C))
>> rt2800_bbp_write(rt2x00dev, 103, 0xc0);
>>
>> - rt2800_rfcsr_read(rt2x00dev, 38, ®);
>> - rt2x00_set_field8(®, RFCSR38_RX_LO1_EN, 0);
>> - rt2800_rfcsr_write(rt2x00dev, 38, reg);
>> -
>> - rt2800_rfcsr_read(rt2x00dev, 39, ®);
>> - rt2x00_set_field8(®, RFCSR39_RX_LO2_EN, 0);
>> - rt2800_rfcsr_write(rt2x00dev, 39, reg);
>> -
>> - rt2800_bbp4_mac_if_ctrl(rt2x00dev);
>> -
>> - rt2800_rfcsr_read(rt2x00dev, 30, ®);
>> - rt2x00_set_field8(®, RFCSR30_RX_VCM, 2);
>> - rt2800_rfcsr_write(rt2x00dev, 30, reg);
>> + rt2800_normal_mode_setup_5xxx(rt2x00dev);
>> }
>>
>> static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> @@ -5051,20 +5058,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
>> }
>>
>> - if (rt2x00_rt(rt2x00dev, RT3090) ||
>> - rt2x00_rt(rt2x00dev, RT5592)) {
>> - rt2800_bbp_read(rt2x00dev, 138, &bbp);
>
> I don't see the addition of this code to the function for RT3090, but this code is removed here. I guess it still needs to be added to rt2800_init_rfcsr_30xx.
>
>> -
>> - /* Turn off unused DAC1 and ADC1 to reduce power consumption */
>> - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
>> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1)
>> - rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0);
>> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1)
>> - rt2x00_set_field8(&bbp, BBP138_TX_DAC1, 1);
>> -
>> - rt2800_bbp_write(rt2x00dev, 138, bbp);
>> - }
>> -
>> if (rt2x00_rt(rt2x00dev, RT3071) ||
>> rt2x00_rt(rt2x00dev, RT3090) ||
>> rt2x00_rt(rt2x00dev, RT3390)) {
>> @@ -5107,22 +5100,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> rt2800_rfcsr_write(rt2x00dev, 29, rfcsr);
>> }
>>
>> - if (rt2x00_rt(rt2x00dev, RT5390) ||
>> - rt2x00_rt(rt2x00dev, RT5392) ||
>> - rt2x00_rt(rt2x00dev, RT5592)) {
>> - rt2800_rfcsr_read(rt2x00dev, 38, &rfcsr);
>> - rt2x00_set_field8(&rfcsr, RFCSR38_RX_LO1_EN, 0);
>> - rt2800_rfcsr_write(rt2x00dev, 38, rfcsr);
>> -
>> - rt2800_rfcsr_read(rt2x00dev, 39, &rfcsr);
>> - rt2x00_set_field8(&rfcsr, RFCSR39_RX_LO2_EN, 0);
>> - rt2800_rfcsr_write(rt2x00dev, 39, rfcsr);
>> -
>> - rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
>> - rt2x00_set_field8(&rfcsr, RFCSR30_RX_VCM, 2);
>> - rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
>> - }
>> -
>> return 0;
>> }
>>
>> --
>> 1.7.4.4
>>
>> --
>> 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
On Wed, Apr 10, 2013 at 09:12:22AM +0200, Gabor Juhos wrote:
> > - 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'.
Right. 3352 and 3572 need that too. I'll post v2 shortly.
Thanks
Stanislaw
From: Stanislaw Gruszka <[email protected]>
Add procedure for both bands filter calibration and use it on individual
chipset init rfcsr subroutines.
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 106 +++++++++++++++++--------------
1 files changed, 59 insertions(+), 47 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 7130040..df8760f 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4332,8 +4332,8 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
return 0;
}
-static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
- bool bw40, u8 rfcsr24, u8 filter_target)
+static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, bool bw40,
+ u8 filter_target)
{
unsigned int i;
u8 bbp;
@@ -4341,6 +4341,7 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
u8 passband;
u8 stopband;
u8 overtuned = 0;
+ u8 rfcsr24 = (bw40) ? 0x27 : 0x07;
rt2800_rfcsr_write(rt2x00dev, 24, rfcsr24);
@@ -4396,6 +4397,52 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
return rfcsr24;
}
+static void rt2800_rx_filter_calibration(struct rt2x00_dev *rt2x00dev)
+{
+ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
+ u8 filter_tgt_bw20;
+ u8 filter_tgt_bw40;
+ u8 rfcsr, bbp;
+
+ /*
+ * TODO: sync filter_tgt values with vendor driver
+ */
+ if (rt2x00_rt(rt2x00dev, RT3070)) {
+ filter_tgt_bw20 = 0x16;
+ filter_tgt_bw40 = 0x19;
+ } else {
+ filter_tgt_bw20 = 0x13;
+ filter_tgt_bw40 = 0x15;
+ }
+
+ drv_data->calibration_bw20 =
+ rt2800_init_rx_filter(rt2x00dev, false, filter_tgt_bw20);
+ drv_data->calibration_bw40 =
+ rt2800_init_rx_filter(rt2x00dev, true, filter_tgt_bw40);
+
+ /*
+ * Save BBP 25 & 26 values for later use in channel switching (for 3052)
+ */
+ rt2800_bbp_read(rt2x00dev, 25, &drv_data->bbp25);
+ rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26);
+
+ /*
+ * Set back to initial state
+ */
+ rt2800_bbp_write(rt2x00dev, 24, 0);
+
+ rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0);
+ rt2800_rfcsr_write(rt2x00dev, 22, rfcsr);
+
+ /*
+ * Set BBP back to BW20
+ */
+ rt2800_bbp_read(rt2x00dev, 4, &bbp);
+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0);
+ rt2800_bbp_write(rt2x00dev, 4, bbp);
+}
+
static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev)
{
u8 reg;
@@ -4539,6 +4586,8 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
}
+
+ rt2800_rx_filter_calibration(rt2x00dev);
}
static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
@@ -4597,6 +4646,8 @@ static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_read(rt2x00dev, 29, &rfcsr);
rt2x00_set_field8(&rfcsr, RFCSR29_RSSI_GAIN, 3);
rt2800_rfcsr_write(rt2x00dev, 29, rfcsr);
+
+ rt2800_rx_filter_calibration(rt2x00dev);
}
static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
@@ -4664,6 +4715,8 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
+
+ rt2800_rx_filter_calibration(rt2x00dev);
}
static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
@@ -4706,6 +4759,8 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
+
+ rt2800_rx_filter_calibration(rt2x00dev);
}
static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
@@ -4758,6 +4813,8 @@ static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
+
+ rt2800_rx_filter_calibration(rt2x00dev);
}
static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
@@ -4956,7 +5013,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
{
struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
u8 rfcsr;
- u8 bbp;
u32 reg;
if (!rt2x00_rt(rt2x00dev, RT3070) &&
@@ -5007,50 +5063,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
return 0;
}
- /*
- * Set RX Filter calibration for 20MHz and 40MHz
- */
- if (rt2x00_rt(rt2x00dev, RT3070)) {
- drv_data->calibration_bw20 =
- rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x16);
- drv_data->calibration_bw40 =
- rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x19);
- } else if (rt2x00_rt(rt2x00dev, RT3071) ||
- rt2x00_rt(rt2x00dev, RT3090) ||
- rt2x00_rt(rt2x00dev, RT3352) ||
- rt2x00_rt(rt2x00dev, RT3390) ||
- rt2x00_rt(rt2x00dev, RT3572)) {
- drv_data->calibration_bw20 =
- rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x13);
- drv_data->calibration_bw40 =
- rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x15);
- }
-
- /*
- * Save BBP 25 & 26 values for later use in channel switching
- */
- rt2800_bbp_read(rt2x00dev, 25, &drv_data->bbp25);
- rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26);
-
- if (!rt2x00_rt(rt2x00dev, RT5390) &&
- !rt2x00_rt(rt2x00dev, RT5392)) {
- /*
- * Set back to initial state
- */
- rt2800_bbp_write(rt2x00dev, 24, 0);
-
- rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0);
- rt2800_rfcsr_write(rt2x00dev, 22, rfcsr);
-
- /*
- * Set BBP back to BW20
- */
- rt2800_bbp_read(rt2x00dev, 4, &bbp);
- rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0);
- rt2800_bbp_write(rt2x00dev, 4, bbp);
- }
-
if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) ||
rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
--
1.7.4.4
(Resending as the message didn't seem to end up on the mailing list)
> Hi Stanislaw,
>
> Looks good to me. When you repost the series with all comments fixed, you can add my acked-by.
>
> Sent from my iPad
>
> On 9 apr. 2013, at 17:05, [email protected] wrote:
>
>> From: Stanislaw Gruszka <[email protected]>
>>
>> Signed-off-by: Stanislaw Gruszka <[email protected]>
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 18 +++++++++++-------
>> 1 files changed, 11 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index df8760f..fe0df88 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -4588,6 +4588,11 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
>> }
>>
>> rt2800_rx_filter_calibration(rt2x00dev);
>> +
>> + if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) ||
>> + rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
>> + rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E))
>> + rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
>> }
>>
>> static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
>> @@ -4761,6 +4766,9 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
>> rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
>>
>> rt2800_rx_filter_calibration(rt2x00dev);
>> +
>> + if (rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E))
>> + rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
>> }
>>
>> static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
>> @@ -5007,6 +5015,9 @@ static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
>> rt2800_bbp_write(rt2x00dev, 103, 0xc0);
>>
>> rt2800_normal_mode_setup_5xxx(rt2x00dev);
>> +
>> + if (rt2x00_rt_rev_lt(rt2x00dev, RT5592, REV_RT5592C))
>> + rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
>> }
>>
>> static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> @@ -5063,13 +5074,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> return 0;
>> }
>>
>> - if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) ||
>> - rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
>> - rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
>> - rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E) ||
>> - rt2x00_rt_rev_lt(rt2x00dev, RT5592, REV_RT5592C))
>> - rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
>> -
>> rt2800_register_read(rt2x00dev, OPT_14_CSR, ®);
>> rt2x00_set_field32(®, OPT_14_CSR_BIT0, 1);
>> rt2800_register_write(rt2x00dev, OPT_14_CSR, reg);
>> --
>> 1.7.4.4
>>
>> --
>> 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
From: Stanislaw Gruszka <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 29 +++++++++++++++++++++++++----
1 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index fe0df88..009fe47 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4332,6 +4332,15 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
return 0;
}
+static void rt2800_led_open_drain_enable(struct rt2x00_dev *rt2x00dev)
+{
+ u32 reg;
+
+ rt2800_register_read(rt2x00dev, OPT_14_CSR, ®);
+ rt2x00_set_field32(®, OPT_14_CSR_BIT0, 1);
+ rt2800_register_write(rt2x00dev, OPT_14_CSR, reg);
+}
+
static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, bool bw40,
u8 filter_target)
{
@@ -4593,6 +4602,8 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E))
rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
+
+ rt2800_led_open_drain_enable(rt2x00dev);
}
static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
@@ -4653,6 +4664,8 @@ static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 29, rfcsr);
rt2800_rx_filter_calibration(rt2x00dev);
+
+ rt2800_led_open_drain_enable(rt2x00dev);
}
static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
@@ -4722,6 +4735,8 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
rt2800_rx_filter_calibration(rt2x00dev);
+
+ rt2800_led_open_drain_enable(rt2x00dev);
}
static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
@@ -4769,6 +4784,8 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
if (rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E))
rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
+
+ rt2800_led_open_drain_enable(rt2x00dev);
}
static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
@@ -4823,6 +4840,8 @@ static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
rt2800_rx_filter_calibration(rt2x00dev);
+
+ rt2800_led_open_drain_enable(rt2x00dev);
}
static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
@@ -4911,6 +4930,8 @@ static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
rt2800_normal_mode_setup_5xxx(rt2x00dev);
+
+ rt2800_led_open_drain_enable(rt2x00dev);
}
static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev)
@@ -4978,6 +4999,8 @@ static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 63, 0x07);
rt2800_normal_mode_setup_5xxx(rt2x00dev);
+
+ rt2800_led_open_drain_enable(rt2x00dev);
}
static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
@@ -5018,6 +5041,8 @@ static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)
if (rt2x00_rt_rev_lt(rt2x00dev, RT5592, REV_RT5592C))
rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
+
+ rt2800_led_open_drain_enable(rt2x00dev);
}
static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
@@ -5074,10 +5099,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
return 0;
}
- rt2800_register_read(rt2x00dev, OPT_14_CSR, ®);
- rt2x00_set_field32(®, OPT_14_CSR_BIT0, 1);
- rt2800_register_write(rt2x00dev, OPT_14_CSR, reg);
-
if (!rt2x00_rt(rt2x00dev, RT5390) &&
!rt2x00_rt(rt2x00dev, RT5392)) {
rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
--
1.7.4.4
From: Stanislaw Gruszka <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 62 ++++++++++++++++--------------
1 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 085b60c..216ceb6 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4476,6 +4476,8 @@ static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev)
static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
{
u8 rfcsr;
+ u16 eeprom;
+ u32 reg;
/*
* Init RF calibration.
@@ -4507,6 +4509,36 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 24, 0x16);
rt2800_rfcsr_write(rt2x00dev, 25, 0x01);
rt2800_rfcsr_write(rt2x00dev, 29, 0x1f);
+
+ if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) {
+ rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
+ rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
+ rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
+ rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
+ } else if (rt2x00_rt(rt2x00dev, RT3071) ||
+ rt2x00_rt(rt2x00dev, RT3090)) {
+ rt2800_rfcsr_write(rt2x00dev, 31, 0x14);
+
+ rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
+ rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
+
+ rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
+ rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
+ if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
+ rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) {
+ rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST))
+ rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
+ else
+ rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
+ }
+ rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
+
+ rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
+ rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
+ rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
+ }
}
static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
@@ -4903,7 +4935,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
u8 rfcsr;
u8 bbp;
u32 reg;
- u16 eeprom;
if (!rt2x00_rt(rt2x00dev, RT3070) &&
!rt2x00_rt(rt2x00dev, RT3071) &&
@@ -4953,35 +4984,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
return 0;
}
- if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) {
- rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
- rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
- rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
- rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
- } else if (rt2x00_rt(rt2x00dev, RT3071) ||
- rt2x00_rt(rt2x00dev, RT3090)) {
- rt2800_rfcsr_write(rt2x00dev, 31, 0x14);
-
- rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
- rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
-
- rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
- rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
- if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
- rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) {
- rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST))
- rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
- else
- rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
- }
- rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
- rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
- rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
- rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
- } else if (rt2x00_rt(rt2x00dev, RT3390)) {
+ if (rt2x00_rt(rt2x00dev, RT3390)) {
rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
--
1.7.4.4
From: Stanislaw Gruszka <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 216ceb6..83554da 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4668,6 +4668,8 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
{
+ u32 reg;
+
rt2800_rfcsr_write(rt2x00dev, 0, 0xa0);
rt2800_rfcsr_write(rt2x00dev, 1, 0xe1);
rt2800_rfcsr_write(rt2x00dev, 2, 0xf1);
@@ -4700,6 +4702,10 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 29, 0x8f);
rt2800_rfcsr_write(rt2x00dev, 30, 0x20);
rt2800_rfcsr_write(rt2x00dev, 31, 0x0f);
+
+ rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
+ rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
+ rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
}
static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
@@ -4985,11 +4991,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
}
- if (rt2x00_rt(rt2x00dev, RT3390)) {
- rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
- rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
- rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
- } else if (rt2x00_rt(rt2x00dev, RT3572)) {
+ if (rt2x00_rt(rt2x00dev, RT3572)) {
rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
--
1.7.4.4
From: Stanislaw Gruszka <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 114 ++++++++++++++++---------------
1 files changed, 58 insertions(+), 56 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 009fe47..f31b9b9 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4452,6 +4452,59 @@ static void rt2800_rx_filter_calibration(struct rt2x00_dev *rt2x00dev)
rt2800_bbp_write(rt2x00dev, 4, bbp);
}
+static void rt2800_normal_mode_setup_3xxx(struct rt2x00_dev *rt2x00dev)
+{
+ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
+ u8 rfcsr;
+
+ rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0);
+ if (rt2x00_rt(rt2x00dev, RT3070) ||
+ rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
+ rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
+ rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) {
+ if (!test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags))
+ rt2x00_set_field8(&rfcsr, RFCSR17_R, 1);
+ }
+ rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN,
+ drv_data->txmixer_gain_24g);
+ rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
+
+ if (rt2x00_rt(rt2x00dev, RT3071) ||
+ rt2x00_rt(rt2x00dev, RT3090) ||
+ rt2x00_rt(rt2x00dev, RT3390)) {
+ rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1);
+ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0);
+ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0);
+ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1);
+ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1);
+ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
+
+ rt2800_rfcsr_read(rt2x00dev, 15, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR15_TX_LO2_EN, 0);
+ rt2800_rfcsr_write(rt2x00dev, 15, rfcsr);
+
+ rt2800_rfcsr_read(rt2x00dev, 20, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR20_RX_LO1_EN, 0);
+ rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
+
+ rt2800_rfcsr_read(rt2x00dev, 21, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR21_RX_LO2_EN, 0);
+ rt2800_rfcsr_write(rt2x00dev, 21, rfcsr);
+ } else if (rt2x00_rt(rt2x00dev, RT3070)) {
+ rt2800_rfcsr_read(rt2x00dev, 27, &rfcsr);
+ if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F))
+ rt2x00_set_field8(&rfcsr, RFCSR27_R1, 3);
+ else
+ rt2x00_set_field8(&rfcsr, RFCSR27_R1, 0);
+ rt2x00_set_field8(&rfcsr, RFCSR27_R2, 0);
+ rt2x00_set_field8(&rfcsr, RFCSR27_R3, 0);
+ rt2x00_set_field8(&rfcsr, RFCSR27_R4, 0);
+ rt2800_rfcsr_write(rt2x00dev, 27, rfcsr);
+ }
+}
+
static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev)
{
u8 reg;
@@ -4604,6 +4657,7 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
rt2800_led_open_drain_enable(rt2x00dev);
+ rt2800_normal_mode_setup_3xxx(rt2x00dev);
}
static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
@@ -4664,8 +4718,8 @@ static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 29, rfcsr);
rt2800_rx_filter_calibration(rt2x00dev);
-
rt2800_led_open_drain_enable(rt2x00dev);
+ rt2800_normal_mode_setup_3xxx(rt2x00dev);
}
static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
@@ -4735,8 +4789,8 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
rt2800_rx_filter_calibration(rt2x00dev);
-
rt2800_led_open_drain_enable(rt2x00dev);
+ rt2800_normal_mode_setup_3xxx(rt2x00dev);
}
static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
@@ -4786,6 +4840,7 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
rt2800_led_open_drain_enable(rt2x00dev);
+ rt2800_normal_mode_setup_3xxx(rt2x00dev);
}
static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
@@ -4840,8 +4895,8 @@ static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
rt2800_rx_filter_calibration(rt2x00dev);
-
rt2800_led_open_drain_enable(rt2x00dev);
+ rt2800_normal_mode_setup_3xxx(rt2x00dev);
}
static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
@@ -5099,59 +5154,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
return 0;
}
- if (!rt2x00_rt(rt2x00dev, RT5390) &&
- !rt2x00_rt(rt2x00dev, RT5392)) {
- rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0);
- if (rt2x00_rt(rt2x00dev, RT3070) ||
- rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
- rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
- rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) {
- if (!test_bit(CAPABILITY_EXTERNAL_LNA_BG,
- &rt2x00dev->cap_flags))
- rt2x00_set_field8(&rfcsr, RFCSR17_R, 1);
- }
- rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN,
- drv_data->txmixer_gain_24g);
- rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
- }
-
- if (rt2x00_rt(rt2x00dev, RT3071) ||
- rt2x00_rt(rt2x00dev, RT3090) ||
- rt2x00_rt(rt2x00dev, RT3390)) {
- rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1);
- rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0);
- rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0);
- rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1);
- rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1);
- rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
-
- rt2800_rfcsr_read(rt2x00dev, 15, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR15_TX_LO2_EN, 0);
- rt2800_rfcsr_write(rt2x00dev, 15, rfcsr);
-
- rt2800_rfcsr_read(rt2x00dev, 20, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR20_RX_LO1_EN, 0);
- rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
-
- rt2800_rfcsr_read(rt2x00dev, 21, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR21_RX_LO2_EN, 0);
- rt2800_rfcsr_write(rt2x00dev, 21, rfcsr);
- }
-
- if (rt2x00_rt(rt2x00dev, RT3070)) {
- rt2800_rfcsr_read(rt2x00dev, 27, &rfcsr);
- if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F))
- rt2x00_set_field8(&rfcsr, RFCSR27_R1, 3);
- else
- rt2x00_set_field8(&rfcsr, RFCSR27_R1, 0);
- rt2x00_set_field8(&rfcsr, RFCSR27_R2, 0);
- rt2x00_set_field8(&rfcsr, RFCSR27_R3, 0);
- rt2x00_set_field8(&rfcsr, RFCSR27_R4, 0);
- rt2800_rfcsr_write(rt2x00dev, 27, rfcsr);
- }
-
return 0;
}
--
1.7.4.4
(Resending as the message didn't seem to end up on the mailing list)
> Hi Stanislaw,
>
> Sent from my iPad
>
> On 9 apr. 2013, at 17:05, [email protected] wrote:
>
>> From: Stanislaw Gruszka <[email protected]>
>>
>> Add procedure for both bands filter calibration and use it on individual
>> chipset init rfcsr subroutines.
>>
>> Signed-off-by: Stanislaw Gruszka <[email protected]>
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 106 +++++++++++++++++--------------
>> 1 files changed, 59 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index 7130040..df8760f 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -4332,8 +4332,8 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
>> return 0;
>> }
>>
>> -static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
>> - bool bw40, u8 rfcsr24, u8 filter_target)
>> +static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, bool bw40,
>> + u8 filter_target)
>> {
>> unsigned int i;
>> u8 bbp;
>> @@ -4341,6 +4341,7 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
>> u8 passband;
>> u8 stopband;
>> u8 overtuned = 0;
>> + u8 rfcsr24 = (bw40) ? 0x27 : 0x07;
>>
>> rt2800_rfcsr_write(rt2x00dev, 24, rfcsr24);
>>
>> @@ -4396,6 +4397,52 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
>> return rfcsr24;
>> }
>>
>> +static void rt2800_rx_filter_calibration(struct rt2x00_dev *rt2x00dev)
>> +{
>> + struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
>> + u8 filter_tgt_bw20;
>> + u8 filter_tgt_bw40;
>> + u8 rfcsr, bbp;
>> +
>> + /*
>> + * TODO: sync filter_tgt values with vendor driver
>> + */
>> + if (rt2x00_rt(rt2x00dev, RT3070)) {
>> + filter_tgt_bw20 = 0x16;
>> + filter_tgt_bw40 = 0x19;
>> + } else {
>> + filter_tgt_bw20 = 0x13;
>> + filter_tgt_bw40 = 0x15;
>> + }
>> +
>> + drv_data->calibration_bw20 =
>> + rt2800_init_rx_filter(rt2x00dev, false, filter_tgt_bw20);
>> + drv_data->calibration_bw40 =
>> + rt2800_init_rx_filter(rt2x00dev, true, filter_tgt_bw40);
>> +
>> + /*
>> + * Save BBP 25 & 26 values for later use in channel switching (for 3052)
>> + */
>> + rt2800_bbp_read(rt2x00dev, 25, &drv_data->bbp25);
>> + rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26);
>> +
>> + /*
>> + * Set back to initial state
>> + */
>> + rt2800_bbp_write(rt2x00dev, 24, 0);
>> +
>> + rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr);
>> + rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0);
>> + rt2800_rfcsr_write(rt2x00dev, 22, rfcsr);
>> +
>> + /*
>> + * Set BBP back to BW20
>> + */
>> + rt2800_bbp_read(rt2x00dev, 4, &bbp);
>> + rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0);
>> + rt2800_bbp_write(rt2x00dev, 4, bbp);
>> +}
>> +
>> static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev)
>> {
>> u8 reg;
>> @@ -4539,6 +4586,8 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
>> rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
>> rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
>> }
>> +
>> + rt2800_rx_filter_calibration(rt2x00dev);
>> }
>>
>> static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
>> @@ -4597,6 +4646,8 @@ static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
>> rt2800_rfcsr_read(rt2x00dev, 29, &rfcsr);
>> rt2x00_set_field8(&rfcsr, RFCSR29_RSSI_GAIN, 3);
>> rt2800_rfcsr_write(rt2x00dev, 29, rfcsr);
>> +
>> + rt2800_rx_filter_calibration(rt2x00dev);
>> }
>
> This looks a bit fishy to me, as the original code doesn't completely apply to RT3290, but now it does.
>
>>
>> static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
>> @@ -4664,6 +4715,8 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
>> rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
>> rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
>> rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
>> +
>> + rt2800_rx_filter_calibration(rt2x00dev);
>> }
>>
>> static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
>> @@ -4706,6 +4759,8 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
>> rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
>> rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
>> rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
>> +
>> + rt2800_rx_filter_calibration(rt2x00dev);
>> }
>>
>> static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
>> @@ -4758,6 +4813,8 @@ static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
>> rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
>> rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
>> rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> +
>> + rt2800_rx_filter_calibration(rt2x00dev);
>> }
>>
>> static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
>> @@ -4956,7 +5013,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> {
>> struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
>> u8 rfcsr;
>> - u8 bbp;
>> u32 reg;
>>
>> if (!rt2x00_rt(rt2x00dev, RT3070) &&
>> @@ -5007,50 +5063,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> return 0;
>> }
>>
>> - /*
>> - * Set RX Filter calibration for 20MHz and 40MHz
>> - */
>> - if (rt2x00_rt(rt2x00dev, RT3070)) {
>> - drv_data->calibration_bw20 =
>> - rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x16);
>> - drv_data->calibration_bw40 =
>> - rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x19);
>> - } else if (rt2x00_rt(rt2x00dev, RT3071) ||
>> - rt2x00_rt(rt2x00dev, RT3090) ||
>> - rt2x00_rt(rt2x00dev, RT3352) ||
>> - rt2x00_rt(rt2x00dev, RT3390) ||
>> - rt2x00_rt(rt2x00dev, RT3572)) {
>> - drv_data->calibration_bw20 =
>> - rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x13);
>> - drv_data->calibration_bw40 =
>> - rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x15);
>> - }
>> -
>> - /*
>> - * Save BBP 25 & 26 values for later use in channel switching
>> - */
>> - rt2800_bbp_read(rt2x00dev, 25, &drv_data->bbp25);
>> - rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26);
>> -
>> - if (!rt2x00_rt(rt2x00dev, RT5390) &&
>> - !rt2x00_rt(rt2x00dev, RT5392)) {
>> - /*
>> - * Set back to initial state
>> - */
>> - rt2800_bbp_write(rt2x00dev, 24, 0);
>> -
>> - rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr);
>> - rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0);
>> - rt2800_rfcsr_write(rt2x00dev, 22, rfcsr);
>> -
>> - /*
>> - * Set BBP back to BW20
>> - */
>> - rt2800_bbp_read(rt2x00dev, 4, &bbp);
>> - rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0);
>> - rt2800_bbp_write(rt2x00dev, 4, bbp);
>> - }
>> -
>> if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) ||
>> rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
>> rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
>> --
>> 1.7.4.4
>>
>> --
>> 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
From: Stanislaw Gruszka <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 334973a..085b60c 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4511,6 +4511,8 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
{
+ u8 rfcsr;
+
rt2800_rf_init_calibration_53xx(rt2x00dev);
rt2800_rfcsr_write(rt2x00dev, 1, 0x0f);
@@ -4559,6 +4561,10 @@ static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 59, 0x09);
rt2800_rfcsr_write(rt2x00dev, 60, 0x45);
rt2800_rfcsr_write(rt2x00dev, 61, 0xc1);
+
+ rt2800_rfcsr_read(rt2x00dev, 29, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR29_RSSI_GAIN, 3);
+ rt2800_rfcsr_write(rt2x00dev, 29, rfcsr);
}
static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
@@ -5103,12 +5109,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 27, rfcsr);
}
- if (rt2x00_rt(rt2x00dev, RT3290)) {
- rt2800_rfcsr_read(rt2x00dev, 29, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR29_RSSI_GAIN, 3);
- rt2800_rfcsr_write(rt2x00dev, 29, rfcsr);
- }
-
return 0;
}
--
1.7.4.4
Hi Stanislaw,
> From: Stanislaw Gruszka <[email protected]>
>
> Add separate functions for rf init calibration code and use it in
> proper init rf routines.
>
> Signed-off-by: Stanislaw Gruszka <[email protected]>
> ---
> 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
From: Stanislaw Gruszka <[email protected]>
Add separate functions for rf init calibration code and use it in
proper init rf routines.
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
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);
- }
-
if (rt2800_is_305x_soc(rt2x00dev)) {
rt2800_init_rfcsr_305x_soc(rt2x00dev);
return 0;
--
1.7.4.4
(Resending as the message didn't seem to end up on the mailing list)
> Hi Stanislaw,
>
> Looks good to me. When you repost the series with all comments fixed, you can add my acked-by.
>
> Sent from my iPad
>
> On 9 apr. 2013, at 17:05, [email protected] wrote:
>
>> From: Stanislaw Gruszka <[email protected]>
>>
>> Signed-off-by: Stanislaw Gruszka <[email protected]>
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 62 ++++++++++++++++--------------
>> 1 files changed, 33 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index 085b60c..216ceb6 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -4476,6 +4476,8 @@ static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev)
>> static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
>> {
>> u8 rfcsr;
>> + u16 eeprom;
>> + u32 reg;
>>
>> /*
>> * Init RF calibration.
>> @@ -4507,6 +4509,36 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
>> rt2800_rfcsr_write(rt2x00dev, 24, 0x16);
>> rt2800_rfcsr_write(rt2x00dev, 25, 0x01);
>> rt2800_rfcsr_write(rt2x00dev, 29, 0x1f);
>> +
>> + if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) {
>> + rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
>> + rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
>> + rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
>> + rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> + } else if (rt2x00_rt(rt2x00dev, RT3071) ||
>> + rt2x00_rt(rt2x00dev, RT3090)) {
>> + rt2800_rfcsr_write(rt2x00dev, 31, 0x14);
>> +
>> + rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
>> + rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
>> + rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
>> +
>> + rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
>> + rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
>> + if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
>> + rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) {
>> + rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
>> + if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST))
>> + rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
>> + else
>> + rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
>> + }
>> + rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> +
>> + rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
>> + rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
>> + rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
>> + }
>> }
>>
>> static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)
>> @@ -4903,7 +4935,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> u8 rfcsr;
>> u8 bbp;
>> u32 reg;
>> - u16 eeprom;
>>
>> if (!rt2x00_rt(rt2x00dev, RT3070) &&
>> !rt2x00_rt(rt2x00dev, RT3071) &&
>> @@ -4953,35 +4984,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> return 0;
>> }
>>
>> - if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) {
>> - rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
>> - rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
>> - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
>> - rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> - } else if (rt2x00_rt(rt2x00dev, RT3071) ||
>> - rt2x00_rt(rt2x00dev, RT3090)) {
>> - rt2800_rfcsr_write(rt2x00dev, 31, 0x14);
>> -
>> - rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
>> - rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
>> - rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
>> -
>> - rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
>> - rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
>> - if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
>> - rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) {
>> - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
>> - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST))
>> - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
>> - else
>> - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
>> - }
>> - rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>>
>> - rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
>> - rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
>> - rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
>> - } else if (rt2x00_rt(rt2x00dev, RT3390)) {
>> + if (rt2x00_rt(rt2x00dev, RT3390)) {
>> rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
>> rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
>> rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
>> --
>> 1.7.4.4
>>
>> --
>> 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
(Resending as the message didn't seem to end up on the mailing list)
> Hi Stanislaw,
>
> Looks good to me. When you repost the series with all comments fixed, you can add my acked-by.
>
> Sent from my iPad
>
> On 9 apr. 2013, at 17:05, [email protected] wrote:
>
>> From: Stanislaw Gruszka <[email protected]>
>>
>> Signed-off-by: Stanislaw Gruszka <[email protected]>
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 12 +++++++-----
>> 1 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index 216ceb6..83554da 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -4668,6 +4668,8 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
>>
>> static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
>> {
>> + u32 reg;
>> +
>> rt2800_rfcsr_write(rt2x00dev, 0, 0xa0);
>> rt2800_rfcsr_write(rt2x00dev, 1, 0xe1);
>> rt2800_rfcsr_write(rt2x00dev, 2, 0xf1);
>> @@ -4700,6 +4702,10 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
>> rt2800_rfcsr_write(rt2x00dev, 29, 0x8f);
>> rt2800_rfcsr_write(rt2x00dev, 30, 0x20);
>> rt2800_rfcsr_write(rt2x00dev, 31, 0x0f);
>> +
>> + rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
>> + rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
>> + rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
>> }
>>
>> static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
>> @@ -4985,11 +4991,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> }
>>
>>
>> - if (rt2x00_rt(rt2x00dev, RT3390)) {
>> - rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®);
>> - rt2x00_set_field32(®, GPIO_SWITCH_5, 0);
>> - rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);
>> - } else if (rt2x00_rt(rt2x00dev, RT3572)) {
>> + if (rt2x00_rt(rt2x00dev, RT3572)) {
>> rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
>> rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
>> rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
>> --
>> 1.7.4.4
>>
>> --
>> 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
From: Stanislaw Gruszka <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 34 +++++++++++++++---------------
1 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 83554da..7130040 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4710,6 +4710,9 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
{
+ u8 rfcsr;
+ u32 reg;
+
rt2800_rfcsr_write(rt2x00dev, 0, 0x70);
rt2800_rfcsr_write(rt2x00dev, 1, 0x81);
rt2800_rfcsr_write(rt2x00dev, 2, 0xf1);
@@ -4741,6 +4744,20 @@ static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
rt2800_rfcsr_write(rt2x00dev, 29, 0x9b);
rt2800_rfcsr_write(rt2x00dev, 30, 0x09);
rt2800_rfcsr_write(rt2x00dev, 31, 0x10);
+
+ rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
+ rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
+
+ rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
+ rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
+ rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
+ rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
+ msleep(1);
+ rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
+ rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
+ rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
+ rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
}
static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
@@ -4990,23 +5007,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
return 0;
}
-
- if (rt2x00_rt(rt2x00dev, RT3572)) {
- rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
- rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
- rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
-
- rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
- rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
- rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
- rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
- msleep(1);
- rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
- rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
- rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
- rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
- }
-
/*
* Set RX Filter calibration for 20MHz and 40MHz
*/
--
1.7.4.4
(Resending as the message didn't seem to end up on the mailing list)
> Hi Stanislaw,
>
> Looks good to me. When you repost the series with all comments fixed, you can add my acked-by.
>
> Sent from my iPad
>
> On 9 apr. 2013, at 17:05, [email protected] wrote:
>
>> From: Stanislaw Gruszka <[email protected]>
>>
>> Signed-off-by: Stanislaw Gruszka <[email protected]>
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 34 +++++++++++++++---------------
>> 1 files changed, 17 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index 83554da..7130040 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -4710,6 +4710,9 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)
>>
>> static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
>> {
>> + u8 rfcsr;
>> + u32 reg;
>> +
>> rt2800_rfcsr_write(rt2x00dev, 0, 0x70);
>> rt2800_rfcsr_write(rt2x00dev, 1, 0x81);
>> rt2800_rfcsr_write(rt2x00dev, 2, 0xf1);
>> @@ -4741,6 +4744,20 @@ static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)
>> rt2800_rfcsr_write(rt2x00dev, 29, 0x9b);
>> rt2800_rfcsr_write(rt2x00dev, 30, 0x09);
>> rt2800_rfcsr_write(rt2x00dev, 31, 0x10);
>> +
>> + rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
>> + rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
>> + rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
>> +
>> + rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
>> + rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
>> + rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
>> + rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> + msleep(1);
>> + rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
>> + rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
>> + rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
>> + rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> }
>>
>> static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
>> @@ -4990,23 +5007,6 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
>> return 0;
>> }
>>
>> -
>> - if (rt2x00_rt(rt2x00dev, RT3572)) {
>> - rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
>> - rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1);
>> - rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
>> -
>> - rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
>> - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3);
>> - rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
>> - rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> - msleep(1);
>> - rt2800_register_read(rt2x00dev, LDO_CFG0, ®);
>> - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0);
>> - rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1);
>> - rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> - }
>> -
>> /*
>> * Set RX Filter calibration for 20MHz and 40MHz
>> */
>> --
>> 1.7.4.4
>>
>> --
>> 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