Lines Matching defs:eeprom

21 static inline void eeprom_93cx6_pulse_high(struct eeprom_93cx6 *eeprom)
23 eeprom->reg_data_clock = 1;
24 eeprom->register_write(eeprom);
34 static inline void eeprom_93cx6_pulse_low(struct eeprom_93cx6 *eeprom)
36 eeprom->reg_data_clock = 0;
37 eeprom->register_write(eeprom);
47 static void eeprom_93cx6_startup(struct eeprom_93cx6 *eeprom)
52 eeprom->register_read(eeprom);
53 eeprom->reg_data_in = 0;
54 eeprom->reg_data_out = 0;
55 eeprom->reg_data_clock = 0;
56 eeprom->reg_chip_select = 1;
57 eeprom->drive_data = 1;
58 eeprom->register_write(eeprom);
63 eeprom_93cx6_pulse_high(eeprom);
64 eeprom_93cx6_pulse_low(eeprom);
67 static void eeprom_93cx6_cleanup(struct eeprom_93cx6 *eeprom)
72 eeprom->register_read(eeprom);
73 eeprom->reg_data_in = 0;
74 eeprom->reg_chip_select = 0;
75 eeprom->register_write(eeprom);
80 eeprom_93cx6_pulse_high(eeprom);
81 eeprom_93cx6_pulse_low(eeprom);
84 static void eeprom_93cx6_write_bits(struct eeprom_93cx6 *eeprom,
89 eeprom->register_read(eeprom);
94 eeprom->reg_data_in = 0;
95 eeprom->reg_data_out = 0;
96 eeprom->drive_data = 1;
105 eeprom->reg_data_in = !!(data & (1 << (i - 1)));
108 * Write the bit to the eeprom register.
110 eeprom->register_write(eeprom);
115 eeprom_93cx6_pulse_high(eeprom);
116 eeprom_93cx6_pulse_low(eeprom);
119 eeprom->reg_data_in = 0;
120 eeprom->register_write(eeprom);
123 static void eeprom_93cx6_read_bits(struct eeprom_93cx6 *eeprom,
129 eeprom->register_read(eeprom);
134 eeprom->reg_data_in = 0;
135 eeprom->reg_data_out = 0;
136 eeprom->drive_data = 0;
142 eeprom_93cx6_pulse_high(eeprom);
144 eeprom->register_read(eeprom);
149 eeprom->reg_data_in = 0;
154 if (eeprom->reg_data_out)
157 eeprom_93cx6_pulse_low(eeprom);
164 * eeprom_93cx6_read - Read a word from eeprom
165 * @eeprom: Pointer to eeprom structure
169 * This function will read the eeprom data as host-endian word
172 void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, const u8 word,
178 * Initialize the eeprom register
180 eeprom_93cx6_startup(eeprom);
185 command = (PCI_EEPROM_READ_OPCODE << eeprom->width) | word;
186 eeprom_93cx6_write_bits(eeprom, command,
187 PCI_EEPROM_WIDTH_OPCODE + eeprom->width);
192 eeprom_93cx6_read_bits(eeprom, data, 16);
195 * Cleanup eeprom register.
197 eeprom_93cx6_cleanup(eeprom);
202 * eeprom_93cx6_multiread - Read multiple words from eeprom
203 * @eeprom: Pointer to eeprom structure
208 * This function will read all requested words from the eeprom,
214 void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, const u8 word,
222 eeprom_93cx6_read(eeprom, word + i, &tmp);
229 * eeprom_93cx6_readb - Read a byte from eeprom
230 * @eeprom: Pointer to eeprom structure
234 * This function will read a byte of the eeprom data
237 void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom, const u8 byte,
244 * Initialize the eeprom register
246 eeprom_93cx6_startup(eeprom);
251 command = (PCI_EEPROM_READ_OPCODE << (eeprom->width + 1)) | byte;
252 eeprom_93cx6_write_bits(eeprom, command,
253 PCI_EEPROM_WIDTH_OPCODE + eeprom->width + 1);
258 eeprom_93cx6_read_bits(eeprom, &tmp, 8);
262 * Cleanup eeprom register.
264 eeprom_93cx6_cleanup(eeprom);
269 * eeprom_93cx6_multireadb - Read multiple bytes from eeprom
270 * @eeprom: Pointer to eeprom structure
275 * This function will read all requested bytes from the eeprom,
278 void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom, const u8 byte,
284 eeprom_93cx6_readb(eeprom, byte + i, &data[i]);
290 * @eeprom: Pointer to eeprom structure
296 void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable)
301 eeprom_93cx6_startup(eeprom);
306 command <<= (eeprom->width - 2);
308 eeprom_93cx6_write_bits(eeprom, command,
309 PCI_EEPROM_WIDTH_OPCODE + eeprom->width);
311 eeprom_93cx6_cleanup(eeprom);
317 * @eeprom: Pointer to eeprom structure
328 void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom, u8 addr, u16 data)
334 eeprom_93cx6_startup(eeprom);
336 command = PCI_EEPROM_WRITE_OPCODE << eeprom->width;
340 eeprom_93cx6_write_bits(eeprom, command,
341 PCI_EEPROM_WIDTH_OPCODE + eeprom->width);
344 eeprom_93cx6_write_bits(eeprom, data, 16);
347 eeprom->drive_data = 0;
348 eeprom->reg_chip_select = 1;
349 eeprom->register_write(eeprom);
357 eeprom->register_read(eeprom);
359 if (eeprom->reg_data_out)
370 eeprom_93cx6_cleanup(eeprom);