1 /*************************************************************************
3 * 4F, No. 2 Technology 5th Rd. *
4 * Science-based Industrial Park *
5 * Hsin-chu, Taiwan, R.O.C. *
7 * (c) Copyright 2002, Ralink Technology, Inc. *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17 * GNU General Public License for more details. *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program; if not, write to the *
21 * Free Software Foundation, Inc., *
22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 ************************************************************************/
25 #include "rt_config.h"
32 RTMP_IO_WRITE32(pAd
, CSR21
, *x
);
41 RTMP_IO_WRITE32(pAd
, CSR21
, *x
);
51 RTMP_IO_READ32(pAd
, CSR21
, &x
);
60 RTMP_IO_READ32(pAd
, CSR21
, &x
);
79 mask
= 0x01 << (count
- 1);
80 RTMP_IO_READ32(pAd
, CSR21
, &x
);
87 if(data
& mask
) x
|= EEDI
;
89 RTMP_IO_WRITE32(pAd
, CSR21
, x
);
98 RTMP_IO_WRITE32(pAd
, CSR21
, x
);
102 IN PRTMP_ADAPTER pAd
)
106 RTMP_IO_READ32(pAd
, CSR21
, &x
);
109 RTMP_IO_WRITE32(pAd
, CSR21
, x
);
116 IN PRTMP_ADAPTER pAd
)
120 // reset bits and set EECS
121 RTMP_IO_READ32(pAd
, CSR21
, &x
);
122 x
&= ~(EEDI
| EEDO
| EESK
);
124 RTMP_IO_WRITE32(pAd
, CSR21
, x
);
130 // output the read_opcode and six pulse in that order
131 ShiftOutBits(pAd
, EEPROM_EWEN_OPCODE
, 5);
132 ShiftOutBits(pAd
, 0, 6);
138 IN PRTMP_ADAPTER pAd
)
142 // reset bits and set EECS
143 RTMP_IO_READ32(pAd
, CSR21
, &x
);
144 x
&= ~(EEDI
| EEDO
| EESK
);
146 RTMP_IO_WRITE32(pAd
, CSR21
, x
);
152 // output the read_opcode and six pulse in that order
153 ShiftOutBits(pAd
, EEPROM_EWDS_OPCODE
, 5);
154 ShiftOutBits(pAd
, 0, 6);
159 USHORT
RTMP_EEPROM_READ16(
160 IN PRTMP_ADAPTER pAd
,
167 // reset bits and set EECS
168 RTMP_IO_READ32(pAd
, CSR21
, &x
);
169 x
&= ~(EEDI
| EEDO
| EESK
);
171 RTMP_IO_WRITE32(pAd
, CSR21
, x
);
177 // output the read_opcode and register number in that order
178 ShiftOutBits(pAd
, EEPROM_READ_OPCODE
, 3);
179 ShiftOutBits(pAd
, Offset
, pAd
->EEPROMAddressNum
);
181 // Now read the data (16 bits) in from the selected EEPROM word
182 data
= ShiftInBits(pAd
);
189 VOID
RTMP_EEPROM_WRITE16(
190 IN PRTMP_ADAPTER pAd
,
200 // reset bits and set EECS
201 RTMP_IO_READ32(pAd
, CSR21
, &x
);
202 x
&= ~(EEDI
| EEDO
| EESK
);
204 RTMP_IO_WRITE32(pAd
, CSR21
, x
);
210 // output the read_opcode ,register number and data in that order
211 ShiftOutBits(pAd
, EEPROM_WRITE_OPCODE
, 3);
212 ShiftOutBits(pAd
, Offset
, pAd
->EEPROMAddressNum
);
213 ShiftOutBits(pAd
, Data
, 16); // 16-bit access
216 RTMP_IO_READ32(pAd
, CSR21
, &x
);
221 udelay(1000); //delay for twp(MAX)=10ms