2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
34 -------- ---------- ----------------------------------------------
35 Name Date Modification logs
37 #include "../rt_config.h"
39 // IRQL = PASSIVE_LEVEL
45 RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x);
46 RTMPusecDelay(1); // Max frequency = 1MHz in Spec. definition
49 // IRQL = PASSIVE_LEVEL
55 RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x);
59 // IRQL = PASSIVE_LEVEL
66 RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
75 RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
87 // IRQL = PASSIVE_LEVEL
95 mask = 0x01 << (count - 1);
96 RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
103 if(data & mask) x |= EEDI;
105 RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
114 RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
117 // IRQL = PASSIVE_LEVEL
119 IN PRTMP_ADAPTER pAd)
123 RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
126 RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
133 IN PRTMP_ADAPTER pAd)
137 // reset bits and set EECS
138 RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
139 x &= ~(EEDI | EEDO | EESK);
141 RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
147 // output the read_opcode and six pulse in that order
148 ShiftOutBits(pAd, EEPROM_EWEN_OPCODE, 5);
149 ShiftOutBits(pAd, 0, 6);
155 IN PRTMP_ADAPTER pAd)
159 // reset bits and set EECS
160 RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
161 x &= ~(EEDI | EEDO | EESK);
163 RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
169 // output the read_opcode and six pulse in that order
170 ShiftOutBits(pAd, EEPROM_EWDS_OPCODE, 5);
171 ShiftOutBits(pAd, 0, 6);
176 // IRQL = PASSIVE_LEVEL
177 USHORT RTMP_EEPROM_READ16(
178 IN PRTMP_ADAPTER pAd,
185 // reset bits and set EECS
186 RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
187 x &= ~(EEDI | EEDO | EESK);
189 RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
195 // output the read_opcode and register number in that order
196 ShiftOutBits(pAd, EEPROM_READ_OPCODE, 3);
197 ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum);
199 // Now read the data (16 bits) in from the selected EEPROM word
200 data = ShiftInBits(pAd);
207 VOID RTMP_EEPROM_WRITE16(
208 IN PRTMP_ADAPTER pAd,
218 // reset bits and set EECS
219 RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
220 x &= ~(EEDI | EEDO | EESK);
222 RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
228 // output the read_opcode ,register number and data in that order
229 ShiftOutBits(pAd, EEPROM_WRITE_OPCODE, 3);
230 ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum);
231 ShiftOutBits(pAd, Data, 16); // 16-bit access
234 RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
238 RTMPusecDelay(10000); //delay for twp(MAX)=10ms