diff options
author | Stanislaw Gruszka <stf_xl@wp.pl> | 2013-04-17 08:08:13 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-04-22 15:20:16 -0400 |
commit | c9a221b24aee23220b02eef68a7b9e392a5a864a (patch) | |
tree | ad50f4665e2b99cfbe5b415af0f180092b110df4 | |
parent | f9cdcbb133e6976501449dcae52e809f1cb516ce (diff) |
rt2800: move 30xx common rf init code
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 40a37fe58262..0ad2e9d7b3f7 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -4478,6 +4478,10 @@ static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev) | |||
4478 | 4478 | ||
4479 | static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev) | 4479 | static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev) |
4480 | { | 4480 | { |
4481 | u8 rfcsr; | ||
4482 | u16 eeprom; | ||
4483 | u32 reg; | ||
4484 | |||
4481 | /* XXX vendor driver do this only for 3070 */ | 4485 | /* XXX vendor driver do this only for 3070 */ |
4482 | rt2800_rf_init_calibration(rt2x00dev, 30); | 4486 | rt2800_rf_init_calibration(rt2x00dev, 30); |
4483 | 4487 | ||
@@ -4500,6 +4504,36 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev) | |||
4500 | rt2800_rfcsr_write(rt2x00dev, 24, 0x16); | 4504 | rt2800_rfcsr_write(rt2x00dev, 24, 0x16); |
4501 | rt2800_rfcsr_write(rt2x00dev, 25, 0x01); | 4505 | rt2800_rfcsr_write(rt2x00dev, 25, 0x01); |
4502 | rt2800_rfcsr_write(rt2x00dev, 29, 0x1f); | 4506 | rt2800_rfcsr_write(rt2x00dev, 29, 0x1f); |
4507 | |||
4508 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { | ||
4509 | rt2800_register_read(rt2x00dev, LDO_CFG0, ®); | ||
4510 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); | ||
4511 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); | ||
4512 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); | ||
4513 | } else if (rt2x00_rt(rt2x00dev, RT3071) || | ||
4514 | rt2x00_rt(rt2x00dev, RT3090)) { | ||
4515 | rt2800_rfcsr_write(rt2x00dev, 31, 0x14); | ||
4516 | |||
4517 | rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); | ||
4518 | rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); | ||
4519 | rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); | ||
4520 | |||
4521 | rt2800_register_read(rt2x00dev, LDO_CFG0, ®); | ||
4522 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); | ||
4523 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || | ||
4524 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) { | ||
4525 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); | ||
4526 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST)) | ||
4527 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); | ||
4528 | else | ||
4529 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); | ||
4530 | } | ||
4531 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); | ||
4532 | |||
4533 | rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); | ||
4534 | rt2x00_set_field32(®, GPIO_SWITCH_5, 0); | ||
4535 | rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); | ||
4536 | } | ||
4503 | } | 4537 | } |
4504 | 4538 | ||
4505 | static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev) | 4539 | static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev) |
@@ -4954,35 +4988,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
4954 | return 0; | 4988 | return 0; |
4955 | } | 4989 | } |
4956 | 4990 | ||
4957 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { | ||
4958 | rt2800_register_read(rt2x00dev, LDO_CFG0, ®); | ||
4959 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); | ||
4960 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); | ||
4961 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); | ||
4962 | } else if (rt2x00_rt(rt2x00dev, RT3071) || | ||
4963 | rt2x00_rt(rt2x00dev, RT3090)) { | ||
4964 | rt2800_rfcsr_write(rt2x00dev, 31, 0x14); | ||
4965 | |||
4966 | rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); | ||
4967 | rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); | ||
4968 | rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); | ||
4969 | 4991 | ||
4970 | rt2800_register_read(rt2x00dev, LDO_CFG0, ®); | 4992 | if (rt2x00_rt(rt2x00dev, RT3390)) { |
4971 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); | ||
4972 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || | ||
4973 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) { | ||
4974 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); | ||
4975 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST)) | ||
4976 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); | ||
4977 | else | ||
4978 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); | ||
4979 | } | ||
4980 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); | ||
4981 | |||
4982 | rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); | ||
4983 | rt2x00_set_field32(®, GPIO_SWITCH_5, 0); | ||
4984 | rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); | ||
4985 | } else if (rt2x00_rt(rt2x00dev, RT3390)) { | ||
4986 | rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); | 4993 | rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); |
4987 | rt2x00_set_field32(®, GPIO_SWITCH_5, 0); | 4994 | rt2x00_set_field32(®, GPIO_SWITCH_5, 0); |
4988 | rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); | 4995 | rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); |