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