• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
4  * All rights reserved.
5  *
6  * File: srom.h
7  *
8  * Purpose: Implement functions to access eeprom
9  *
10  * Author: Jerry Chen
11  *
12  * Date: Jan 29, 2003
13  */
14 
15 #ifndef __SROM_H__
16 #define __SROM_H__
17 
18 /*---------------------  Export Definitions -------------------------*/
19 
20 #define EEP_MAX_CONTEXT_SIZE    256
21 
22 #define CB_EEPROM_READBYTE_WAIT 900     /* us */
23 
24 #define W_MAX_I2CRETRY          0x0fff
25 
26 /* Contents in the EEPROM */
27 #define EEP_OFS_PAR         0x00        /* physical address */
28 #define EEP_OFS_ANTENNA     0x16
29 #define EEP_OFS_RADIOCTL    0x17
30 #define EEP_OFS_RFTYPE      0x1B        /* for select RF */
31 #define EEP_OFS_MINCHANNEL  0x1C        /* Min Channel # */
32 #define EEP_OFS_MAXCHANNEL  0x1D        /* Max Channel # */
33 #define EEP_OFS_SIGNATURE   0x1E
34 #define EEP_OFS_ZONETYPE    0x1F
35 #define EEP_OFS_RFTABLE     0x20        /* RF POWER TABLE */
36 #define EEP_OFS_PWR_CCK     0x20
37 #define EEP_OFS_SETPT_CCK   0x21
38 #define EEP_OFS_PWR_OFDMG   0x23
39 #define EEP_OFS_SETPT_OFDMG 0x24
40 #define EEP_OFS_PWR_FORMULA_OST  0x26
41 #define EEP_OFS_MAJOR_VER 0x2E
42 #define EEP_OFS_MINOR_VER 0x2F
43 #define EEP_OFS_CCK_PWR_TBL     0x30
44 #define EEP_OFS_CCK_PWR_dBm     0x3F
45 #define EEP_OFS_OFDM_PWR_TBL    0x40
46 #define EEP_OFS_OFDM_PWR_dBm    0x4F
47 /*{{ RobertYu: 20041124 */
48 #define EEP_OFS_SETPT_OFDMA         0x4E
49 #define EEP_OFS_OFDMA_PWR_TBL       0x50
50 /*}}*/
51 #define EEP_OFS_OFDMA_PWR_dBm       0xD2
52 
53 /*----------need to remove --------------------*/
54 #define EEP_OFS_BBTAB_LEN   0x70        /* BB Table Length */
55 #define EEP_OFS_BBTAB_ADR   0x71        /* BB Table Offset */
56 #define EEP_OFS_CHECKSUM    0xFF        /* reserved area for baseband 28h~78h */
57 
58 #define EEP_I2C_DEV_ID      0x50        /* EEPROM device address on I2C bus */
59 
60 /* Bits in EEP_OFS_ANTENNA */
61 #define EEP_ANTENNA_MAIN    0x01
62 #define EEP_ANTENNA_AUX     0x02
63 #define EEP_ANTINV          0x04
64 
65 /* Bits in EEP_OFS_RADIOCTL */
66 #define EEP_RADIOCTL_ENABLE 0x80
67 #define EEP_RADIOCTL_INV    0x01
68 
69 /*---------------------  Export Types  ------------------------------*/
70 
71 /*---------------------  Export Macros ------------------------------*/
72 
73 /*---------------------  Export Classes  ----------------------------*/
74 
75 /*---------------------  Export Variables  --------------------------*/
76 
77 /*---------------------  Export Functions  --------------------------*/
78 
79 unsigned char SROMbyReadEmbedded(void __iomem *iobase,
80 				 unsigned char byContntOffset);
81 
82 void SROMvReadAllContents(void __iomem *iobase, unsigned char *pbyEepromRegs);
83 
84 void SROMvReadEtherAddress(void __iomem *iobase,
85 			   unsigned char *pbyEtherAddress);
86 
87 #endif /* __EEPROM_H__*/
88