Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Staging: rt2860: fix coding style issue in mac_pci.h, mac_usb.h, rtmp_mac.h, rtmp_phy.h

This is a patch to the mac_pci.h, mac_usb.h, rtmp_mac.h, rtmp_phy.h files
that fixes up errors found by the checkpatch.pl tool

Signed-off-by: Gorskin Ilya <revent82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Gorskin Ilya and committed by
Greg Kroah-Hartman
5d9ffae0 1995dbab

+221 -265
+20 -21
drivers/staging/rt2860/chip/mac_pci.h
··· 147 147 148 148 /* ----------------- Frimware Related MACRO ----------------- */ 149 149 #define RTMP_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ 150 - do{ \ 150 + do { \ 151 151 unsigned long _i, _firm; \ 152 152 RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x10000); \ 153 153 \ 154 - for(_i=0; _i<_FwLen; _i+=4) \ 155 - { \ 156 - _firm = _pFwImage[_i] + \ 154 + for (_i = 0; _i < _FwLen; _i += 4) { \ 155 + _firm = _pFwImage[_i] + \ 157 156 (_pFwImage[_i+3] << 24) + \ 158 157 (_pFwImage[_i+2] << 16) + \ 159 158 (_pFwImage[_i+1] << 8); \ ··· 164 165 /* initialize BBP R/W access agent */ \ 165 166 RTMP_IO_WRITE32(_pAd, H2M_BBP_AGENT, 0); \ 166 167 RTMP_IO_WRITE32(_pAd, H2M_MAILBOX_CSR, 0); \ 167 - }while(0) 168 + } while (0) 168 169 169 170 /* ----------------- TX Related MACRO ----------------- */ 170 - #define RTMP_START_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) 171 - #define RTMP_STOP_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) 171 + #define RTMP_START_DEQUEUE(pAd, QueIdx, irqFlags) do {} while (0) 172 + #define RTMP_STOP_DEQUEUE(pAd, QueIdx, irqFlags) do {} while (0) 172 173 173 174 #define RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \ 174 175 ((freeNum) >= (unsigned long)(pTxBlk->TotalFragNum + RTMP_GET_PACKET_FRAGMENTS(pPacket) + 3)) /* rough estimate we will use 3 more descriptor. */ 175 - #define RTMP_RELEASE_DESC_RESOURCE(pAd, QueIdx) \ 176 - do{}while(0) 176 + #define RTMP_RELEASE_DESC_RESOURCE(pAd, QueIdx) do {} while (0) 177 177 178 178 #define NEED_QUEUE_BACK_FOR_AGG(pAd, QueIdx, freeNum, _TxFrameType) \ 179 - (((freeNum != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 0)) || (freeNum<3)) 179 + (((freeNum != (TX_RING_SIZE-1)) && \ 180 + (pAd->TxSwQueue[QueIdx].Number == 0)) || (freeNum < 3)) 180 181 181 182 #define HAL_KickOutMgmtTx(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) \ 182 183 RtmpPCIMgmtKickOut(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) ··· 184 185 #define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ 185 186 /* RtmpPCI_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) */ 186 187 187 - #define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \ 188 + #define HAL_WriteTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ 188 189 RtmpPCI_WriteSingleTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) 189 190 190 191 #define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \ 191 192 RtmpPCI_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) 192 193 193 - #define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) \ 194 + #define HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, pFreeNumber) \ 194 195 RtmpPCI_WriteMultiTxResource(pAd, pTxBlk, frameNum, pFreeNumber) 195 196 196 197 #define HAL_FinalWriteTxResource(_pAd, _pTxBlk, _TotalMPDUSize, _FirstTxIdx) \ 197 198 RtmpPCI_FinalWriteTxResource(_pAd, _pTxBlk, _TotalMPDUSize, _FirstTxIdx) 198 199 199 - #define HAL_LastTxIdx(_pAd, _QueIdx,_LastTxIdx) \ 200 + #define HAL_LastTxIdx(_pAd, _QueIdx, _LastTxIdx) \ 200 201 /*RtmpPCIDataLastTxIdx(_pAd, _QueIdx,_LastTxIdx) */ 201 202 202 203 #define HAL_KickOutTx(_pAd, _pTxBlk, _QueIdx) \ ··· 258 259 259 260 /* Insert the BA bitmap to ASIC for the Wcid entry */ 260 261 #define RTMP_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ 261 - do{ \ 262 + do { \ 262 263 u32 _Value = 0, _Offset; \ 263 264 _Offset = MAC_WCID_BASE + (_Aid) * HW_WCID_ENTRY_SIZE + 4; \ 264 265 RTMP_IO_READ32((_pAd), _Offset, &_Value);\ 265 266 _Value |= (0x10000<<(_TID)); \ 266 267 RTMP_IO_WRITE32((_pAd), _Offset, _Value);\ 267 - }while(0) 268 + } while (0) 268 269 269 270 /* Remove the BA bitmap from ASIC for the Wcid entry */ 270 271 /* bitmap field starts at 0x10000 in ASIC WCID table */ 271 272 #define RTMP_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ 272 - do{ \ 273 + do { \ 273 274 u32 _Value = 0, _Offset; \ 274 275 _Offset = MAC_WCID_BASE + (_Wcid) * HW_WCID_ENTRY_SIZE + 4; \ 275 276 RTMP_IO_READ32((_pAd), _Offset, &_Value); \ 276 277 _Value &= (~(0x10000 << (_TID))); \ 277 278 RTMP_IO_WRITE32((_pAd), _Offset, _Value); \ 278 - }while(0) 279 + } while (0) 279 280 280 281 /* ----------------- Interface Related MACRO ----------------- */ 281 282 ··· 284 285 /* Since it use ADAPTER structure, it have to be put after structure definition. */ 285 286 /* */ 286 287 #define RTMP_ASIC_INTERRUPT_DISABLE(_pAd) \ 287 - do{ \ 288 + do { \ 288 289 RTMP_IO_WRITE32((_pAd), INT_MASK_CSR, 0x0); /* 0: disable */ \ 289 290 RTMP_CLEAR_FLAG((_pAd), fRTMP_ADAPTER_INTERRUPT_ACTIVE); \ 290 - }while(0) 291 + } while (0) 291 292 292 293 #define RTMP_ASIC_INTERRUPT_ENABLE(_pAd)\ 293 - do{ \ 294 + do { \ 294 295 RTMP_IO_WRITE32((_pAd), INT_MASK_CSR, (_pAd)->int_enable_reg /*DELAYINTMASK*/); /* 1:enable */ \ 295 296 RTMP_SET_FLAG((_pAd), fRTMP_ADAPTER_INTERRUPT_ACTIVE); \ 296 - }while(0) 297 + } while (0) 297 298 298 299 #define RTMP_IRQ_INIT(pAd) \ 299 300 { pAd->int_enable_reg = ((DELAYINTMASK) | \
+26 -29
drivers/staging/rt2860/chip/mac_usb.h
··· 25 25 ************************************************************************* 26 26 27 27 Module Name: 28 - mac_usb.h 28 + mac_usb.h 29 29 30 30 Abstract: 31 31 ··· 46 46 #define USB_CYC_CFG 0x02a4 47 47 48 48 #define BEACON_RING_SIZE 2 49 - #define MGMTPIPEIDX 0 /* EP6 is highest priority */ 49 + #define MGMTPIPEIDX 0 /* EP6 is highest priority */ 50 50 51 51 #define RTMP_PKT_TAIL_PADDING 11 /* 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding) */ 52 52 ··· 220 220 221 221 ******************************************************************************/ 222 222 #define RTMP_START_DEQUEUE(pAd, QueIdx, irqFlags) \ 223 - do{ \ 223 + do { \ 224 224 RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ 225 - if (pAd->DeQueueRunning[QueIdx]) \ 226 - { \ 227 - RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\ 225 + if (pAd->DeQueueRunning[QueIdx]) { \ 226 + RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ 228 227 DBGPRINT(RT_DEBUG_OFF, ("DeQueueRunning[%d]= TRUE!\n", QueIdx)); \ 229 228 continue; \ 230 - } \ 231 - else \ 232 - { \ 229 + } else { \ 233 230 pAd->DeQueueRunning[QueIdx] = TRUE; \ 234 231 RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\ 235 232 } \ 236 - }while(0) 233 + } while (0) 237 234 238 235 #define RTMP_STOP_DEQUEUE(pAd, QueIdx, irqFlags) \ 239 - do{ \ 236 + do { \ 240 237 RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ 241 238 pAd->DeQueueRunning[QueIdx] = FALSE; \ 242 239 RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ 243 - }while(0) 240 + } while (0) 244 241 245 242 #define RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \ 246 243 (RTUSBFreeDescriptorRequest(pAd, pTxBlk->QueIdx, (pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket))) == NDIS_STATUS_SUCCESS) 247 244 248 245 #define RTMP_RELEASE_DESC_RESOURCE(pAd, QueIdx) \ 249 - do{}while(0) 246 + do {} while (0) 250 247 251 248 #define NEED_QUEUE_BACK_FOR_AGG(_pAd, _QueIdx, _freeNum, _TxFrameType) \ 252 - ((_TxFrameType == TX_RALINK_FRAME) && (RTUSBNeedQueueBackForAgg(_pAd, _QueIdx))) 249 + ((_TxFrameType == TX_RALINK_FRAME) && \ 250 + (RTUSBNeedQueueBackForAgg(_pAd, _QueIdx))) 253 251 254 252 #define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ 255 - RtmpUSB_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) 253 + RtmpUSB_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) 256 254 257 - #define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \ 258 - RtmpUSB_WriteSingleTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) 255 + #define HAL_WriteTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ 256 + RtmpUSB_WriteSingleTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) 259 257 260 258 #define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \ 261 - RtmpUSB_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) 259 + RtmpUSB_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) 262 260 263 - #define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) \ 264 - RtmpUSB_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) 261 + #define HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, pFreeNumber) \ 262 + RtmpUSB_WriteMultiTxResource(pAd, pTxBlk, frameNum, pFreeNumber) 265 263 266 264 #define HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) \ 267 - RtmpUSB_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) 265 + RtmpUSB_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) 268 266 269 - #define HAL_LastTxIdx(pAd, QueIdx,TxIdx) \ 267 + #define HAL_LastTxIdx(pAd, QueIdx, TxIdx) \ 270 268 /*RtmpUSBDataLastTxIdx(pAd, QueIdx,TxIdx) */ 271 269 272 270 #define HAL_KickOutTx(pAd, pTxBlk, QueIdx) \ ··· 284 286 /* 285 287 * Device Hardware Interface Related MACRO 286 288 */ 287 - #define RTMP_IRQ_INIT(pAd) do{}while(0) 288 - #define RTMP_IRQ_ENABLE(pAd) do{}while(0) 289 + #define RTMP_IRQ_INIT(pAd) do {} while (0) 290 + #define RTMP_IRQ_ENABLE(pAd) do {} while (0) 289 291 290 292 /* 291 293 * MLME Related MACRO ··· 303 305 RTUSBMlmeUp(pAd); } 304 306 305 307 #define RTMP_MLME_RESET_STATE_MACHINE(pAd) \ 306 - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_RESET_CONF, 0, NULL); \ 307 - RTUSBMlmeUp(pAd); 308 + { MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_RESET_CONF, 0, NULL); \ 309 + RTUSBMlmeUp(pAd); } 308 310 309 311 #define RTMP_HANDLE_COUNTER_MEASURE(_pAd, _pEntry) \ 310 312 { RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_802_11_COUNTER_MEASURE, _pEntry, sizeof(struct rt_mac_table_entry)); \ ··· 328 330 {\ 329 331 if ((_pAd)->StaCfg.WindowsPowerMode == Ndis802_11PowerModeFast_PSP) \ 330 332 MlmeSetPsmBit(_pAd, _val);\ 331 - else \ 332 - { \ 333 + else { \ 333 334 u16 _psm_val; \ 334 335 _psm_val = _val; \ 335 336 RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_SET_PSM_BIT, &(_psm_val), sizeof(u16)); \ 336 - }\ 337 + } \ 337 338 } 338 339 339 340 #define RTMP_MLME_RADIO_ON(pAd) \
+26 -26
drivers/staging/rt2860/chip/rtmp_mac.h
··· 154 154 u32 GPTimer:1; 155 155 u32 RxCoherent:1; /*bit16 */ 156 156 u32 TxCoherent:1; 157 - u32 : 14; 157 + u32: 14; 158 158 } field; 159 159 u32 word; 160 160 } INT_SOURCE_CSR_STRUC, *PINT_SOURCE_CSR_STRUC; ··· 175 175 u32 HccaDmaDone:1; 176 176 u32 MgmtDmaDone:1; 177 177 u32 MCUCommandINT:1; 178 - u32 : 20; 178 + u32: 20; 179 179 u32 RxCoherent:1; 180 180 u32 TxCoherent:1; 181 181 } field; ··· 209 209 u32 RST_DTX_IDX5:1; 210 210 u32 rsv:10; 211 211 u32 RST_DRX_IDX0:1; 212 - u32 : 15; 212 + u32: 15; 213 213 } field; 214 214 u32 word; 215 215 } WPDMA_RST_IDX_STRUC, *PWPDMA_RST_IDX_STRUC; ··· 448 448 u32 Busy:1; /* 1: ASIC is busy execute BBP programming. */ 449 449 u32 BBP_PAR_DUR:1; /* 0: 4 MAC clock cycles 1: 8 MAC clock cycles */ 450 450 u32 BBP_RW_MODE:1; /* 0: use serial mode 1:parallel */ 451 - u32 : 12; 451 + u32: 12; 452 452 } field; 453 453 u32 word; 454 454 } BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC; ··· 494 494 u32 GLedMode:2; /* green Led Mode */ 495 495 u32 YLedMode:2; /* yellow Led Mode */ 496 496 u32 LedPolar:1; /* Led Polarity. 0: active low1: active high */ 497 - u32 : 1; 497 + u32: 1; 498 498 } field; 499 499 u32 word; 500 500 } LED_CFG_STRUC, *PLED_CFG_STRUC; ··· 533 533 u32 TsfSyncMode:2; /* Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode */ 534 534 u32 bTBTTEnable:1; 535 535 u32 bBeaconGen:1; /* Enable beacon generator */ 536 - u32 : 3; 536 + u32: 3; 537 537 u32 TxTimestampCompensate:8; 538 538 } field; 539 539 u32 word; ··· 560 560 u32 AutoLeadTime:8; 561 561 u32 NumofSleepingTbtt:7; /* ForceWake has high privilege than PutToSleep when both set */ 562 562 u32 EnableAutoWakeup:1; /* 0:sleep, 1:awake */ 563 - u32 : 16; 563 + u32: 16; 564 564 } field; 565 565 u32 word; 566 566 } AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC; ··· 578 578 u32 Aifsn:4; /* # of slot time */ 579 579 u32 Cwmin:4; /* */ 580 580 u32 Cwmax:4; /*unit power of 2 */ 581 - u32 : 12; /* */ 581 + u32: 12; /* */ 582 582 } field; 583 583 u32 word; 584 584 } EDCA_AC_CFG_STRUC, *PEDCA_AC_CFG_STRUC; ··· 751 751 u32 rsv:1; /* Power bit value in conrtrol frame */ 752 752 u32 DualCTSEn:1; /* Power bit value in conrtrol frame */ 753 753 u32 AckCtsPsmBit:1; /* Power bit value in conrtrol frame */ 754 - u32 : 24; 754 + u32: 24; 755 755 } field; 756 756 u32 word; 757 757 } AUTO_RSP_CFG_STRUC, *PAUTO_RSP_CFG_STRUC; ··· 981 981 typedef union _SHAREDKEY_MODE_STRUC { 982 982 struct { 983 983 u32 Bss0Key0CipherAlg:3; 984 - u32 : 1; 984 + u32: 1; 985 985 u32 Bss0Key1CipherAlg:3; 986 - u32 : 1; 986 + u32: 1; 987 987 u32 Bss0Key2CipherAlg:3; 988 - u32 : 1; 988 + u32: 1; 989 989 u32 Bss0Key3CipherAlg:3; 990 - u32 : 1; 990 + u32: 1; 991 991 u32 Bss1Key0CipherAlg:3; 992 - u32 : 1; 992 + u32: 1; 993 993 u32 Bss1Key1CipherAlg:3; 994 - u32 : 1; 994 + u32: 1; 995 995 u32 Bss1Key2CipherAlg:3; 996 - u32 : 1; 996 + u32: 1; 997 997 u32 Bss1Key3CipherAlg:3; 998 - u32 : 1; 998 + u32: 1; 999 999 } field; 1000 1000 u32 word; 1001 1001 } SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC; ··· 1103 1103 u32 DropBAR:1; /* */ 1104 1104 1105 1105 u32 DropRsvCntlType:1; 1106 - u32 : 15; 1106 + u32: 15; 1107 1107 } field; 1108 1108 u32 word; 1109 1109 } RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC; ··· 1128 1128 typedef union _SEC_CSR5_STRUC { 1129 1129 struct { 1130 1130 u32 Bss2Key0CipherAlg:3; 1131 - u32 : 1; 1131 + u32: 1; 1132 1132 u32 Bss2Key1CipherAlg:3; 1133 - u32 : 1; 1133 + u32: 1; 1134 1134 u32 Bss2Key2CipherAlg:3; 1135 - u32 : 1; 1135 + u32: 1; 1136 1136 u32 Bss2Key3CipherAlg:3; 1137 - u32 : 1; 1137 + u32: 1; 1138 1138 u32 Bss3Key0CipherAlg:3; 1139 - u32 : 1; 1139 + u32: 1; 1140 1140 u32 Bss3Key1CipherAlg:3; 1141 - u32 : 1; 1141 + u32: 1; 1142 1142 u32 Bss3Key2CipherAlg:3; 1143 - u32 : 1; 1143 + u32: 1; 1144 1144 u32 Bss3Key3CipherAlg:3; 1145 - u32 : 1; 1145 + u32: 1; 1146 1146 } field; 1147 1147 u32 word; 1148 1148 } SEC_CSR5_STRUC, *PSEC_CSR5_STRUC;
+149 -189
drivers/staging/rt2860/chip/rtmp_phy.h
··· 177 177 #ifdef RTMP_MAC_PCI 178 178 #define RTMP_RF_IO_WRITE32(_A, _V) \ 179 179 { \ 180 - if ((_A)->bPCIclkOff == FALSE) \ 181 - { \ 180 + if ((_A)->bPCIclkOff == FALSE) { \ 182 181 PHY_CSR4_STRUC _value; \ 183 182 unsigned long _busyCnt = 0; \ 184 183 \ ··· 186 187 if (_value.field.Busy == IDLE) \ 187 188 break; \ 188 189 _busyCnt++; \ 189 - }while (_busyCnt < MAX_BUSY_COUNT); \ 190 - if(_busyCnt < MAX_BUSY_COUNT) \ 191 - { \ 190 + } while (_busyCnt < MAX_BUSY_COUNT); \ 191 + if (_busyCnt < MAX_BUSY_COUNT) { \ 192 192 RTMP_IO_WRITE32((_A), RF_CSR_CFG0, (_V)); \ 193 193 } \ 194 194 } \ ··· 216 218 _bViaMCU: if we need access the bbp via the MCU. 217 219 */ 218 220 #define RTMP_BBP_IO_READ8(_pAd, _bbpID, _pV, _bViaMCU) \ 219 - do{ \ 220 - BBP_CSR_CFG_STRUC BbpCsr; \ 221 - int _busyCnt, _secCnt, _regID; \ 222 - \ 223 - _regID = ((_bViaMCU) == TRUE ? H2M_BBP_AGENT : BBP_CSR_CFG); \ 224 - for (_busyCnt=0; _busyCnt<MAX_BUSY_COUNT; _busyCnt++) \ 225 - { \ 226 - RTMP_IO_READ32(_pAd, _regID, &BbpCsr.word); \ 221 + do { \ 222 + BBP_CSR_CFG_STRUC BbpCsr; \ 223 + int _busyCnt, _secCnt, _regID; \ 224 + \ 225 + _regID = ((_bViaMCU) == TRUE ? H2M_BBP_AGENT : BBP_CSR_CFG); \ 226 + for (_busyCnt = 0; _busyCnt < MAX_BUSY_COUNT; _busyCnt++) { \ 227 + RTMP_IO_READ32(_pAd, _regID, &BbpCsr.word); \ 227 228 if (BbpCsr.field.Busy == BUSY) \ 228 - continue; \ 229 + continue; \ 229 230 BbpCsr.word = 0; \ 230 231 BbpCsr.field.fRead = 1; \ 231 - BbpCsr.field.BBP_RW_MODE = 1; \ 232 + BbpCsr.field.BBP_RW_MODE = 1; \ 232 233 BbpCsr.field.Busy = 1; \ 233 - BbpCsr.field.RegNum = _bbpID; \ 234 + BbpCsr.field.RegNum = _bbpID; \ 234 235 RTMP_IO_WRITE32(_pAd, _regID, BbpCsr.word); \ 235 - if ((_bViaMCU) == TRUE) \ 236 - { \ 237 - AsicSendCommandToMcu(_pAd, 0x80, 0xff, 0x0, 0x0); \ 238 - RTMPusecDelay(1000); \ 239 - } \ 240 - for (_secCnt=0; _secCnt<MAX_BUSY_COUNT; _secCnt++) \ 241 - { \ 236 + if ((_bViaMCU) == TRUE) { \ 237 + AsicSendCommandToMcu(_pAd, 0x80, 0xff, 0x0, 0x0); \ 238 + RTMPusecDelay(1000); \ 239 + } \ 240 + for (_secCnt = 0; _secCnt < MAX_BUSY_COUNT; _secCnt++) { \ 242 241 RTMP_IO_READ32(_pAd, _regID, &BbpCsr.word); \ 243 - if (BbpCsr.field.Busy == IDLE) \ 244 - break; \ 245 - } \ 246 - if ((BbpCsr.field.Busy == IDLE) && \ 247 - (BbpCsr.field.RegNum == _bbpID)) \ 248 - { \ 249 - *(_pV) = (u8)BbpCsr.field.Value; \ 250 - break; \ 251 - } \ 252 - } \ 253 - if (BbpCsr.field.Busy == BUSY) \ 254 - { \ 255 - DBGPRINT_ERR(("BBP(viaMCU=%d) read R%d fail\n", (_bViaMCU), _bbpID)); \ 242 + if (BbpCsr.field.Busy == IDLE) \ 243 + break; \ 244 + } \ 245 + if ((BbpCsr.field.Busy == IDLE) && \ 246 + (BbpCsr.field.RegNum == _bbpID)) { \ 247 + *(_pV) = (u8)BbpCsr.field.Value; \ 248 + break; \ 249 + } \ 250 + } \ 251 + if (BbpCsr.field.Busy == BUSY) { \ 252 + DBGPRINT_ERR(("BBP(viaMCU=%d) read R%d fail\n", (_bViaMCU), _bbpID)); \ 256 253 *(_pV) = (_pAd)->BbpWriteLatch[_bbpID]; \ 257 - if ((_bViaMCU) == TRUE) \ 258 - { \ 254 + if ((_bViaMCU) == TRUE) { \ 259 255 RTMP_IO_READ32(_pAd, _regID, &BbpCsr.word); \ 260 256 BbpCsr.field.Busy = 0; \ 261 257 RTMP_IO_WRITE32(_pAd, _regID, BbpCsr.word); \ 262 258 } \ 263 259 } \ 264 - }while(0) 260 + } while (0) 265 261 266 262 /* 267 263 This marco used for the BBP read operation which didn't need via MCU. ··· 275 283 int i, k; \ 276 284 BOOLEAN brc; \ 277 285 BbpCsr.field.Busy = IDLE; \ 278 - if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ 286 + if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) \ 287 + && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ 279 288 && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE) \ 280 289 && ((_A)->bPCIclkOff == FALSE) \ 281 - && ((_A)->brt30xxBanMcuCmd == FALSE)) \ 282 - { \ 283 - for (i=0; i<MAX_BUSY_COUNT; i++) \ 284 - { \ 285 - RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 286 - if (BbpCsr.field.Busy == BUSY) \ 287 - { \ 288 - continue; \ 289 - } \ 290 - BbpCsr.word = 0; \ 291 - BbpCsr.field.fRead = 1; \ 292 - BbpCsr.field.BBP_RW_MODE = 1; \ 293 - BbpCsr.field.Busy = 1; \ 294 - BbpCsr.field.RegNum = _I; \ 295 - RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ 296 - brc = AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \ 297 - if (brc == TRUE) \ 298 - { \ 299 - for (k=0; k<MAX_BUSY_COUNT; k++) \ 300 - { \ 301 - RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 302 - if (BbpCsr.field.Busy == IDLE) \ 303 - break; \ 304 - } \ 305 - if ((BbpCsr.field.Busy == IDLE) && \ 306 - (BbpCsr.field.RegNum == _I)) \ 307 - { \ 308 - *(_pV) = (u8)BbpCsr.field.Value; \ 309 - break; \ 310 - } \ 311 - } \ 312 - else \ 313 - { \ 290 + && ((_A)->brt30xxBanMcuCmd == FALSE)) { \ 291 + for (i = 0; i < MAX_BUSY_COUNT; i++) { \ 292 + RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 293 + if (BbpCsr.field.Busy == BUSY) { \ 294 + continue; \ 295 + } \ 296 + BbpCsr.word = 0; \ 297 + BbpCsr.field.fRead = 1; \ 298 + BbpCsr.field.BBP_RW_MODE = 1; \ 299 + BbpCsr.field.Busy = 1; \ 300 + BbpCsr.field.RegNum = _I; \ 301 + RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ 302 + brc = AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \ 303 + if (brc == TRUE) { \ 304 + for (k = 0; k < MAX_BUSY_COUNT; k++) { \ 305 + RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 306 + if (BbpCsr.field.Busy == IDLE) \ 307 + break; \ 308 + } \ 309 + if ((BbpCsr.field.Busy == IDLE) && \ 310 + (BbpCsr.field.RegNum == _I)) { \ 311 + *(_pV) = (u8)BbpCsr.field.Value; \ 312 + break; \ 313 + } \ 314 + } else { \ 314 315 BbpCsr.field.Busy = 0; \ 315 316 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ 316 317 } \ ··· 311 326 } \ 312 327 else if (!((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ 313 328 && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE)) \ 314 - && ((_A)->bPCIclkOff == FALSE)) \ 315 - { \ 316 - for (i=0; i<MAX_BUSY_COUNT; i++) \ 317 - { \ 318 - RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 319 - if (BbpCsr.field.Busy == BUSY) \ 320 - { \ 321 - continue; \ 322 - } \ 323 - BbpCsr.word = 0; \ 324 - BbpCsr.field.fRead = 1; \ 325 - BbpCsr.field.BBP_RW_MODE = 1; \ 326 - BbpCsr.field.Busy = 1; \ 327 - BbpCsr.field.RegNum = _I; \ 328 - RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ 329 - AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \ 330 - for (k=0; k<MAX_BUSY_COUNT; k++) \ 331 - { \ 332 - RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 333 - if (BbpCsr.field.Busy == IDLE) \ 334 - break; \ 335 - } \ 336 - if ((BbpCsr.field.Busy == IDLE) && \ 337 - (BbpCsr.field.RegNum == _I)) \ 338 - { \ 339 - *(_pV) = (u8)BbpCsr.field.Value; \ 340 - break; \ 341 - } \ 342 - } \ 343 - } \ 344 - else \ 345 - { \ 329 + && ((_A)->bPCIclkOff == FALSE)) { \ 330 + for (i = 0; i < MAX_BUSY_COUNT; i++) { \ 331 + RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 332 + if (BbpCsr.field.Busy == BUSY) { \ 333 + continue; \ 334 + } \ 335 + BbpCsr.word = 0; \ 336 + BbpCsr.field.fRead = 1; \ 337 + BbpCsr.field.BBP_RW_MODE = 1; \ 338 + BbpCsr.field.Busy = 1; \ 339 + BbpCsr.field.RegNum = _I; \ 340 + RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ 341 + AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \ 342 + for (k = 0; k < MAX_BUSY_COUNT; k++) { \ 343 + RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 344 + if (BbpCsr.field.Busy == IDLE) \ 345 + break; \ 346 + } \ 347 + if ((BbpCsr.field.Busy == IDLE) && \ 348 + (BbpCsr.field.RegNum == _I)) { \ 349 + *(_pV) = (u8)BbpCsr.field.Value; \ 350 + break; \ 351 + } \ 352 + } \ 353 + } else { \ 346 354 DBGPRINT_ERR((" , brt30xxBanMcuCmd = %d, Read BBP %d \n", (_A)->brt30xxBanMcuCmd, (_I))); \ 347 - *(_pV) = (_A)->BbpWriteLatch[_I]; \ 348 - } \ 349 - if ((BbpCsr.field.Busy == BUSY) || ((_A)->bPCIclkOff == TRUE)) \ 350 - { \ 351 - DBGPRINT_ERR(("BBP read R%d=0x%x fail\n", _I, BbpCsr.word)); \ 352 - *(_pV) = (_A)->BbpWriteLatch[_I]; \ 353 - } \ 355 + *(_pV) = (_A)->BbpWriteLatch[_I]; \ 356 + } \ 357 + if ((BbpCsr.field.Busy == BUSY) || ((_A)->bPCIclkOff == TRUE)) { \ 358 + DBGPRINT_ERR(("BBP read R%d=0x%x fail\n", _I, BbpCsr.word)); \ 359 + *(_pV) = (_A)->BbpWriteLatch[_I]; \ 360 + } \ 354 361 } 355 362 356 363 /* ··· 353 376 _bViaMCU: if we need access the bbp via the MCU. 354 377 */ 355 378 #define RTMP_BBP_IO_WRITE8(_pAd, _bbpID, _pV, _bViaMCU) \ 356 - do{ \ 379 + do { \ 357 380 BBP_CSR_CFG_STRUC BbpCsr; \ 358 - int _busyCnt, _regID; \ 359 - \ 381 + int _busyCnt, _regID; \ 382 + \ 360 383 _regID = ((_bViaMCU) == TRUE ? H2M_BBP_AGENT : BBP_CSR_CFG); \ 361 - for (_busyCnt=0; _busyCnt<MAX_BUSY_COUNT; _busyCnt++) \ 362 - { \ 384 + for (_busyCnt = 0; _busyCnt < MAX_BUSY_COUNT; _busyCnt++) { \ 363 385 RTMP_IO_READ32((_pAd), BBP_CSR_CFG, &BbpCsr.word); \ 364 - if (BbpCsr.field.Busy == BUSY) \ 365 - continue; \ 366 - BbpCsr.word = 0; \ 367 - BbpCsr.field.fRead = 0; \ 368 - BbpCsr.field.BBP_RW_MODE = 1; \ 369 - BbpCsr.field.Busy = 1; \ 370 - BbpCsr.field.Value = _pV; \ 371 - BbpCsr.field.RegNum = _bbpID; \ 372 - RTMP_IO_WRITE32((_pAd), BBP_CSR_CFG, BbpCsr.word); \ 373 - if ((_bViaMCU) == TRUE) \ 374 - { \ 375 - AsicSendCommandToMcu(_pAd, 0x80, 0xff, 0x0, 0x0); \ 376 - if ((_pAd)->OpMode == OPMODE_AP) \ 377 - RTMPusecDelay(1000); \ 378 - } \ 379 - (_pAd)->BbpWriteLatch[_bbpID] = _pV; \ 380 - break; \ 381 - } \ 382 - if (_busyCnt == MAX_BUSY_COUNT) \ 383 - { \ 384 - DBGPRINT_ERR(("BBP write R%d fail\n", _bbpID)); \ 385 - if((_bViaMCU) == TRUE) \ 386 - { \ 386 + if (BbpCsr.field.Busy == BUSY) \ 387 + continue; \ 388 + BbpCsr.word = 0; \ 389 + BbpCsr.field.fRead = 0; \ 390 + BbpCsr.field.BBP_RW_MODE = 1; \ 391 + BbpCsr.field.Busy = 1; \ 392 + BbpCsr.field.Value = _pV; \ 393 + BbpCsr.field.RegNum = _bbpID; \ 394 + RTMP_IO_WRITE32((_pAd), BBP_CSR_CFG, BbpCsr.word); \ 395 + if ((_bViaMCU) == TRUE) { \ 396 + AsicSendCommandToMcu(_pAd, 0x80, 0xff, 0x0, 0x0); \ 397 + if ((_pAd)->OpMode == OPMODE_AP) \ 398 + RTMPusecDelay(1000); \ 399 + } \ 400 + (_pAd)->BbpWriteLatch[_bbpID] = _pV; \ 401 + break; \ 402 + } \ 403 + if (_busyCnt == MAX_BUSY_COUNT) { \ 404 + DBGPRINT_ERR(("BBP write R%d fail\n", _bbpID)); \ 405 + if ((_bViaMCU) == TRUE) { \ 387 406 RTMP_IO_READ32(_pAd, H2M_BBP_AGENT, &BbpCsr.word); \ 388 - BbpCsr.field.Busy = 0; \ 407 + BbpCsr.field.Busy = 0; \ 389 408 RTMP_IO_WRITE32(_pAd, H2M_BBP_AGENT, BbpCsr.word); \ 390 - } \ 391 - } \ 392 - }while(0) 409 + } \ 410 + } \ 411 + } while (0) 393 412 394 413 /* 395 414 This marco used for the BBP write operation which didn't need via MCU. ··· 399 426 will use this function too and didn't access the bbp register via the MCU. 400 427 */ 401 428 /* Write BBP register by register's ID & value */ 402 - #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ 403 - { \ 404 - BBP_CSR_CFG_STRUC BbpCsr; \ 405 - int BusyCnt = 0; \ 429 + #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ 430 + { \ 431 + BBP_CSR_CFG_STRUC BbpCsr; \ 432 + int BusyCnt = 0; \ 406 433 BOOLEAN brc; \ 407 - if (_I < MAX_NUM_OF_BBP_LATCH) \ 408 - { \ 409 - if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ 434 + if (_I < MAX_NUM_OF_BBP_LATCH) { \ 435 + if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) \ 436 + && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ 410 437 && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE) \ 411 438 && ((_A)->bPCIclkOff == FALSE) \ 412 - && ((_A)->brt30xxBanMcuCmd == FALSE)) \ 413 - { \ 414 - if (_A->AccessBBPFailCount > 20) \ 415 - { \ 416 - AsicResetBBPAgent(_A); \ 417 - _A->AccessBBPFailCount = 0; \ 418 - } \ 419 - for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \ 420 - { \ 439 + && ((_A)->brt30xxBanMcuCmd == FALSE)) { \ 440 + if (_A->AccessBBPFailCount > 20) { \ 441 + AsicResetBBPAgent(_A); \ 442 + _A->AccessBBPFailCount = 0; \ 443 + } \ 444 + for (BusyCnt = 0; BusyCnt < MAX_BUSY_COUNT; BusyCnt++) { \ 421 445 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 422 446 if (BbpCsr.field.Busy == BUSY) \ 423 447 continue; \ ··· 426 456 BbpCsr.field.RegNum = _I; \ 427 457 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ 428 458 brc = AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \ 429 - if (brc == TRUE) \ 430 - { \ 459 + if (brc == TRUE) { \ 431 460 (_A)->BbpWriteLatch[_I] = _V; \ 432 - } \ 433 - else \ 434 - { \ 461 + } else { \ 435 462 BbpCsr.field.Busy = 0; \ 436 463 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ 437 464 } \ 438 465 break; \ 439 466 } \ 440 467 } \ 441 - else if (!((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ 468 + else if (!((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) \ 469 + && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ 442 470 && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE)) \ 443 - && ((_A)->bPCIclkOff == FALSE)) \ 444 - { \ 445 - if (_A->AccessBBPFailCount > 20) \ 446 - { \ 447 - AsicResetBBPAgent(_A); \ 448 - _A->AccessBBPFailCount = 0; \ 449 - } \ 450 - for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \ 451 - { \ 471 + && ((_A)->bPCIclkOff == FALSE)) { \ 472 + if (_A->AccessBBPFailCount > 20) { \ 473 + AsicResetBBPAgent(_A); \ 474 + _A->AccessBBPFailCount = 0; \ 475 + } \ 476 + for (BusyCnt = 0; BusyCnt < MAX_BUSY_COUNT; BusyCnt++) { \ 452 477 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ 453 478 if (BbpCsr.field.Busy == BUSY) \ 454 479 continue; \ ··· 458 493 (_A)->BbpWriteLatch[_I] = _V; \ 459 494 break; \ 460 495 } \ 461 - } \ 462 - else \ 463 - { \ 496 + } else { \ 464 497 DBGPRINT_ERR((" brt30xxBanMcuCmd = %d. Write BBP %d \n", (_A)->brt30xxBanMcuCmd, (_I))); \ 465 498 } \ 466 - if ((BusyCnt == MAX_BUSY_COUNT) || ((_A)->bPCIclkOff == TRUE)) \ 467 - { \ 468 - if (BusyCnt == MAX_BUSY_COUNT) \ 499 + if ((BusyCnt == MAX_BUSY_COUNT) || ((_A)->bPCIclkOff == TRUE)) { \ 500 + if (BusyCnt == MAX_BUSY_COUNT) \ 469 501 (_A)->AccessBBPFailCount++; \ 470 - DBGPRINT_ERR(("BBP write R%d=0x%x fail. BusyCnt= %d.bPCIclkOff = %d. \n", _I, BbpCsr.word, BusyCnt, (_A)->bPCIclkOff )); \ 502 + DBGPRINT_ERR(("BBP write R%d=0x%x fail. BusyCnt= %d.bPCIclkOff = %d. \n", _I, BbpCsr.word, BusyCnt, (_A)->bPCIclkOff)); \ 471 503 } \ 472 - } \ 473 - else \ 474 - { \ 504 + } else { \ 475 505 DBGPRINT_ERR(("****** BBP_Write_Latch Buffer exceeds max boundry ****** \n")); \ 476 506 } \ 477 507 } ··· 482 522 483 523 #ifdef RT30xx 484 524 #define RTMP_ASIC_MMPS_DISABLE(_pAd) \ 485 - do{ \ 525 + do { \ 486 526 u32 _macData; \ 487 527 u8 _bbpData = 0; \ 488 528 /* disable MMPS BBP control register */ \ ··· 494 534 RTMP_IO_READ32(_pAd, 0x1210, &_macData); \ 495 535 _macData &= ~(0x09); /*bit 0, 3*/ \ 496 536 RTMP_IO_WRITE32(_pAd, 0x1210, _macData); \ 497 - }while(0) 537 + } while (0) 498 538 499 539 #define RTMP_ASIC_MMPS_ENABLE(_pAd) \ 500 - do{ \ 540 + do { \ 501 541 u32 _macData; \ 502 542 u8 _bbpData = 0; \ 503 543 /* enable MMPS BBP control register */ \ ··· 509 549 RTMP_IO_READ32(_pAd, 0x1210, &_macData); \ 510 550 _macData |= (0x09); /*bit 0, 3*/ \ 511 551 RTMP_IO_WRITE32(_pAd, 0x1210, _macData); \ 512 - }while(0) 552 + } while (0) 513 553 514 554 #endif /* RT30xx // */ 515 555