diff options
Diffstat (limited to 'drivers/staging/vt6655/mac.h')
-rw-r--r-- | drivers/staging/vt6655/mac.h | 271 |
1 files changed, 56 insertions, 215 deletions
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h index 550dc4da80a9..57ae3bdbdb2d 100644 --- a/drivers/staging/vt6655/mac.h +++ b/drivers/staging/vt6655/mac.h @@ -18,7 +18,6 @@ #ifndef __MAC_H__ #define __MAC_H__ -#include "tmacro.h" #include "upc.h" /*--------------------- Export Definitions -------------------------*/ @@ -261,18 +260,18 @@ #define TFTCTL_TSFCNTREN 0x01 /* Bits in the EnhanceCFG register */ -#define EnCFG_BarkerPream 0x00020000 -#define EnCFG_NXTBTTCFPSTR 0x00010000 -#define EnCFG_BcnSusClr 0x00000200 -#define EnCFG_BcnSusInd 0x00000100 -#define EnCFG_CFP_ProtectEn 0x00000040 -#define EnCFG_ProtectMd 0x00000020 -#define EnCFG_HwParCFP 0x00000010 -#define EnCFG_CFNULRSP 0x00000004 -#define EnCFG_BBType_MASK 0x00000003 -#define EnCFG_BBType_g 0x00000002 -#define EnCFG_BBType_b 0x00000001 -#define EnCFG_BBType_a 0x00000000 +#define ENCFG_BARKERPREAM 0x00020000 +#define ENCFG_NXTBTTCFPSTR 0x00010000 +#define ENCFG_BCNSUSCLR 0x00000200 +#define ENCFG_BCNSUSIND 0x00000100 +#define ENCFG_CFP_PROTECTEN 0x00000040 +#define ENCFG_PROTECTMD 0x00000020 +#define ENCFG_HWPARCFP 0x00000010 +#define ENCFG_CFNULRSP 0x00000004 +#define ENCFG_BBTYPE_MASK 0x00000003 +#define ENCFG_BBTYPE_G 0x00000002 +#define ENCFG_BBTYPE_B 0x00000001 +#define ENCFG_BBTYPE_A 0x00000000 /* Bits in the Page1Sel register */ #define PAGE1_SEL 0x01 @@ -497,7 +496,7 @@ #define MAC_LB_INTERNAL 0x01 #define MAC_LB_NONE 0x00 -#define Default_BI 0x200 +#define DEFAULT_BI 0x200 /* MiscFIFO Offset */ #define MISCFIFO_KEYETRY0 32 @@ -541,77 +540,31 @@ #define MACvRegBitsOn(iobase, byRegOfs, byBits) \ do { \ unsigned char byData; \ - VNSvInPortB(iobase + byRegOfs, &byData); \ - VNSvOutPortB(iobase + byRegOfs, byData | (byBits)); \ + byData = ioread8(iobase + byRegOfs); \ + iowrite8(byData | (byBits), iobase + byRegOfs); \ } while (0) #define MACvWordRegBitsOn(iobase, byRegOfs, wBits) \ do { \ unsigned short wData; \ - VNSvInPortW(iobase + byRegOfs, &wData); \ + wData = ioread16(iobase + byRegOfs); \ VNSvOutPortW(iobase + byRegOfs, wData | (wBits)); \ } while (0) -#define MACvDWordRegBitsOn(iobase, byRegOfs, dwBits) \ -do { \ - unsigned long dwData; \ - VNSvInPortD(iobase + byRegOfs, &dwData); \ - VNSvOutPortD(iobase + byRegOfs, dwData | (dwBits)); \ -} while (0) - -#define MACvRegBitsOnEx(iobase, byRegOfs, byMask, byBits) \ -do { \ - unsigned char byData; \ - VNSvInPortB(iobase + byRegOfs, &byData); \ - byData &= byMask; \ - VNSvOutPortB(iobase + byRegOfs, byData | (byBits)); \ -} while (0) - #define MACvRegBitsOff(iobase, byRegOfs, byBits) \ do { \ unsigned char byData; \ - VNSvInPortB(iobase + byRegOfs, &byData); \ - VNSvOutPortB(iobase + byRegOfs, byData & ~(byBits)); \ + byData = ioread8(iobase + byRegOfs); \ + iowrite8(byData & ~(byBits), iobase + byRegOfs); \ } while (0) #define MACvWordRegBitsOff(iobase, byRegOfs, wBits) \ do { \ unsigned short wData; \ - VNSvInPortW(iobase + byRegOfs, &wData); \ + wData = ioread16(iobase + byRegOfs); \ VNSvOutPortW(iobase + byRegOfs, wData & ~(wBits)); \ } while (0) -#define MACvDWordRegBitsOff(iobase, byRegOfs, dwBits) \ -do { \ - unsigned long dwData; \ - VNSvInPortD(iobase + byRegOfs, &dwData); \ - VNSvOutPortD(iobase + byRegOfs, dwData & ~(dwBits)); \ -} while (0) - -#define MACvGetCurrRx0DescAddr(iobase, pdwCurrDescAddr) \ - VNSvInPortD(iobase + MAC_REG_RXDMAPTR0, \ - (unsigned long *)pdwCurrDescAddr) - -#define MACvGetCurrRx1DescAddr(iobase, pdwCurrDescAddr) \ - VNSvInPortD(iobase + MAC_REG_RXDMAPTR1, \ - (unsigned long *)pdwCurrDescAddr) - -#define MACvGetCurrTx0DescAddr(iobase, pdwCurrDescAddr) \ - VNSvInPortD(iobase + MAC_REG_TXDMAPTR0, \ - (unsigned long *)pdwCurrDescAddr) - -#define MACvGetCurrAC0DescAddr(iobase, pdwCurrDescAddr) \ - VNSvInPortD(iobase + MAC_REG_AC0DMAPTR, \ - (unsigned long *)pdwCurrDescAddr) - -#define MACvGetCurrSyncDescAddr(iobase, pdwCurrDescAddr) \ - VNSvInPortD(iobase + MAC_REG_SYNCDMAPTR, \ - (unsigned long *)pdwCurrDescAddr) - -#define MACvGetCurrATIMDescAddr(iobase, pdwCurrDescAddr) \ - VNSvInPortD(iobase + MAC_REG_ATIMDMAPTR, \ - (unsigned long *)pdwCurrDescAddr) - /* set the chip with current BCN tx descriptor address */ #define MACvSetCurrBCNTxDescAddr(iobase, dwCurrDescAddr) \ VNSvOutPortD(iobase + MAC_REG_BCNDMAPTR, \ @@ -622,104 +575,40 @@ do { \ VNSvOutPortW(iobase + MAC_REG_BCNDMACTL + 2, \ wCurrBCNLength) -#define MACvReadBSSIDAddress(iobase, pbyEtherAddr) \ -do { \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1); \ - VNSvInPortB(iobase + MAC_REG_BSSID0, \ - (unsigned char *)pbyEtherAddr); \ - VNSvInPortB(iobase + MAC_REG_BSSID0 + 1, \ - pbyEtherAddr + 1); \ - VNSvInPortB(iobase + MAC_REG_BSSID0 + 2, \ - pbyEtherAddr + 2); \ - VNSvInPortB(iobase + MAC_REG_BSSID0 + 3, \ - pbyEtherAddr + 3); \ - VNSvInPortB(iobase + MAC_REG_BSSID0 + 4, \ - pbyEtherAddr + 4); \ - VNSvInPortB(iobase + MAC_REG_BSSID0 + 5, \ - pbyEtherAddr + 5); \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0); \ -} while (0) - #define MACvWriteBSSIDAddress(iobase, pbyEtherAddr) \ do { \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1); \ - VNSvOutPortB(iobase + MAC_REG_BSSID0, \ - *(pbyEtherAddr)); \ - VNSvOutPortB(iobase + MAC_REG_BSSID0 + 1, \ - *(pbyEtherAddr + 1)); \ - VNSvOutPortB(iobase + MAC_REG_BSSID0 + 2, \ - *(pbyEtherAddr + 2)); \ - VNSvOutPortB(iobase + MAC_REG_BSSID0 + 3, \ - *(pbyEtherAddr + 3)); \ - VNSvOutPortB(iobase + MAC_REG_BSSID0 + 4, \ - *(pbyEtherAddr + 4)); \ - VNSvOutPortB(iobase + MAC_REG_BSSID0 + 5, \ - *(pbyEtherAddr + 5)); \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0); \ + iowrite8(1, iobase + MAC_REG_PAGE1SEL); \ + iowrite8(pbyEtherAddr[0], iobase + MAC_REG_BSSID0); \ + iowrite8(pbyEtherAddr[1], iobase + MAC_REG_BSSID0 + 1); \ + iowrite8(pbyEtherAddr[2], iobase + MAC_REG_BSSID0 + 2); \ + iowrite8(pbyEtherAddr[3], iobase + MAC_REG_BSSID0 + 3); \ + iowrite8(pbyEtherAddr[4], iobase + MAC_REG_BSSID0 + 4); \ + iowrite8(pbyEtherAddr[5], iobase + MAC_REG_BSSID0 + 5); \ + iowrite8(0, iobase + MAC_REG_PAGE1SEL); \ } while (0) #define MACvReadEtherAddress(iobase, pbyEtherAddr) \ do { \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1); \ - VNSvInPortB(iobase + MAC_REG_PAR0, \ - (unsigned char *)pbyEtherAddr); \ - VNSvInPortB(iobase + MAC_REG_PAR0 + 1, \ - pbyEtherAddr + 1); \ - VNSvInPortB(iobase + MAC_REG_PAR0 + 2, \ - pbyEtherAddr + 2); \ - VNSvInPortB(iobase + MAC_REG_PAR0 + 3, \ - pbyEtherAddr + 3); \ - VNSvInPortB(iobase + MAC_REG_PAR0 + 4, \ - pbyEtherAddr + 4); \ - VNSvInPortB(iobase + MAC_REG_PAR0 + 5, \ - pbyEtherAddr + 5); \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0); \ + iowrite8(1, iobase + MAC_REG_PAGE1SEL); \ + pbyEtherAddr[0] = ioread8(iobase + MAC_REG_PAR0); \ + pbyEtherAddr[1] = ioread8(iobase + MAC_REG_PAR0 + 1); \ + pbyEtherAddr[2] = ioread8(iobase + MAC_REG_PAR0 + 2); \ + pbyEtherAddr[3] = ioread8(iobase + MAC_REG_PAR0 + 3); \ + pbyEtherAddr[4] = ioread8(iobase + MAC_REG_PAR0 + 4); \ + pbyEtherAddr[5] = ioread8(iobase + MAC_REG_PAR0 + 5); \ + iowrite8(0, iobase + MAC_REG_PAGE1SEL); \ } while (0) -#define MACvWriteEtherAddress(iobase, pbyEtherAddr) \ -do { \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1); \ - VNSvOutPortB(iobase + MAC_REG_PAR0, \ - *pbyEtherAddr); \ - VNSvOutPortB(iobase + MAC_REG_PAR0 + 1, \ - *(pbyEtherAddr + 1)); \ - VNSvOutPortB(iobase + MAC_REG_PAR0 + 2, \ - *(pbyEtherAddr + 2)); \ - VNSvOutPortB(iobase + MAC_REG_PAR0 + 3, \ - *(pbyEtherAddr + 3)); \ - VNSvOutPortB(iobase + MAC_REG_PAR0 + 4, \ - *(pbyEtherAddr + 4)); \ - VNSvOutPortB(iobase + MAC_REG_PAR0 + 5, \ - *(pbyEtherAddr + 5)); \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0); \ -} while (0) - -#define MACvClearISR(iobase) \ - VNSvOutPortD(iobase + MAC_REG_ISR, IMR_MASK_VALUE) - -#define MACvStart(iobase) \ - VNSvOutPortB(iobase + MAC_REG_HOSTCR, \ - (HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON)) - #define MACvRx0PerPktMode(iobase) \ VNSvOutPortD(iobase + MAC_REG_RXDMACTL0, RX_PERPKT) -#define MACvRx0BufferFillMode(iobase) \ - VNSvOutPortD(iobase + MAC_REG_RXDMACTL0, RX_PERPKTCLR) - #define MACvRx1PerPktMode(iobase) \ VNSvOutPortD(iobase + MAC_REG_RXDMACTL1, RX_PERPKT) -#define MACvRx1BufferFillMode(iobase) \ - VNSvOutPortD(iobase + MAC_REG_RXDMACTL1, RX_PERPKTCLR) - -#define MACvRxOn(iobase) \ - MACvRegBitsOn(iobase, MAC_REG_HOSTCR, HOSTCR_RXON) - #define MACvReceive0(iobase) \ do { \ unsigned long dwData; \ - VNSvInPortD(iobase + MAC_REG_RXDMACTL0, &dwData); \ + dwData = ioread32(iobase + MAC_REG_RXDMACTL0); \ if (dwData & DMACTL_RUN) \ VNSvOutPortD(iobase + MAC_REG_RXDMACTL0, DMACTL_WAKE); \ else \ @@ -729,20 +618,17 @@ do { \ #define MACvReceive1(iobase) \ do { \ unsigned long dwData; \ - VNSvInPortD(iobase + MAC_REG_RXDMACTL1, &dwData); \ + dwData = ioread32(iobase + MAC_REG_RXDMACTL1); \ if (dwData & DMACTL_RUN) \ VNSvOutPortD(iobase + MAC_REG_RXDMACTL1, DMACTL_WAKE); \ else \ VNSvOutPortD(iobase + MAC_REG_RXDMACTL1, DMACTL_RUN); \ } while (0) -#define MACvTxOn(iobase) \ - MACvRegBitsOn(iobase, MAC_REG_HOSTCR, HOSTCR_TXON) - #define MACvTransmit0(iobase) \ do { \ unsigned long dwData; \ - VNSvInPortD(iobase + MAC_REG_TXDMACTL0, &dwData); \ + dwData = ioread32(iobase + MAC_REG_TXDMACTL0); \ if (dwData & DMACTL_RUN) \ VNSvOutPortD(iobase + MAC_REG_TXDMACTL0, DMACTL_WAKE); \ else \ @@ -752,47 +638,21 @@ do { \ #define MACvTransmitAC0(iobase) \ do { \ unsigned long dwData; \ - VNSvInPortD(iobase + MAC_REG_AC0DMACTL, &dwData); \ + dwData = ioread32(iobase + MAC_REG_AC0DMACTL); \ if (dwData & DMACTL_RUN) \ VNSvOutPortD(iobase + MAC_REG_AC0DMACTL, DMACTL_WAKE); \ else \ VNSvOutPortD(iobase + MAC_REG_AC0DMACTL, DMACTL_RUN); \ } while (0) -#define MACvTransmitSYNC(iobase) \ -do { \ - unsigned long dwData; \ - VNSvInPortD(iobase + MAC_REG_SYNCDMACTL, &dwData); \ - if (dwData & DMACTL_RUN) \ - VNSvOutPortD(iobase + MAC_REG_SYNCDMACTL, DMACTL_WAKE); \ - else \ - VNSvOutPortD(iobase + MAC_REG_SYNCDMACTL, DMACTL_RUN); \ -} while (0) - -#define MACvTransmitATIM(iobase) \ -do { \ - unsigned long dwData; \ - VNSvInPortD(iobase + MAC_REG_ATIMDMACTL, &dwData); \ - if (dwData & DMACTL_RUN) \ - VNSvOutPortD(iobase + MAC_REG_ATIMDMACTL, DMACTL_WAKE); \ - else \ - VNSvOutPortD(iobase + MAC_REG_ATIMDMACTL, DMACTL_RUN); \ -} while (0) - -#define MACvTransmitBCN(iobase) \ - VNSvOutPortB(iobase + MAC_REG_BCNDMACTL, BEACON_READY) - #define MACvClearStckDS(iobase) \ do { \ unsigned char byOrgValue; \ - VNSvInPortB(iobase + MAC_REG_STICKHW, &byOrgValue); \ + byOrgValue = ioread8(iobase + MAC_REG_STICKHW); \ byOrgValue = byOrgValue & 0xFC; \ - VNSvOutPortB(iobase + MAC_REG_STICKHW, byOrgValue); \ + iowrite8(byOrgValue, iobase + MAC_REG_STICKHW); \ } while (0) -#define MACvReadISR(iobase, pdwValue) \ - VNSvInPortD(iobase + MAC_REG_ISR, pdwValue) - #define MACvWriteISR(iobase, dwValue) \ VNSvOutPortD(iobase + MAC_REG_ISR, dwValue) @@ -803,77 +663,58 @@ do { \ VNSvOutPortD(iobase + MAC_REG_IMR, 0) #define MACvSelectPage0(iobase) \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0) + iowrite8(0, iobase + MAC_REG_PAGE1SEL) #define MACvSelectPage1(iobase) \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1) - -#define MACvReadMIBCounter(iobase, pdwCounter) \ - VNSvInPortD(iobase + MAC_REG_MIBCNTR, pdwCounter) - -#define MACvPwrEvntDisable(iobase) \ - VNSvOutPortW(iobase + MAC_REG_WAKEUPEN0, 0x0000) + iowrite8(1, iobase + MAC_REG_PAGE1SEL) #define MACvEnableProtectMD(iobase) \ do { \ unsigned long dwOrgValue; \ - VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue); \ - dwOrgValue = dwOrgValue | EnCFG_ProtectMd; \ + dwOrgValue = ioread32(iobase + MAC_REG_ENCFG); \ + dwOrgValue = dwOrgValue | ENCFG_PROTECTMD; \ VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue); \ } while (0) #define MACvDisableProtectMD(iobase) \ do { \ unsigned long dwOrgValue; \ - VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue); \ - dwOrgValue = dwOrgValue & ~EnCFG_ProtectMd; \ + dwOrgValue = ioread32(iobase + MAC_REG_ENCFG); \ + dwOrgValue = dwOrgValue & ~ENCFG_PROTECTMD; \ VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue); \ } while (0) #define MACvEnableBarkerPreambleMd(iobase) \ do { \ unsigned long dwOrgValue; \ - VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue); \ - dwOrgValue = dwOrgValue | EnCFG_BarkerPream; \ + dwOrgValue = ioread32(iobase + MAC_REG_ENCFG); \ + dwOrgValue = dwOrgValue | ENCFG_BARKERPREAM; \ VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue); \ } while (0) #define MACvDisableBarkerPreambleMd(iobase) \ do { \ unsigned long dwOrgValue; \ - VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue); \ - dwOrgValue = dwOrgValue & ~EnCFG_BarkerPream; \ + dwOrgValue = ioread32(iobase + MAC_REG_ENCFG); \ + dwOrgValue = dwOrgValue & ~ENCFG_BARKERPREAM; \ VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue); \ } while (0) #define MACvSetBBType(iobase, byTyp) \ do { \ unsigned long dwOrgValue; \ - VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue); \ - dwOrgValue = dwOrgValue & ~EnCFG_BBType_MASK; \ + dwOrgValue = ioread32(iobase + MAC_REG_ENCFG); \ + dwOrgValue = dwOrgValue & ~ENCFG_BBTYPE_MASK; \ dwOrgValue = dwOrgValue | (unsigned long)byTyp; \ VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue); \ } while (0) -#define MACvReadATIMW(iobase, pwCounter) \ - VNSvInPortW(iobase + MAC_REG_AIDATIM, pwCounter) - -#define MACvWriteATIMW(iobase, wCounter) \ - VNSvOutPortW(iobase + MAC_REG_AIDATIM, wCounter) - -#define MACvWriteCRC16_128(iobase, byRegOfs, wCRC) \ -do { \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1); \ - VNSvOutPortW(iobase + byRegOfs, wCRC); \ - VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0); \ -} while (0) - -#define MACvGPIOIn(iobase, pbyValue) \ - VNSvInPortB(iobase + MAC_REG_GPIOCTL1, pbyValue) - #define MACvSetRFLE_LatchBase(iobase) \ MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_RFLEOPT) +#define MAKEWORD(lb, hb) \ + ((unsigned short)(((unsigned char)(lb)) | (((unsigned short)((unsigned char)(hb))) << 8))) + bool MACbIsRegBitsOff(struct vnt_private *priv, unsigned char byRegOfs, unsigned char byTestBits); |