diff mbox

[04/11] rt2800: move 30xx common rf init code

Message ID 1365519930-3230-5-git-send-email-stf_xl@wp.pl (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Stanislaw Gruszka April 9, 2013, 3:05 p.m. UTC
From: Stanislaw Gruszka <stf_xl@wp.pl>

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
---
 drivers/net/wireless/rt2x00/rt2800lib.c |   62 ++++++++++++++++--------------
 1 files changed, 33 insertions(+), 29 deletions(-)

Comments

Gertjan van Wingerde April 14, 2013, 8:15 p.m. UTC | #1
(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, stf_xl@wp.pl wrote:
> 
>> From: Stanislaw Gruszka <stf_xl@wp.pl>
>> 
>> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
>> ---
>> 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, &reg);
>> +        rt2x00_set_field32(&reg, LDO_CFG0_BGSEL, 1);
>> +        rt2x00_set_field32(&reg, 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, &reg);
>> +        rt2x00_set_field32(&reg, 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(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 3);
>> +            else
>> +                rt2x00_set_field32(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 0);
>> +        }
>> +        rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> +
>> +        rt2800_register_read(rt2x00dev, GPIO_SWITCH, &reg);
>> +        rt2x00_set_field32(&reg, 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, &reg);
>> -        rt2x00_set_field32(&reg, LDO_CFG0_BGSEL, 1);
>> -        rt2x00_set_field32(&reg, 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, &reg);
>> -        rt2x00_set_field32(&reg, 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(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 3);
>> -            else
>> -                rt2x00_set_field32(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 0);
>> -        }
>> -        rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
>> 
>> -        rt2800_register_read(rt2x00dev, GPIO_SWITCH, &reg);
>> -        rt2x00_set_field32(&reg, 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, &reg);
>>       rt2x00_set_field32(&reg, 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 majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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
diff mbox

Patch

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, &reg);
+		rt2x00_set_field32(&reg, LDO_CFG0_BGSEL, 1);
+		rt2x00_set_field32(&reg, 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, &reg);
+		rt2x00_set_field32(&reg, 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(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 3);
+			else
+				rt2x00_set_field32(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 0);
+		}
+		rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
+
+		rt2800_register_read(rt2x00dev, GPIO_SWITCH, &reg);
+		rt2x00_set_field32(&reg, 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, &reg);
-		rt2x00_set_field32(&reg, LDO_CFG0_BGSEL, 1);
-		rt2x00_set_field32(&reg, 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, &reg);
-		rt2x00_set_field32(&reg, 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(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 3);
-			else
-				rt2x00_set_field32(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 0);
-		}
-		rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
 
-		rt2800_register_read(rt2x00dev, GPIO_SWITCH, &reg);
-		rt2x00_set_field32(&reg, 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, &reg);
 		rt2x00_set_field32(&reg, GPIO_SWITCH_5, 0);
 		rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg);