diff options
author | Stanislaw Gruszka <stf_xl@wp.pl> | 2013-03-16 14:19:46 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-03-18 16:38:34 -0400 |
commit | c630ccf1a127578421a928489d51e99c05037054 (patch) | |
tree | 5f16458f2f044270ac5df8b4f0a43c2dcfea346b /drivers/net/wireless/rt2x00 | |
parent | 8756130bf3fb9e4adc96bb6bc4774573e261c5b7 (diff) |
rt2800: rearrange bbp/rfcsr initialization
This makes order of initialization of various registers similar like
on vendor driver.
Based on:
NICInitializeAsic()
RT5592LoadRFNormalModeSetup()
from:
DPO_RT5572_LinuxSTA_2.6.1.3_20121022/common/rtmp_init.c
DPO_RT5572_LinuxSTA_2.6.1.3_20121022/chip/rt5592.c
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index e96ea3298c7c..e36cf4a233fe 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -4713,6 +4713,9 @@ static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev) | |||
4713 | 4713 | ||
4714 | static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev) | 4714 | static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev) |
4715 | { | 4715 | { |
4716 | u8 reg; | ||
4717 | u16 eeprom; | ||
4718 | |||
4716 | rt2800_rfcsr_write(rt2x00dev, 1, 0x3F); | 4719 | rt2800_rfcsr_write(rt2x00dev, 1, 0x3F); |
4717 | rt2800_rfcsr_write(rt2x00dev, 3, 0x08); | 4720 | rt2800_rfcsr_write(rt2x00dev, 3, 0x08); |
4718 | rt2800_rfcsr_write(rt2x00dev, 3, 0x08); | 4721 | rt2800_rfcsr_write(rt2x00dev, 3, 0x08); |
@@ -4740,6 +4743,35 @@ static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev) | |||
4740 | msleep(1); | 4743 | msleep(1); |
4741 | 4744 | ||
4742 | rt2800_adjust_freq_offset(rt2x00dev); | 4745 | rt2800_adjust_freq_offset(rt2x00dev); |
4746 | |||
4747 | rt2800_bbp_read(rt2x00dev, 138, ®); | ||
4748 | |||
4749 | /* Turn off unused DAC1 and ADC1 to reduce power consumption */ | ||
4750 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); | ||
4751 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) | ||
4752 | rt2x00_set_field8(®, BBP138_RX_ADC1, 0); | ||
4753 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1) | ||
4754 | rt2x00_set_field8(®, BBP138_TX_DAC1, 1); | ||
4755 | |||
4756 | rt2800_bbp_write(rt2x00dev, 138, reg); | ||
4757 | |||
4758 | /* Enable DC filter */ | ||
4759 | if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) | ||
4760 | rt2800_bbp_write(rt2x00dev, 103, 0xc0); | ||
4761 | |||
4762 | rt2800_rfcsr_read(rt2x00dev, 38, ®); | ||
4763 | rt2x00_set_field8(®, RFCSR38_RX_LO1_EN, 0); | ||
4764 | rt2800_rfcsr_write(rt2x00dev, 38, reg); | ||
4765 | |||
4766 | rt2800_rfcsr_read(rt2x00dev, 39, ®); | ||
4767 | rt2x00_set_field8(®, RFCSR39_RX_LO2_EN, 0); | ||
4768 | rt2800_rfcsr_write(rt2x00dev, 39, reg); | ||
4769 | |||
4770 | rt2800_bbp4_mac_if_ctrl(rt2x00dev); | ||
4771 | |||
4772 | rt2800_rfcsr_read(rt2x00dev, 30, ®); | ||
4773 | rt2x00_set_field8(®, RFCSR30_RX_VCM, 2); | ||
4774 | rt2800_rfcsr_write(rt2x00dev, 30, reg); | ||
4743 | } | 4775 | } |
4744 | 4776 | ||
4745 | static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | 4777 | static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) |
@@ -4817,7 +4849,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
4817 | break; | 4849 | break; |
4818 | case RT5592: | 4850 | case RT5592: |
4819 | rt2800_init_rfcsr_5592(rt2x00dev); | 4851 | rt2800_init_rfcsr_5592(rt2x00dev); |
4820 | break; | 4852 | return 0; |
4821 | } | 4853 | } |
4822 | 4854 | ||
4823 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { | 4855 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { |
@@ -5024,15 +5056,23 @@ int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
5024 | * Initialize all registers. | 5056 | * Initialize all registers. |
5025 | */ | 5057 | */ |
5026 | if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || | 5058 | if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || |
5027 | rt2800_init_registers(rt2x00dev) || | 5059 | rt2800_init_registers(rt2x00dev))) |
5028 | rt2800_init_bbp(rt2x00dev) || | ||
5029 | rt2800_init_rfcsr(rt2x00dev))) | ||
5030 | return -EIO; | 5060 | return -EIO; |
5031 | 5061 | ||
5032 | /* | 5062 | /* |
5033 | * Send signal to firmware during boot time. | 5063 | * Send signal to firmware during boot time. |
5034 | */ | 5064 | */ |
5035 | rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); | 5065 | rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); |
5066 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); | ||
5067 | if (rt2x00_is_usb(rt2x00dev)) { | ||
5068 | rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); | ||
5069 | rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); | ||
5070 | } | ||
5071 | msleep(1); | ||
5072 | |||
5073 | if (unlikely(rt2800_init_bbp(rt2x00dev) || | ||
5074 | rt2800_init_rfcsr(rt2x00dev))) | ||
5075 | return -EIO; | ||
5036 | 5076 | ||
5037 | if (rt2x00_is_usb(rt2x00dev) && | 5077 | if (rt2x00_is_usb(rt2x00dev) && |
5038 | (rt2x00_rt(rt2x00dev, RT3070) || | 5078 | (rt2x00_rt(rt2x00dev, RT3070) || |