aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/rtl8192u/r819xU_phy.c178
1 files changed, 89 insertions, 89 deletions
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c
index 787090adfa46..387d137ec9ff 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -73,100 +73,100 @@ u8 rtl8192_phy_CheckIsLegalRFPath(struct net_device *dev, u32 eRFPath)
73/****************************************************************************** 73/******************************************************************************
74 *function: This function set specific bits to BB register 74 *function: This function set specific bits to BB register
75 * input: net_device dev 75 * input: net_device dev
76 * u32 dwRegAddr //target addr to be modified 76 * u32 reg_addr //target addr to be modified
77 * u32 bitmask //taget bit pos in the addr to be modified 77 * u32 bitmask //taget bit pos in the addr to be modified
78 * u32 dwData //value to be write 78 * u32 data //value to be write
79 * output: none 79 * output: none
80 * return: none 80 * return: none
81 * notice: 81 * notice:
82 * ****************************************************************************/ 82 * ****************************************************************************/
83void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr, u32 bitmask, 83void rtl8192_setBBreg(struct net_device *dev, u32 reg_addr, u32 bitmask,
84 u32 dwData) 84 u32 data)
85{ 85{
86 86
87 u32 reg, BitShift; 87 u32 reg, bitshift;
88 88
89 if (bitmask != bMaskDWord) { //if not "double word" write 89 if (bitmask != bMaskDWord) { //if not "double word" write
90 read_nic_dword(dev, dwRegAddr, &reg); 90 read_nic_dword(dev, reg_addr, &reg);
91 BitShift = rtl8192_CalculateBitShift(bitmask); 91 bitshift = rtl8192_CalculateBitShift(bitmask);
92 reg &= ~bitmask; 92 reg &= ~bitmask;
93 reg |= dwData << BitShift; 93 reg |= data << bitshift;
94 write_nic_dword(dev, dwRegAddr, reg); 94 write_nic_dword(dev, reg_addr, reg);
95 } else { 95 } else {
96 write_nic_dword(dev, dwRegAddr, dwData); 96 write_nic_dword(dev, reg_addr, data);
97 } 97 }
98 return; 98 return;
99} 99}
100/****************************************************************************** 100/******************************************************************************
101 *function: This function reads specific bits from BB register 101 *function: This function reads specific bits from BB register
102 * input: net_device dev 102 * input: net_device dev
103 * u32 dwRegAddr //target addr to be readback 103 * u32 reg_addr //target addr to be readback
104 * u32 bitmask //taget bit pos in the addr to be readback 104 * u32 bitmask //taget bit pos in the addr to be readback
105 * output: none 105 * output: none
106 * return: u32 Data //the readback register value 106 * return: u32 data //the readback register value
107 * notice: 107 * notice:
108 * ****************************************************************************/ 108 * ****************************************************************************/
109u32 rtl8192_QueryBBReg(struct net_device *dev, u32 dwRegAddr, u32 bitmask) 109u32 rtl8192_QueryBBReg(struct net_device *dev, u32 reg_addr, u32 bitmask)
110{ 110{
111 u32 Ret = 0, reg, BitShift; 111 u32 Ret = 0, reg, bitshift;
112 112
113 read_nic_dword(dev, dwRegAddr, &reg); 113 read_nic_dword(dev, reg_addr, &reg);
114 BitShift = rtl8192_CalculateBitShift(bitmask); 114 bitshift = rtl8192_CalculateBitShift(bitmask);
115 Ret = (reg & bitmask) >> BitShift; 115 Ret = (reg & bitmask) >> bitshift;
116 116
117 return Ret; 117 return Ret;
118} 118}
119static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, 119static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
120 u32 Offset); 120 u32 offset);
121 121
122static void phy_FwRFSerialWrite(struct net_device *dev, 122static void phy_FwRFSerialWrite(struct net_device *dev,
123 RF90_RADIO_PATH_E eRFPath, u32 Offset, 123 RF90_RADIO_PATH_E eRFPath, u32 offset,
124 u32 Data); 124 u32 data);
125 125
126/****************************************************************************** 126/******************************************************************************
127 *function: This function read register from RF chip 127 *function: This function read register from RF chip
128 * input: net_device dev 128 * input: net_device dev
129 * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D 129 * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D
130 * u32 Offset //target address to be read 130 * u32 offset //target address to be read
131 * output: none 131 * output: none
132 * return: u32 readback value 132 * return: u32 readback value
133 * notice: There are three types of serial operations:(1) Software serial write.(2)Hardware LSSI-Low Speed Serial Interface.(3)Hardware HSSI-High speed serial write. Driver here need to implement (1) and (2)---need more spec for this information. 133 * notice: There are three types of serial operations:(1) Software serial write.(2)Hardware LSSI-Low Speed Serial Interface.(3)Hardware HSSI-High speed serial write. Driver here need to implement (1) and (2)---need more spec for this information.
134 * ****************************************************************************/ 134 * ****************************************************************************/
135u32 rtl8192_phy_RFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, 135u32 rtl8192_phy_RFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
136 u32 Offset) 136 u32 offset)
137{ 137{
138 struct r8192_priv *priv = ieee80211_priv(dev); 138 struct r8192_priv *priv = ieee80211_priv(dev);
139 u32 ret = 0; 139 u32 ret = 0;
140 u32 NewOffset = 0; 140 u32 new_offset = 0;
141 BB_REGISTER_DEFINITION_T *pPhyReg = &priv->PHYRegDef[eRFPath]; 141 BB_REGISTER_DEFINITION_T *pPhyReg = &priv->PHYRegDef[eRFPath];
142 rtl8192_setBBreg(dev, pPhyReg->rfLSSIReadBack, bLSSIReadBackData, 0); 142 rtl8192_setBBreg(dev, pPhyReg->rfLSSIReadBack, bLSSIReadBackData, 0);
143 //make sure RF register offset is correct 143 //make sure RF register offset is correct
144 Offset &= 0x3f; 144 offset &= 0x3f;
145 145
146 //switch page for 8256 RF IC 146 //switch page for 8256 RF IC
147 if (priv->rf_chip == RF_8256) { 147 if (priv->rf_chip == RF_8256) {
148 if (Offset >= 31) { 148 if (offset >= 31) {
149 priv->RfReg0Value[eRFPath] |= 0x140; 149 priv->RfReg0Value[eRFPath] |= 0x140;
150 //Switch to Reg_Mode2 for Reg 31-45 150 //Switch to Reg_Mode2 for Reg 31-45
151 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath]<<16)); 151 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath]<<16));
152 //modify offset 152 //modify offset
153 NewOffset = Offset -30; 153 new_offset = offset - 30;
154 } else if (Offset >= 16) { 154 } else if (offset >= 16) {
155 priv->RfReg0Value[eRFPath] |= 0x100; 155 priv->RfReg0Value[eRFPath] |= 0x100;
156 priv->RfReg0Value[eRFPath] &= (~0x40); 156 priv->RfReg0Value[eRFPath] &= (~0x40);
157 //Switch to Reg_Mode 1 for Reg16-30 157 //Switch to Reg_Mode 1 for Reg16-30
158 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath]<<16)); 158 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath]<<16));
159 159
160 NewOffset = Offset - 15; 160 new_offset = offset - 15;
161 } else { 161 } else {
162 NewOffset = Offset; 162 new_offset = offset;
163 } 163 }
164 } else { 164 } else {
165 RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need to be 8256\n"); 165 RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need to be 8256\n");
166 NewOffset = Offset; 166 new_offset = offset;
167 } 167 }
168 //put desired read addr to LSSI control Register 168 //put desired read addr to LSSI control Register
169 rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadAddress, NewOffset); 169 rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadAddress, new_offset);
170 //Issue a posedge trigger 170 //Issue a posedge trigger
171 // 171 //
172 rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadEdge, 0x0); 172 rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadEdge, 0x0);
@@ -198,8 +198,8 @@ u32 rtl8192_phy_RFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
198 *function: This function write data to RF register 198 *function: This function write data to RF register
199 * input: net_device dev 199 * input: net_device dev
200 * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D 200 * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D
201 * u32 Offset //target address to be written 201 * u32 offset //target address to be written
202 * u32 Data //The new register data to be written 202 * u32 data //The new register data to be written
203 * output: none 203 * output: none
204 * return: none 204 * return: none
205 * notice: For RF8256 only. 205 * notice: For RF8256 only.
@@ -215,45 +215,45 @@ u32 rtl8192_phy_RFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
215 *------------------------------------------------------------------ 215 *------------------------------------------------------------------
216 * ****************************************************************************/ 216 * ****************************************************************************/
217void rtl8192_phy_RFSerialWrite(struct net_device *dev, 217void rtl8192_phy_RFSerialWrite(struct net_device *dev,
218 RF90_RADIO_PATH_E eRFPath, u32 Offset, u32 Data) 218 RF90_RADIO_PATH_E eRFPath, u32 offset, u32 data)
219{ 219{
220 struct r8192_priv *priv = ieee80211_priv(dev); 220 struct r8192_priv *priv = ieee80211_priv(dev);
221 u32 DataAndAddr = 0, NewOffset = 0; 221 u32 DataAndAddr = 0, new_offset = 0;
222 BB_REGISTER_DEFINITION_T *pPhyReg = &priv->PHYRegDef[eRFPath]; 222 BB_REGISTER_DEFINITION_T *pPhyReg = &priv->PHYRegDef[eRFPath];
223 223
224 Offset &= 0x3f; 224 offset &= 0x3f;
225 if (priv->rf_chip == RF_8256) { 225 if (priv->rf_chip == RF_8256) {
226 226
227 if (Offset >= 31) { 227 if (offset >= 31) {
228 priv->RfReg0Value[eRFPath] |= 0x140; 228 priv->RfReg0Value[eRFPath] |= 0x140;
229 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath] << 16)); 229 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath] << 16));
230 NewOffset = Offset - 30; 230 new_offset = offset - 30;
231 } else if (Offset >= 16) { 231 } else if (offset >= 16) {
232 priv->RfReg0Value[eRFPath] |= 0x100; 232 priv->RfReg0Value[eRFPath] |= 0x100;
233 priv->RfReg0Value[eRFPath] &= (~0x40); 233 priv->RfReg0Value[eRFPath] &= (~0x40);
234 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath]<<16)); 234 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath]<<16));
235 NewOffset = Offset - 15; 235 new_offset = offset - 15;
236 } else { 236 } else {
237 NewOffset = Offset; 237 new_offset = offset;
238 } 238 }
239 } else { 239 } else {
240 RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need to be 8256\n"); 240 RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need to be 8256\n");
241 NewOffset = Offset; 241 new_offset = offset;
242 } 242 }
243 243
244 // Put write addr in [5:0] and write data in [31:16] 244 // Put write addr in [5:0] and write data in [31:16]
245 DataAndAddr = (Data<<16) | (NewOffset&0x3f); 245 DataAndAddr = (data<<16) | (new_offset&0x3f);
246 246
247 // Write Operation 247 // Write Operation
248 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr); 248 rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr);
249 249
250 250
251 if (Offset == 0x0) 251 if (offset == 0x0)
252 priv->RfReg0Value[eRFPath] = Data; 252 priv->RfReg0Value[eRFPath] = data;
253 253
254 // Switch back to Reg_Mode0; 254 // Switch back to Reg_Mode0;
255 if (priv->rf_chip == RF_8256) { 255 if (priv->rf_chip == RF_8256) {
256 if (Offset != 0) { 256 if (offset != 0) {
257 priv->RfReg0Value[eRFPath] &= 0xebf; 257 priv->RfReg0Value[eRFPath] &= 0xebf;
258 rtl8192_setBBreg( 258 rtl8192_setBBreg(
259 dev, 259 dev,
@@ -269,46 +269,46 @@ void rtl8192_phy_RFSerialWrite(struct net_device *dev,
269 *function: This function set specific bits to RF register 269 *function: This function set specific bits to RF register
270 * input: net_device dev 270 * input: net_device dev
271 * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D 271 * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D
272 * u32 RegAddr //target addr to be modified 272 * u32 reg_addr //target addr to be modified
273 * u32 bitmask //taget bit pos in the addr to be modified 273 * u32 bitmask //taget bit pos in the addr to be modified
274 * u32 Data //value to be write 274 * u32 data //value to be write
275 * output: none 275 * output: none
276 * return: none 276 * return: none
277 * notice: 277 * notice:
278 * ****************************************************************************/ 278 * ****************************************************************************/
279void rtl8192_phy_SetRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, 279void rtl8192_phy_SetRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
280 u32 RegAddr, u32 bitmask, u32 Data) 280 u32 reg_addr, u32 bitmask, u32 data)
281{ 281{
282 struct r8192_priv *priv = ieee80211_priv(dev); 282 struct r8192_priv *priv = ieee80211_priv(dev);
283 u32 reg, BitShift; 283 u32 reg, bitshift;
284 284
285 if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) 285 if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath))
286 return; 286 return;
287 287
288 if (priv->Rf_Mode == RF_OP_By_FW) { 288 if (priv->Rf_Mode == RF_OP_By_FW) {
289 if (bitmask != bMask12Bits) { // RF data is 12 bits only 289 if (bitmask != bMask12Bits) { // RF data is 12 bits only
290 reg = phy_FwRFSerialRead(dev, eRFPath, RegAddr); 290 reg = phy_FwRFSerialRead(dev, eRFPath, reg_addr);
291 BitShift = rtl8192_CalculateBitShift(bitmask); 291 bitshift = rtl8192_CalculateBitShift(bitmask);
292 reg &= ~bitmask; 292 reg &= ~bitmask;
293 reg |= Data << BitShift; 293 reg |= data << bitshift;
294 294
295 phy_FwRFSerialWrite(dev, eRFPath, RegAddr, reg); 295 phy_FwRFSerialWrite(dev, eRFPath, reg_addr, reg);
296 } else { 296 } else {
297 phy_FwRFSerialWrite(dev, eRFPath, RegAddr, Data); 297 phy_FwRFSerialWrite(dev, eRFPath, reg_addr, data);
298 } 298 }
299 299
300 udelay(200); 300 udelay(200);
301 301
302 } else { 302 } else {
303 if (bitmask != bMask12Bits) { // RF data is 12 bits only 303 if (bitmask != bMask12Bits) { // RF data is 12 bits only
304 reg = rtl8192_phy_RFSerialRead(dev, eRFPath, RegAddr); 304 reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr);
305 BitShift = rtl8192_CalculateBitShift(bitmask); 305 bitshift = rtl8192_CalculateBitShift(bitmask);
306 reg &= ~bitmask; 306 reg &= ~bitmask;
307 reg |= Data << BitShift; 307 reg |= data << bitshift;
308 308
309 rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, reg); 309 rtl8192_phy_RFSerialWrite(dev, eRFPath, reg_addr, reg);
310 } else { 310 } else {
311 rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, Data); 311 rtl8192_phy_RFSerialWrite(dev, eRFPath, reg_addr, data);
312 } 312 }
313 } 313 }
314 return; 314 return;
@@ -317,31 +317,31 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
317/****************************************************************************** 317/******************************************************************************
318 *function: This function reads specific bits from RF register 318 *function: This function reads specific bits from RF register
319 * input: net_device dev 319 * input: net_device dev
320 * u32 RegAddr //target addr to be readback 320 * u32 reg_addr //target addr to be readback
321 * u32 bitmask //taget bit pos in the addr to be readback 321 * u32 bitmask //taget bit pos in the addr to be readback
322 * output: none 322 * output: none
323 * return: u32 Data //the readback register value 323 * return: u32 data //the readback register value
324 * notice: 324 * notice:
325 * ****************************************************************************/ 325 * ****************************************************************************/
326u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, 326u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
327 u32 RegAddr, u32 bitmask) 327 u32 reg_addr, u32 bitmask)
328{ 328{
329 u32 reg, BitShift; 329 u32 reg, bitshift;
330 struct r8192_priv *priv = ieee80211_priv(dev); 330 struct r8192_priv *priv = ieee80211_priv(dev);
331 331
332 332
333 if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) 333 if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath))
334 return 0; 334 return 0;
335 if (priv->Rf_Mode == RF_OP_By_FW) { 335 if (priv->Rf_Mode == RF_OP_By_FW) {
336 reg = phy_FwRFSerialRead(dev, eRFPath, RegAddr); 336 reg = phy_FwRFSerialRead(dev, eRFPath, reg_addr);
337 BitShift = rtl8192_CalculateBitShift(bitmask); 337 bitshift = rtl8192_CalculateBitShift(bitmask);
338 reg = (reg & bitmask) >> BitShift; 338 reg = (reg & bitmask) >> bitshift;
339 udelay(200); 339 udelay(200);
340 return reg; 340 return reg;
341 } else { 341 } else {
342 reg = rtl8192_phy_RFSerialRead(dev, eRFPath, RegAddr); 342 reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr);
343 BitShift = rtl8192_CalculateBitShift(bitmask); 343 bitshift = rtl8192_CalculateBitShift(bitmask);
344 reg = (reg & bitmask) >> BitShift; 344 reg = (reg & bitmask) >> bitshift;
345 return reg; 345 return reg;
346 } 346 }
347} 347}
@@ -353,10 +353,10 @@ u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
353 * notice: 353 * notice:
354 * ***************************************************************************/ 354 * ***************************************************************************/
355static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, 355static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
356 u32 Offset) 356 u32 offset)
357{ 357{
358 u32 reg = 0; 358 u32 reg = 0;
359 u32 Data = 0; 359 u32 data = 0;
360 u8 time = 0; 360 u8 time = 0;
361 u32 tmp; 361 u32 tmp;
362 /* 2007/11/02 MH Firmware RF Write control. By Francis' suggestion, we can 362 /* 2007/11/02 MH Firmware RF Write control. By Francis' suggestion, we can
@@ -364,12 +364,12 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
364 much time. This is only for site survey. */ 364 much time. This is only for site survey. */
365 // 1. Read operation need not insert data. bit 0-11 365 // 1. Read operation need not insert data. bit 0-11
366 // 2. Write RF register address. Bit 12-19 366 // 2. Write RF register address. Bit 12-19
367 Data |= ((Offset&0xFF)<<12); 367 data |= ((offset&0xFF)<<12);
368 // 3. Write RF path. bit 20-21 368 // 3. Write RF path. bit 20-21
369 Data |= ((eRFPath&0x3)<<20); 369 data |= ((eRFPath&0x3)<<20);
370 // 4. Set RF read indicator. bit 22=0 370 // 4. Set RF read indicator. bit 22=0
371 // 5. Trigger Fw to operate the command. bit 31 371 // 5. Trigger Fw to operate the command. bit 31
372 Data |= 0x80000000; 372 data |= 0x80000000;
373 // 6. We can not execute read operation if bit 31 is 1. 373 // 6. We can not execute read operation if bit 31 is 1.
374 read_nic_dword(dev, QPNR, &tmp); 374 read_nic_dword(dev, QPNR, &tmp);
375 while (tmp & 0x80000000) { 375 while (tmp & 0x80000000) {
@@ -382,7 +382,7 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
382 } 382 }
383 } 383 }
384 // 7. Execute read operation. 384 // 7. Execute read operation.
385 write_nic_dword(dev, QPNR, Data); 385 write_nic_dword(dev, QPNR, data);
386 // 8. Check if firmawre send back RF content. 386 // 8. Check if firmawre send back RF content.
387 read_nic_dword(dev, QPNR, &tmp); 387 read_nic_dword(dev, QPNR, &tmp);
388 while (tmp & 0x80000000) { 388 while (tmp & 0x80000000) {
@@ -408,7 +408,7 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
408 * notice: 408 * notice:
409 * ***************************************************************************/ 409 * ***************************************************************************/
410static void phy_FwRFSerialWrite(struct net_device *dev, 410static void phy_FwRFSerialWrite(struct net_device *dev,
411 RF90_RADIO_PATH_E eRFPath, u32 Offset, u32 Data) 411 RF90_RADIO_PATH_E eRFPath, u32 offset, u32 data)
412{ 412{
413 u8 time = 0; 413 u8 time = 0;
414 u32 tmp; 414 u32 tmp;
@@ -419,13 +419,13 @@ static void phy_FwRFSerialWrite(struct net_device *dev,
419 419
420 // 1. Set driver write bit and 12 bit data. bit 0-11 420 // 1. Set driver write bit and 12 bit data. bit 0-11
421 // 2. Write RF register address. bit 12-19 421 // 2. Write RF register address. bit 12-19
422 Data |= ((Offset&0xFF)<<12); 422 data |= ((offset&0xFF)<<12);
423 // 3. Write RF path. bit 20-21 423 // 3. Write RF path. bit 20-21
424 Data |= ((eRFPath&0x3)<<20); 424 data |= ((eRFPath&0x3)<<20);
425 // 4. Set RF write indicator. bit 22=1 425 // 4. Set RF write indicator. bit 22=1
426 Data |= 0x400000; 426 data |= 0x400000;
427 // 5. Trigger Fw to operate the command. bit 31=1 427 // 5. Trigger Fw to operate the command. bit 31=1
428 Data |= 0x80000000; 428 data |= 0x80000000;
429 429
430 // 6. Write operation. We can not write if bit 31 is 1. 430 // 6. Write operation. We can not write if bit 31 is 1.
431 read_nic_dword(dev, QPNR, &tmp); 431 read_nic_dword(dev, QPNR, &tmp);
@@ -440,7 +440,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev,
440 } 440 }
441 // 7. No matter check bit. We always force the write. Because FW will 441 // 7. No matter check bit. We always force the write. Because FW will
442 // not accept the command. 442 // not accept the command.
443 write_nic_dword(dev, QPNR, Data); 443 write_nic_dword(dev, QPNR, data);
444 /* 2007/11/02 MH Acoording to test, we must delay 20us to wait firmware 444 /* 2007/11/02 MH Acoording to test, we must delay 20us to wait firmware
445 to finish RF write operation. */ 445 to finish RF write operation. */
446 /* 2008/01/17 MH We support delay in firmware side now. */ 446 /* 2008/01/17 MH We support delay in firmware side now. */
@@ -1517,15 +1517,15 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev)
1517/****************************************************************************** 1517/******************************************************************************
1518 *function: This function schedules bandwidth switch work. 1518 *function: This function schedules bandwidth switch work.
1519 * input: struct net_device *dev 1519 * input: struct net_device *dev
1520 * HT_CHANNEL_WIDTH Bandwidth //20M or 40M 1520 * HT_CHANNEL_WIDTH bandwidth //20M or 40M
1521 * HT_EXTCHNL_OFFSET Offset //Upper, Lower, or Don't care 1521 * HT_EXTCHNL_OFFSET offset //Upper, Lower, or Don't care
1522 * output: none 1522 * output: none
1523 * return: none 1523 * return: none
1524 * Note: I doubt whether SetBWModeInProgress flag is necessary as we can 1524 * Note: I doubt whether SetBWModeInProgress flag is necessary as we can
1525 * test whether current work in the queue or not.//do I? 1525 * test whether current work in the queue or not.//do I?
1526 * ***************************************************************************/ 1526 * ***************************************************************************/
1527void rtl8192_SetBWMode(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth, 1527void rtl8192_SetBWMode(struct net_device *dev, HT_CHANNEL_WIDTH bandwidth,
1528 HT_EXTCHNL_OFFSET Offset) 1528 HT_EXTCHNL_OFFSET offset)
1529{ 1529{
1530 struct r8192_priv *priv = ieee80211_priv(dev); 1530 struct r8192_priv *priv = ieee80211_priv(dev);
1531 1531
@@ -1533,11 +1533,11 @@ void rtl8192_SetBWMode(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth,
1533 return; 1533 return;
1534 priv->SetBWModeInProgress = true; 1534 priv->SetBWModeInProgress = true;
1535 1535
1536 priv->CurrentChannelBW = Bandwidth; 1536 priv->CurrentChannelBW = bandwidth;
1537 1537
1538 if (Offset == HT_EXTCHNL_OFFSET_LOWER) 1538 if (offset == HT_EXTCHNL_OFFSET_LOWER)
1539 priv->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_UPPER; 1539 priv->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_UPPER;
1540 else if (Offset == HT_EXTCHNL_OFFSET_UPPER) 1540 else if (offset == HT_EXTCHNL_OFFSET_UPPER)
1541 priv->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_LOWER; 1541 priv->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_LOWER;
1542 else 1542 else
1543 priv->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_DONT_CARE; 1543 priv->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_DONT_CARE;