20 #include <linux/kernel.h>
21 #include <linux/module.h>
43 static inline void eeprom_93cx6_pulse_low(
struct eeprom_93cx6 *eeprom)
56 static void eeprom_93cx6_startup(
struct eeprom_93cx6 *eeprom)
72 eeprom_93cx6_pulse_high(eeprom);
73 eeprom_93cx6_pulse_low(eeprom);
76 static void eeprom_93cx6_cleanup(
struct eeprom_93cx6 *eeprom)
89 eeprom_93cx6_pulse_high(eeprom);
90 eeprom_93cx6_pulse_low(eeprom);
93 static void eeprom_93cx6_write_bits(
struct eeprom_93cx6 *eeprom,
110 for (i = count; i > 0; i--) {
124 eeprom_93cx6_pulse_high(eeprom);
125 eeprom_93cx6_pulse_low(eeprom);
132 static void eeprom_93cx6_read_bits(
struct eeprom_93cx6 *eeprom,
133 u16 *data,
const u16 count)
150 for (i = count; i > 0; i--) {
151 eeprom_93cx6_pulse_high(eeprom);
164 buf |= (1 << (i - 1));
166 eeprom_93cx6_pulse_low(eeprom);
189 eeprom_93cx6_startup(eeprom);
195 eeprom_93cx6_write_bits(eeprom, command,
201 eeprom_93cx6_read_bits(eeprom, data, 16);
206 eeprom_93cx6_cleanup(eeprom);
229 for (i = 0; i < words; i++) {
250 eeprom_93cx6_startup(eeprom);
255 command <<= (eeprom->
width - 2);
257 eeprom_93cx6_write_bits(eeprom, command,
260 eeprom_93cx6_cleanup(eeprom);
283 eeprom_93cx6_startup(eeprom);
289 eeprom_93cx6_write_bits(eeprom, command,
293 eeprom_93cx6_write_bits(eeprom, data, 16);
313 if (--timeout <= 0) {
319 eeprom_93cx6_cleanup(eeprom);