Lines Matching full:eeprom
7 * Abstract: EEPROM reader routines for 93cx6 chipsets.
19 MODULE_DESCRIPTION("EEPROM 93cx6 chip driver");
22 static inline void eeprom_93cx6_pulse_high(struct eeprom_93cx6 *eeprom) in eeprom_93cx6_pulse_high() argument
24 eeprom->reg_data_clock = 1; in eeprom_93cx6_pulse_high()
25 eeprom->register_write(eeprom); in eeprom_93cx6_pulse_high()
35 static inline void eeprom_93cx6_pulse_low(struct eeprom_93cx6 *eeprom) in eeprom_93cx6_pulse_low() argument
37 eeprom->reg_data_clock = 0; in eeprom_93cx6_pulse_low()
38 eeprom->register_write(eeprom); in eeprom_93cx6_pulse_low()
48 static void eeprom_93cx6_startup(struct eeprom_93cx6 *eeprom) in eeprom_93cx6_startup() argument
53 eeprom->register_read(eeprom); in eeprom_93cx6_startup()
54 eeprom->reg_data_in = 0; in eeprom_93cx6_startup()
55 eeprom->reg_data_out = 0; in eeprom_93cx6_startup()
56 eeprom->reg_data_clock = 0; in eeprom_93cx6_startup()
57 eeprom->reg_chip_select = 1; in eeprom_93cx6_startup()
58 eeprom->drive_data = 1; in eeprom_93cx6_startup()
59 eeprom->register_write(eeprom); in eeprom_93cx6_startup()
64 eeprom_93cx6_pulse_high(eeprom); in eeprom_93cx6_startup()
65 eeprom_93cx6_pulse_low(eeprom); in eeprom_93cx6_startup()
68 static void eeprom_93cx6_cleanup(struct eeprom_93cx6 *eeprom) in eeprom_93cx6_cleanup() argument
73 eeprom->register_read(eeprom); in eeprom_93cx6_cleanup()
74 eeprom->reg_data_in = 0; in eeprom_93cx6_cleanup()
75 eeprom->reg_chip_select = 0; in eeprom_93cx6_cleanup()
76 eeprom->register_write(eeprom); in eeprom_93cx6_cleanup()
81 eeprom_93cx6_pulse_high(eeprom); in eeprom_93cx6_cleanup()
82 eeprom_93cx6_pulse_low(eeprom); in eeprom_93cx6_cleanup()
85 static void eeprom_93cx6_write_bits(struct eeprom_93cx6 *eeprom, in eeprom_93cx6_write_bits() argument
90 eeprom->register_read(eeprom); in eeprom_93cx6_write_bits()
95 eeprom->reg_data_in = 0; in eeprom_93cx6_write_bits()
96 eeprom->reg_data_out = 0; in eeprom_93cx6_write_bits()
97 eeprom->drive_data = 1; in eeprom_93cx6_write_bits()
106 eeprom->reg_data_in = !!(data & BIT(i - 1)); in eeprom_93cx6_write_bits()
109 * Write the bit to the eeprom register. in eeprom_93cx6_write_bits()
111 eeprom->register_write(eeprom); in eeprom_93cx6_write_bits()
116 eeprom_93cx6_pulse_high(eeprom); in eeprom_93cx6_write_bits()
117 eeprom_93cx6_pulse_low(eeprom); in eeprom_93cx6_write_bits()
120 eeprom->reg_data_in = 0; in eeprom_93cx6_write_bits()
121 eeprom->register_write(eeprom); in eeprom_93cx6_write_bits()
124 static void eeprom_93cx6_read_bits(struct eeprom_93cx6 *eeprom, in eeprom_93cx6_read_bits() argument
130 eeprom->register_read(eeprom); in eeprom_93cx6_read_bits()
135 eeprom->reg_data_in = 0; in eeprom_93cx6_read_bits()
136 eeprom->reg_data_out = 0; in eeprom_93cx6_read_bits()
137 eeprom->drive_data = 0; in eeprom_93cx6_read_bits()
143 eeprom_93cx6_pulse_high(eeprom); in eeprom_93cx6_read_bits()
145 eeprom->register_read(eeprom); in eeprom_93cx6_read_bits()
150 eeprom->reg_data_in = 0; in eeprom_93cx6_read_bits()
155 if (eeprom->reg_data_out) in eeprom_93cx6_read_bits()
158 eeprom_93cx6_pulse_low(eeprom); in eeprom_93cx6_read_bits()
165 * eeprom_93cx6_read - Read a word from eeprom
166 * @eeprom: Pointer to eeprom structure
170 * This function will read the eeprom data as host-endian word
173 void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, const u8 word, in eeprom_93cx6_read() argument
179 * Initialize the eeprom register in eeprom_93cx6_read()
181 eeprom_93cx6_startup(eeprom); in eeprom_93cx6_read()
186 command = (PCI_EEPROM_READ_OPCODE << eeprom->width) | word; in eeprom_93cx6_read()
187 eeprom_93cx6_write_bits(eeprom, command, in eeprom_93cx6_read()
188 PCI_EEPROM_WIDTH_OPCODE + eeprom->width); in eeprom_93cx6_read()
190 if (has_quirk_extra_read_cycle(eeprom)) { in eeprom_93cx6_read()
191 eeprom_93cx6_pulse_high(eeprom); in eeprom_93cx6_read()
192 eeprom_93cx6_pulse_low(eeprom); in eeprom_93cx6_read()
198 eeprom_93cx6_read_bits(eeprom, data, 16); in eeprom_93cx6_read()
201 * Cleanup eeprom register. in eeprom_93cx6_read()
203 eeprom_93cx6_cleanup(eeprom); in eeprom_93cx6_read()
208 * eeprom_93cx6_multiread - Read multiple words from eeprom
209 * @eeprom: Pointer to eeprom structure
214 * This function will read all requested words from the eeprom,
220 void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, const u8 word, in eeprom_93cx6_multiread() argument
228 eeprom_93cx6_read(eeprom, word + i, &tmp); in eeprom_93cx6_multiread()
235 * eeprom_93cx6_readb - Read a byte from eeprom
236 * @eeprom: Pointer to eeprom structure
240 * This function will read a byte of the eeprom data
243 void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom, const u8 byte, in eeprom_93cx6_readb() argument
250 * Initialize the eeprom register in eeprom_93cx6_readb()
252 eeprom_93cx6_startup(eeprom); in eeprom_93cx6_readb()
257 command = (PCI_EEPROM_READ_OPCODE << (eeprom->width + 1)) | byte; in eeprom_93cx6_readb()
258 eeprom_93cx6_write_bits(eeprom, command, in eeprom_93cx6_readb()
259 PCI_EEPROM_WIDTH_OPCODE + eeprom->width + 1); in eeprom_93cx6_readb()
261 if (has_quirk_extra_read_cycle(eeprom)) { in eeprom_93cx6_readb()
262 eeprom_93cx6_pulse_high(eeprom); in eeprom_93cx6_readb()
263 eeprom_93cx6_pulse_low(eeprom); in eeprom_93cx6_readb()
269 eeprom_93cx6_read_bits(eeprom, &tmp, 8); in eeprom_93cx6_readb()
273 * Cleanup eeprom register. in eeprom_93cx6_readb()
275 eeprom_93cx6_cleanup(eeprom); in eeprom_93cx6_readb()
280 * eeprom_93cx6_multireadb - Read multiple bytes from eeprom
281 * @eeprom: Pointer to eeprom structure
286 * This function will read all requested bytes from the eeprom,
289 void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom, const u8 byte, in eeprom_93cx6_multireadb() argument
295 eeprom_93cx6_readb(eeprom, byte + i, &data[i]); in eeprom_93cx6_multireadb()
301 * @eeprom: Pointer to eeprom structure
304 * Set the EEPROM write enable state to either allow or deny
307 void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable) in eeprom_93cx6_wren() argument
312 eeprom_93cx6_startup(eeprom); in eeprom_93cx6_wren()
317 command <<= (eeprom->width - 2); in eeprom_93cx6_wren()
319 eeprom_93cx6_write_bits(eeprom, command, in eeprom_93cx6_wren()
320 PCI_EEPROM_WIDTH_OPCODE + eeprom->width); in eeprom_93cx6_wren()
322 eeprom_93cx6_cleanup(eeprom); in eeprom_93cx6_wren()
327 * eeprom_93cx6_write - write data to the EEPROM
328 * @eeprom: Pointer to eeprom structure
332 * Write the @data to the specified @addr in the EEPROM and
339 void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom, u8 addr, u16 data) in eeprom_93cx6_write() argument
345 eeprom_93cx6_startup(eeprom); in eeprom_93cx6_write()
347 command = PCI_EEPROM_WRITE_OPCODE << eeprom->width; in eeprom_93cx6_write()
351 eeprom_93cx6_write_bits(eeprom, command, in eeprom_93cx6_write()
352 PCI_EEPROM_WIDTH_OPCODE + eeprom->width); in eeprom_93cx6_write()
355 eeprom_93cx6_write_bits(eeprom, data, 16); in eeprom_93cx6_write()
358 eeprom->drive_data = 0; in eeprom_93cx6_write()
359 eeprom->reg_chip_select = 1; in eeprom_93cx6_write()
360 eeprom->register_write(eeprom); in eeprom_93cx6_write()
368 eeprom->register_read(eeprom); in eeprom_93cx6_write()
370 if (eeprom->reg_data_out) in eeprom_93cx6_write()
381 eeprom_93cx6_cleanup(eeprom); in eeprom_93cx6_write()