2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
31 Specific funcitons and variables for RT3070
35 -------- ---------- ----------------------------------------------
40 #include "../rt_config.h"
43 #ifndef RTMP_RF_RW_SUPPORT
44 #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
45 #endif // RTMP_RF_RW_SUPPORT //
48 VOID
NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd
)
51 // Driver must read EEPROM to get RfIcType before initial RF registers
52 // Initialize RF register to default value
55 // Init RF calibration
56 // Driver should toggle RF R30 bit7 before init RF registers
57 UINT32 RfReg
= 0, data
;
59 RT30xxReadRFRegister(pAd
, RF_R30
, (PUCHAR
)&RfReg
);
61 RT30xxWriteRFRegister(pAd
, RF_R30
, (UCHAR
)RfReg
);
64 RT30xxWriteRFRegister(pAd
, RF_R30
, (UCHAR
)RfReg
);
67 RT30xxWriteRFRegister(pAd
, RF_R24
, 0x0F);
68 RT30xxWriteRFRegister(pAd
, RF_R31
, 0x0F);
70 // RT309x version E has fixed this issue
71 if ((pAd
->NicConfig2
.field
.DACTestBit
== 1) && ((pAd
->MACVersion
& 0xffff) < 0x0211))
73 // patch tx EVM issue temporarily
74 RTMP_IO_READ32(pAd
, LDO_CFG0
, &data
);
75 data
= ((data
& 0xE0FFFFFF) | 0x0D000000);
76 RTMP_IO_WRITE32(pAd
, LDO_CFG0
, data
);
80 RTMP_IO_READ32(pAd
, LDO_CFG0
, &data
);
81 data
= ((data
& 0xE0FFFFFF) | 0x01000000);
82 RTMP_IO_WRITE32(pAd
, LDO_CFG0
, data
);
85 // patch LNA_PE_G1 failed issue
86 RTMP_IO_READ32(pAd
, GPIO_SWITCH
, &data
);
88 RTMP_IO_WRITE32(pAd
, GPIO_SWITCH
, data
);
90 // Initialize RF register to default value
91 for (i
= 0; i
< NUM_RF_REG_PARMS
; i
++)
93 RT30xxWriteRFRegister(pAd
, RT30xx_RFRegTable
[i
].Register
, RT30xx_RFRegTable
[i
].Value
);
96 // Driver should set RF R6 bit6 on before calibration
97 RT30xxReadRFRegister(pAd
, RF_R06
, (PUCHAR
)&RfReg
);
99 RT30xxWriteRFRegister(pAd
, RF_R06
, (UCHAR
)RfReg
);
101 //For RF filter Calibration
102 RTMPFilterCalibration(pAd
);
104 // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration()
105 if ((pAd
->MACVersion
& 0xffff) < 0x0211)
106 RT30xxWriteRFRegister(pAd
, RF_R27
, 0x3);
108 // set led open drain enable
109 RTMP_IO_READ32(pAd
, OPT_14
, &data
);
111 RTMP_IO_WRITE32(pAd
, OPT_14
, data
);
113 // set default antenna as main
114 if (pAd
->RfIcType
== RFIC_3020
)
115 AsicSetRxAnt(pAd
, pAd
->RxAnt
.Pair1PrimaryRxAnt
);
117 // add by johnli, RF power sequence setup, load RF normal operation-mode setup
118 RT30xxLoadRFNormalModeSetup(pAd
);