29 static u32 RF_CHANNEL_TABLE_ZEBRA[] = {
59 for (i = 0; i <= 31; i++) {
60 if (((dwBitMask >> i) & 0x1) == 1)
85 u32 OriginalValue, BitShift, NewValue;
90 NewValue = (((OriginalValue) & (~dwBitMask)) |
91 (dwData << BitShift));
100 u32 Ret = 0, OriginalValue, BitShift;
104 Ret = (OriginalValue & dwBitMask) >> BitShift;
124 NewOffset = Offset - 30;
125 }
else if (Offset >= 16) {
132 NewOffset = Offset - 15;
169 u32 DataAndAddr = 0, NewOffset = 0;
181 NewOffset = Offset - 30;
182 }
else if (Offset >= 16) {
188 NewOffset = Offset - 15;
197 DataAndAddr = (Data<<16) | (NewOffset&0x3f);
222 u32 Original_Value, BitShift, New_Value;
232 Original_Value = phy_FwRFSerialRead(dev, eRFPath,
235 New_Value = (((Original_Value) & (~BitMask)) |
238 phy_FwRFSerialWrite(dev, eRFPath, RegAddr, New_Value);
240 phy_FwRFSerialWrite(dev, eRFPath, RegAddr, Data);
248 New_Value = (((Original_Value) & (~BitMask)) |
262 u32 Original_Value, Readback_Value, BitShift;
270 Original_Value = phy_FwRFSerialRead(dev, eRFPath, RegAddr);
277 Readback_Value = (Original_Value & BitMask) >> BitShift;
279 return Readback_Value;
288 Data |= ((Offset & 0xFF) << 12);
289 Data |= ((eRFPath & 0x3) << 20);
310 static void phy_FwRFSerialWrite(
struct net_device *dev,
316 Data |= ((Offset & 0xFF) << 12);
317 Data |= ((eRFPath & 0x3) << 20);
334 u32 dwArrayLen = 0, i = 0;
348 for (i = 0; i < dwArrayLen; i += 3) {
350 "PHY_Array[1] is %x Rtl8190MACPHY_Array[2] is %x\n",
351 pdwArray[i], pdwArray[i+1], pdwArray[i+2]);
352 if (pdwArray[i] == 0x318)
353 pdwArray[i+2] = 0x00000800;
364 u32 *Rtl819XPHY_REGArray_Table =
NULL;
365 u32 *Rtl819XAGCTAB_Array_Table =
NULL;
366 u16 AGCTAB_ArrayLen, PHY_REGArrayLen = 0;
380 for (i = 0; i < PHY_REGArrayLen; i += 2) {
383 Rtl819XPHY_REGArray_Table[i+1]);
385 "[0] is %x Rtl819xUsbPHY_REGArray[1] is %x\n",
386 i, Rtl819XPHY_REGArray_Table[i],
387 Rtl819XPHY_REGArray_Table[i+1]);
390 for (i = 0; i < AGCTAB_ArrayLen; i += 2) {
393 Rtl819XAGCTAB_Array_Table[i+1]);
395 "is %x rtl819XAGCTAB_Array[1] is %x\n", i,
396 Rtl819XAGCTAB_Array_Table[i],
397 Rtl819XAGCTAB_Array_Table[i+1]);
499 u32 i, CheckTimes = 4, dwRegRead = 0;
501 u32 WriteData[] = {0xfffff027, 0xaa55a02f, 0x00000027, 0x55aa502f};
509 for (i = 0; i < CheckTimes; i++) {
510 switch (CheckBlock) {
524 WriteData[
i] &= 0xfff;
530 WriteAddr[HW90_BLOCK_RF],
541 if (dwRegRead != WriteData[i]) {
543 "WriteData: %x\n", dwRegRead, WriteData[i]);
555 bool rtStatus =
true;
556 u8 bRegValue = 0, eCheckItem = 0;
570 if (rtStatus !=
true) {
572 "Check PHY%d Fail!!\n", eCheckItem-1);
604 bool rtStatus =
true;
633 "c60=0x%x, c68=0x%x)\n",
648 u8 powerlevel = 0, powerlevelOFDM24G = 0;
702 bool rtStatus =
true;
819 u32 CmdTableIdx,
u32 CmdTableSz,
825 if (CmdTable ==
NULL) {
830 if (CmdTableIdx >= CmdTableSz) {
832 " index, please check size of the table, CmdTableIdx:"
833 "%d, CmdTableSz:%d\n",
834 CmdTableIdx, CmdTableSz);
838 pCmd = CmdTable + CmdTableIdx;
853 u32 PostCommonCmdCnt;
859 __func__, *stage, *step, channel);
877 PostCommonCmdCnt = 0;
886 if (!(channel >= 1 && channel <= 14)) {
888 "8225: %d\n", channel);
894 RF_CHANNEL_TABLE_ZEBRA[channel], 10);
901 if (!(channel >= 1 && channel <= 14)) {
903 " 8256: %d\n", channel);
953 switch (CurrentCmd->
CmdID) {
971 for (eRFPath = 0; eRFPath <
976 CurrentCmd->
Para2<<7);
986 (*delay) = CurrentCmd->
msDelay;
1031 switch (priv->
rtllib->mode) {
1034 if (channel <= 14) {
1069 static void CCK_Tx_Power_Track_BW_Switch_TSSI(
struct net_device *dev)
1087 "Attentuation = %d\n",
1090 if (priv->
rtllib->current_network.channel == 14 &&
1094 }
else if (priv->
rtllib->current_network.channel !=
1109 "Attentuation = %d\n",
1118 if (priv->
rtllib->current_network.channel == 14 &&
1122 }
else if (priv->
rtllib->current_network.channel != 14
1133 static void CCK_Tx_Power_Track_BW_Switch_ThermalMeter(
struct net_device *dev)
1137 if (priv->
rtllib->current_network.channel == 14 &&
1140 else if (priv->
rtllib->current_network.channel != 14 &&
1150 "Switch_ThermalMeter(),CCK_index = %d\n",
1157 "Switch_ThermalMeter(), CCK_index = %d\n",
1164 static void CCK_Tx_Power_Track_BW_Switch(
struct net_device *dev)
1169 CCK_Tx_Power_Track_BW_Switch_TSSI(dev);
1171 CCK_Tx_Power_Track_BW_Switch_ThermalMeter(dev);
1222 CCK_Tx_Power_Track_BW_Switch(dev);
1237 CCK_Tx_Power_Track_BW_Switch(dev);
1306 #define SCAN_RX_INITIAL_GAIN 0x17
1307 #define POWER_DETECTION_TH 0x08
1313 switch (Operation) {
1391 priv->
rtllib->current_network.channel);
1418 static bool SetRFPowerState8190(
struct net_device *dev,
1423 (&(priv->
rtllib->PowerSaveControl));
1424 bool bResult =
true;
1425 u8 i = 0, QueueID = 0;
1435 switch (eRFPowerState) {
1440 bool rtstatus =
true;
1441 u32 InitilizeCount = 3;
1446 }
while ((rtstatus !=
true) &&
1447 (InitilizeCount > 0));
1449 if (rtstatus !=
true) {
1451 "pter fail,return\n",
1489 ring = &priv->
tx_ring[QueueID];
1491 if (skb_queue_len(&ring->
queue) == 0) {
1496 "/Sleep: %d times TcbBusyQueue"
1497 "[%d] !=0 before doze!\n",
1505 "SetRFPowerState8190(): eRfOff"
1506 ": %d times TcbBusyQueue[%d] "
1521 ring = &priv->
tx_ring[QueueID];
1523 if (skb_queue_len(&ring->
queue) == 0) {
1528 " times TcbBusyQueue[%d] !=0 b"
1529 "efore doze!\n", (i+1),
1537 "RFPowerState8185B(): eRfOff:"
1538 " %d times TcbBusyQueue[%d] "
1560 " to set: 0x%X!!!\n", eRFPowerState);
1572 priv->
rtllib->eRFPowerState = eRFPowerState;
1586 RT_TRACE(
COMP_PS,
"<=========== SetRFPowerState8190() bResult = %d!\n",
1596 bool bResult =
false;
1598 RT_TRACE(
COMP_PS,
"---------> SetRFPowerState(): eRFPowerState(%d)\n",
1600 if (eRFPowerState == priv->
rtllib->eRFPowerState &&
1603 "request for eRFPowerState(%d) is the same.\n",
1608 bResult = SetRFPowerState8190(dev, eRFPowerState);
1621 switch (Operation) {