xref: /openbmc/linux/drivers/staging/vt6655/srom.h (revision 5449c685)
15449c685SForest Bond /*
25449c685SForest Bond  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
35449c685SForest Bond  * All rights reserved.
45449c685SForest Bond  *
55449c685SForest Bond  * This program is free software; you can redistribute it and/or modify
65449c685SForest Bond  * it under the terms of the GNU General Public License as published by
75449c685SForest Bond  * the Free Software Foundation; either version 2 of the License, or
85449c685SForest Bond  * (at your option) any later version.
95449c685SForest Bond  *
105449c685SForest Bond  * This program is distributed in the hope that it will be useful,
115449c685SForest Bond  * but WITHOUT ANY WARRANTY; without even the implied warranty of
125449c685SForest Bond  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
135449c685SForest Bond  * GNU General Public License for more details.
145449c685SForest Bond  *
155449c685SForest Bond  * You should have received a copy of the GNU General Public License along
165449c685SForest Bond  * with this program; if not, write to the Free Software Foundation, Inc.,
175449c685SForest Bond  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
185449c685SForest Bond  *
195449c685SForest Bond  *
205449c685SForest Bond  * File: srom.h
215449c685SForest Bond  *
225449c685SForest Bond  * Purpose: Implement functions to access eeprom
235449c685SForest Bond  *
245449c685SForest Bond  * Author: Jerry Chen
255449c685SForest Bond  *
265449c685SForest Bond  * Date: Jan 29, 2003
275449c685SForest Bond  *
285449c685SForest Bond  */
295449c685SForest Bond 
305449c685SForest Bond 
315449c685SForest Bond #ifndef __SROM_H__
325449c685SForest Bond #define __SROM_H__
335449c685SForest Bond 
345449c685SForest Bond #if !defined(__TTYPE_H__)
355449c685SForest Bond #include "ttype.h"
365449c685SForest Bond #endif
375449c685SForest Bond 
385449c685SForest Bond 
395449c685SForest Bond /*---------------------  Export Definitions -------------------------*/
405449c685SForest Bond 
415449c685SForest Bond 
425449c685SForest Bond #define EEP_MAX_CONTEXT_SIZE    256
435449c685SForest Bond 
445449c685SForest Bond #define CB_EEPROM_READBYTE_WAIT 900     //us
455449c685SForest Bond 
465449c685SForest Bond #define W_MAX_I2CRETRY          0x0fff
475449c685SForest Bond 
485449c685SForest Bond //
495449c685SForest Bond // Contents in the EEPROM
505449c685SForest Bond //
515449c685SForest Bond 
525449c685SForest Bond #define EEP_OFS_PAR         0x00        // physical address
535449c685SForest Bond #define EEP_OFS_ANTENNA     0x16
545449c685SForest Bond #define EEP_OFS_RADIOCTL    0x17
555449c685SForest Bond #define EEP_OFS_RFTYPE      0x1B        // for select RF
565449c685SForest Bond #define EEP_OFS_MINCHANNEL  0x1C        // Min Channel #
575449c685SForest Bond #define EEP_OFS_MAXCHANNEL  0x1D        // Max Channel #
585449c685SForest Bond #define EEP_OFS_SIGNATURE   0x1E        //
595449c685SForest Bond #define EEP_OFS_ZONETYPE    0x1F        //
605449c685SForest Bond #define EEP_OFS_RFTABLE     0x20        // RF POWER TABLE
615449c685SForest Bond #define EEP_OFS_PWR_CCK     0x20
625449c685SForest Bond #define EEP_OFS_SETPT_CCK   0x21
635449c685SForest Bond #define EEP_OFS_PWR_OFDMG   0x23
645449c685SForest Bond #define EEP_OFS_SETPT_OFDMG 0x24
655449c685SForest Bond #define EEP_OFS_PWR_FORMULA_OST  0x26   //
665449c685SForest Bond #define EEP_OFS_MAJOR_VER 0x2E
675449c685SForest Bond #define EEP_OFS_MINOR_VER 0x2F
685449c685SForest Bond #define EEP_OFS_CCK_PWR_TBL     0x30
695449c685SForest Bond #define EEP_OFS_CCK_PWR_dBm     0x3F
705449c685SForest Bond #define EEP_OFS_OFDM_PWR_TBL    0x40
715449c685SForest Bond #define EEP_OFS_OFDM_PWR_dBm    0x4F
725449c685SForest Bond //{{ RobertYu: 20041124
735449c685SForest Bond #define EEP_OFS_SETPT_OFDMA         0x4E
745449c685SForest Bond #define EEP_OFS_OFDMA_PWR_TBL       0x50
755449c685SForest Bond //}}
765449c685SForest Bond #define EEP_OFS_OFDMA_PWR_dBm       0xD2
775449c685SForest Bond 
785449c685SForest Bond 
795449c685SForest Bond //----------need to remove --------------------
805449c685SForest Bond #define EEP_OFS_BBTAB_LEN   0x70        // BB Table Length
815449c685SForest Bond #define EEP_OFS_BBTAB_ADR   0x71        // BB Table Offset
825449c685SForest Bond #define EEP_OFS_CHECKSUM    0xFF        // reserved area for baseband 28h ~ 78h
835449c685SForest Bond 
845449c685SForest Bond #define EEP_I2C_DEV_ID      0x50        // EEPROM device address on the I2C bus
855449c685SForest Bond 
865449c685SForest Bond 
875449c685SForest Bond //
885449c685SForest Bond // Bits in EEP_OFS_ANTENNA
895449c685SForest Bond //
905449c685SForest Bond #define EEP_ANTENNA_MAIN    0x01
915449c685SForest Bond #define EEP_ANTENNA_AUX     0x02
925449c685SForest Bond #define EEP_ANTINV          0x04
935449c685SForest Bond 
945449c685SForest Bond //
955449c685SForest Bond // Bits in EEP_OFS_RADIOCTL
965449c685SForest Bond //
975449c685SForest Bond #define EEP_RADIOCTL_ENABLE 0x80
985449c685SForest Bond #define EEP_RADIOCTL_INV    0x01
995449c685SForest Bond 
1005449c685SForest Bond 
1015449c685SForest Bond 
1025449c685SForest Bond /*---------------------  Export Types  ------------------------------*/
1035449c685SForest Bond 
1045449c685SForest Bond // AT24C02 eeprom contents
1055449c685SForest Bond //      2048 bits = 256 bytes = 128 words
1065449c685SForest Bond //
1075449c685SForest Bond typedef struct tagSSromReg {
1085449c685SForest Bond     BYTE    abyPAR[6];                  // 0x00 (WORD)
1095449c685SForest Bond 
1105449c685SForest Bond     WORD    wSUB_VID;                   // 0x03 (WORD)
1115449c685SForest Bond     WORD    wSUB_SID;
1125449c685SForest Bond 
1135449c685SForest Bond     BYTE    byBCFG0;                    // 0x05 (WORD)
1145449c685SForest Bond     BYTE    byBCFG1;
1155449c685SForest Bond 
1165449c685SForest Bond     BYTE    byFCR0;                     // 0x06 (WORD)
1175449c685SForest Bond     BYTE    byFCR1;
1185449c685SForest Bond     BYTE    byPMC0;                     // 0x07 (WORD)
1195449c685SForest Bond     BYTE    byPMC1;
1205449c685SForest Bond     BYTE    byMAXLAT;                   // 0x08 (WORD)
1215449c685SForest Bond     BYTE    byMINGNT;
1225449c685SForest Bond     BYTE    byCFG0;                     // 0x09 (WORD)
1235449c685SForest Bond     BYTE    byCFG1;
1245449c685SForest Bond     WORD    wCISPTR;                    // 0x0A (WORD)
1255449c685SForest Bond     WORD    wRsv0;                      // 0x0B (WORD)
1265449c685SForest Bond     WORD    wRsv1;                      // 0x0C (WORD)
1275449c685SForest Bond     BYTE    byBBPAIR;                   // 0x0D (WORD)
1285449c685SForest Bond     BYTE    byRFTYPE;
1295449c685SForest Bond     BYTE    byMinChannel;               // 0x0E (WORD)
1305449c685SForest Bond     BYTE    byMaxChannel;
1315449c685SForest Bond     BYTE    bySignature;                // 0x0F (WORD)
1325449c685SForest Bond     BYTE    byCheckSum;
1335449c685SForest Bond 
1345449c685SForest Bond     BYTE    abyReserved0[96];           // 0x10 (WORD)
1355449c685SForest Bond     BYTE    abyCIS[128];                // 0x80 (WORD)
1365449c685SForest Bond } SSromReg, DEF* PSSromReg;
1375449c685SForest Bond 
1385449c685SForest Bond /*---------------------  Export Macros ------------------------------*/
1395449c685SForest Bond 
1405449c685SForest Bond /*---------------------  Export Classes  ----------------------------*/
1415449c685SForest Bond 
1425449c685SForest Bond /*---------------------  Export Variables  --------------------------*/
1435449c685SForest Bond 
1445449c685SForest Bond /*---------------------  Export Functions  --------------------------*/
1455449c685SForest Bond #ifdef __cplusplus
1465449c685SForest Bond extern "C" {                            /* Assume C declarations for C++ */
1475449c685SForest Bond #endif /* __cplusplus */
1485449c685SForest Bond 
1495449c685SForest Bond 
1505449c685SForest Bond BYTE SROMbyReadEmbedded(DWORD_PTR dwIoBase, BYTE byContntOffset);
1515449c685SForest Bond BOOL SROMbWriteEmbedded(DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byData);
1525449c685SForest Bond 
1535449c685SForest Bond void SROMvRegBitsOn(DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byBits);
1545449c685SForest Bond void SROMvRegBitsOff(DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byBits);
1555449c685SForest Bond 
1565449c685SForest Bond BOOL SROMbIsRegBitsOn(DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byTestBits);
1575449c685SForest Bond BOOL SROMbIsRegBitsOff(DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byTestBits);
1585449c685SForest Bond 
1595449c685SForest Bond void SROMvReadAllContents(DWORD_PTR dwIoBase, PBYTE pbyEepromRegs);
1605449c685SForest Bond void SROMvWriteAllContents(DWORD_PTR dwIoBase, PBYTE pbyEepromRegs);
1615449c685SForest Bond 
1625449c685SForest Bond void SROMvReadEtherAddress(DWORD_PTR dwIoBase, PBYTE pbyEtherAddress);
1635449c685SForest Bond void SROMvWriteEtherAddress(DWORD_PTR dwIoBase, PBYTE pbyEtherAddress);
1645449c685SForest Bond 
1655449c685SForest Bond VOID SROMvReadSubSysVenId(DWORD_PTR dwIoBase, PDWORD pdwSubSysVenId);
1665449c685SForest Bond 
1675449c685SForest Bond BOOL SROMbAutoLoad (DWORD_PTR dwIoBase);
1685449c685SForest Bond 
1695449c685SForest Bond 
1705449c685SForest Bond #ifdef __cplusplus
1715449c685SForest Bond }                                       /* End of extern "C" { */
1725449c685SForest Bond #endif /* __cplusplus */
1735449c685SForest Bond 
1745449c685SForest Bond 
1755449c685SForest Bond 
1765449c685SForest Bond 
1775449c685SForest Bond #endif // __EEPROM_H__
1785449c685SForest Bond 
1795449c685SForest Bond 
180