4 #include "r8192S_phyreg.h"
5 #include "r8192S_phy.h"
6 #include "r8192S_rtl8225.h"
8 /*---------------------Define local function prototype-----------------------*/
9 void phy_RF8225_Config_HardCode(struct net_device
* dev
);
10 bool phy_RF8225_Config_ParaFile(struct net_device
* dev
);
11 /*---------------------Define local function prototype-----------------------*/
12 void PHY_SetRF8225OfdmTxPower(struct net_device
* dev
,u8 powerlevel
)
19 void PHY_SetRF8225CckTxPower( struct net_device
* dev
, u8 powerlevel
)
25 // TODO: The following RF 022D related function should be removed to HalPhy0222D.c.
26 void PHY_SetRF0222DOfdmTxPower(struct net_device
* dev
,u8 powerlevel
)
28 //TODO: We should set RF TxPower for RF 0222D here!!
33 void PHY_SetRF0222DCckTxPower(struct net_device
* dev
,u8 powerlevel
)
35 //TODO: We should set RF TxPower for RF 0222D here!!
39 /*-----------------------------------------------------------------------------
40 * Function: PHY_SetRF0222DBandwidth()
42 * Overview: This function is called by SetBWModeCallback8190Pci() only
44 * Input: PADAPTER Adapter
45 * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M
51 * Note: For RF type 0222D
52 *---------------------------------------------------------------------------*/
54 void PHY_SetRF0222DBandwidth(struct net_device
* dev
, HT_CHANNEL_WIDTH Bandwidth
) //20M or 40M
57 struct r8192_priv
*priv
= ieee80211_priv(dev
);
60 //if (IS_HARDWARE_TYPE_8192S(dev))
63 #ifndef RTL92SE_FPGA_VERIFY
66 case HT_CHANNEL_WIDTH_20
:
67 #ifdef FIB_MODIFICATION
68 write_nic_byte(dev
, rFPGA0_AnalogParameter2
, 0x58);
70 rtl8192_phy_SetRFReg(dev
, (RF90_RADIO_PATH_E
)RF90_PATH_A
, RF_CHNLBW
, BIT10
|BIT11
, 0x01);
72 case HT_CHANNEL_WIDTH_20_40
:
73 #ifdef FIB_MODIFICATION
74 write_nic_byte(dev
, rFPGA0_AnalogParameter2
, 0x18);
76 rtl8192_phy_SetRFReg(dev
, (RF90_RADIO_PATH_E
)RF90_PATH_A
, RF_CHNLBW
, BIT10
|BIT11
, 0x00);
79 ;//RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth ));
86 for(eRFPath
= 0; eRFPath
<priv
->NumTotalRFPath
; eRFPath
++)
90 case HT_CHANNEL_WIDTH_20
:
91 //rtl8192_phy_SetRFReg(Adapter, (RF90_RADIO_PATH_E)RF90_PATH_A, RF_CHNLBW, (BIT10|BIT11), 0x01);
93 case HT_CHANNEL_WIDTH_20_40
:
94 //rtl8192_phy_SetRFReg(Adapter, (RF90_RADIO_PATH_E)RF90_PATH_A, RF_CHNLBW, (BIT10|BIT11), 0x00);
97 ;//RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth ));
106 // TODO: Aabove RF 022D related function should be removed to HalPhy0222D.c.
108 /*-----------------------------------------------------------------------------
109 * Function: PHY_SetRF8225Bandwidth()
111 * Overview: This function is called by SetBWModeCallback8190Pci() only
113 * Input: PADAPTER Adapter
114 * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M
120 * Note: 8225(zebra1) support 20M only
121 *---------------------------------------------------------------------------*/
123 void PHY_SetRF8225Bandwidth(struct net_device
* dev
,HT_CHANNEL_WIDTH Bandwidth
) //20M or 40M
126 struct r8192_priv
*priv
= ieee80211_priv(dev
);
128 //for(eRFPath = RF90_PATH_A; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
129 for(eRFPath
= 0; eRFPath
<priv
->NumTotalRFPath
; eRFPath
++)
133 case HT_CHANNEL_WIDTH_20
:
134 // TODO: Update the parameters here
136 case HT_CHANNEL_WIDTH_20_40
:
137 RT_TRACE(COMP_DBG
, "SetChannelBandwidth8190Pci():8225 does not support 40M mode\n");
140 RT_TRACE(COMP_DBG
, "PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth
);
149 bool PHY_RF8225_Config(struct net_device
* dev
)
151 struct r8192_priv
*priv
= ieee80211_priv(dev
);
152 bool rtStatus
= true;
153 //RF90_RADIO_PATH_E eRFPath;
154 //BB_REGISTER_DEFINITION_T *pPhyReg;
155 //u32 OrgStoreRFIntSW[RF90_PATH_D+1];
158 // Initialize general global value
160 // TODO: Extend RF_PATH_C and RF_PATH_D in the future
161 priv
->NumTotalRFPath
= 2;
166 //switch( Adapter->MgntInfo.bRegHwParaFile )
169 // phy_RF8225_Config_HardCode(dev);
173 // rtStatus = phy_RF8225_Config_ParaFile(dev);
178 phy_RF8225_Config_HardCode(dev
);
179 phy_RF8225_Config_ParaFile(dev
);
183 // phy_RF8225_Config_HardCode(dev);
191 void phy_RF8225_Config_HardCode(struct net_device
* dev
)
194 // Set Default Bandwidth to 20M
195 //Adapter->HalFunc .SetBWModeHandler(Adapter, HT_CHANNEL_WIDTH_20);
197 // TODO: Set Default Channel to channel one for RTL8225
202 bool phy_RF8225_Config_ParaFile(struct net_device
* dev
)
205 //static char szRadioAFile[] = RTL819X_PHY_RADIO_A;
206 //static char szRadioBFile[] = RTL819X_PHY_RADIO_B;
208 bool rtStatus
= true;
209 struct r8192_priv
*priv
= ieee80211_priv(dev
);
210 BB_REGISTER_DEFINITION_T
*pPhyReg
;
214 //3//-----------------------------------------------------------------
215 //3// <2> Initialize RF
216 //3//-----------------------------------------------------------------
217 //for(eRFPath = RF90_PATH_A; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
218 for(eRFPath
= 0; eRFPath
<priv
->NumTotalRFPath
; eRFPath
++)
221 pPhyReg
= &priv
->PHYRegDef
[eRFPath
];
223 /*----Store original RFENV control type----*/
228 u4RegValue
= rtl8192_QueryBBReg(dev
, pPhyReg
->rfintfs
, bRFSI_RFENV
);
232 u4RegValue
= rtl8192_QueryBBReg(dev
, pPhyReg
->rfintfs
, bRFSI_RFENV
<<16);
236 /*----Set RF_ENV enable----*/
237 rtl8192_setBBreg(dev
, pPhyReg
->rfintfe
, bRFSI_RFENV
<<16, 0x1);
239 /*----Set RF_ENV output high----*/
240 rtl8192_setBBreg(dev
, pPhyReg
->rfintfo
, bRFSI_RFENV
, 0x1);
242 /* Set bit number of Address and Data for RF register */
243 rtl8192_setBBreg(dev
, pPhyReg
->rfHSSIPara2
, b3WireAddressLength
, 0x0); // Set 1 to 4 bits for 8255
244 rtl8192_setBBreg(dev
, pPhyReg
->rfHSSIPara2
, b3WireDataLength
, 0x0); // Set 0 to 12 bits for 8255
247 /*----Initialize RF fom connfiguration file----*/
251 //rtStatus = PHY_ConfigRFWithParaFile(dev, (char* )&szRadioAFile, (RF90_RADIO_PATH_E)eRFPath);
252 rtStatus
= rtl8192_phy_ConfigRFWithHeaderFile(dev
,(RF90_RADIO_PATH_E
)eRFPath
);
255 //rtStatus = PHY_ConfigRFWithParaFile(dev, (char* )&szRadioBFile, (RF90_RADIO_PATH_E)eRFPath);
256 rtStatus
= rtl8192_phy_ConfigRFWithHeaderFile(dev
,(RF90_RADIO_PATH_E
)eRFPath
);
264 /*----Restore RFENV control type----*/;
269 rtl8192_setBBreg(dev
, pPhyReg
->rfintfs
, bRFSI_RFENV
, u4RegValue
);
273 rtl8192_setBBreg(dev
, pPhyReg
->rfintfs
, bRFSI_RFENV
<<16, u4RegValue
);
277 if(rtStatus
== false){
278 //RT_TRACE(COMP_FPGA, DBG_LOUD, ("phy_RF8225_Config_ParaFile():Radio[%d] Fail!!", eRFPath));
279 goto phy_RF8225_Config_ParaFile_Fail
;
284 //RT_TRACE(COMP_INIT, DBG_LOUD, ("<---phy_RF8225_Config_ParaFile()\n"));
287 phy_RF8225_Config_ParaFile_Fail
: