// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2004 - 2006 rt2x00 SourceForge Project * <http://rt2x00.serialmonkey.com> * * Module: eeprom_93cx6 * Abstract: EEPROM reader routines for 93cx6 chipsets. * Supported chipsets: 93c46 & 93c66. */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/eeprom_93cx6.h> MODULE_AUTHOR(…) …; MODULE_VERSION(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; static inline void eeprom_93cx6_pulse_high(struct eeprom_93cx6 *eeprom) { … } static inline void eeprom_93cx6_pulse_low(struct eeprom_93cx6 *eeprom) { … } static void eeprom_93cx6_startup(struct eeprom_93cx6 *eeprom) { … } static void eeprom_93cx6_cleanup(struct eeprom_93cx6 *eeprom) { … } static void eeprom_93cx6_write_bits(struct eeprom_93cx6 *eeprom, const u16 data, const u16 count) { … } static void eeprom_93cx6_read_bits(struct eeprom_93cx6 *eeprom, u16 *data, const u16 count) { … } /** * eeprom_93cx6_read - Read a word from eeprom * @eeprom: Pointer to eeprom structure * @word: Word index from where we should start reading * @data: target pointer where the information will have to be stored * * This function will read the eeprom data as host-endian word * into the given data pointer. */ void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, const u8 word, u16 *data) { … } EXPORT_SYMBOL_GPL(…); /** * eeprom_93cx6_multiread - Read multiple words from eeprom * @eeprom: Pointer to eeprom structure * @word: Word index from where we should start reading * @data: target pointer where the information will have to be stored * @words: Number of words that should be read. * * This function will read all requested words from the eeprom, * this is done by calling eeprom_93cx6_read() multiple times. * But with the additional change that while the eeprom_93cx6_read * will return host ordered bytes, this method will return little * endian words. */ void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, const u8 word, __le16 *data, const u16 words) { … } EXPORT_SYMBOL_GPL(…); /** * eeprom_93cx6_readb - Read a byte from eeprom * @eeprom: Pointer to eeprom structure * @byte: Byte index from where we should start reading * @data: target pointer where the information will have to be stored * * This function will read a byte of the eeprom data * into the given data pointer. */ void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom, const u8 byte, u8 *data) { … } EXPORT_SYMBOL_GPL(…); /** * eeprom_93cx6_multireadb - Read multiple bytes from eeprom * @eeprom: Pointer to eeprom structure * @byte: Index from where we should start reading * @data: target pointer where the information will have to be stored * @bytes: Number of bytes that should be read. * * This function will read all requested bytes from the eeprom, * this is done by calling eeprom_93cx6_readb() multiple times. */ void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom, const u8 byte, u8 *data, const u16 bytes) { … } EXPORT_SYMBOL_GPL(…); /** * eeprom_93cx6_wren - set the write enable state * @eeprom: Pointer to eeprom structure * @enable: true to enable writes, otherwise disable writes * * Set the EEPROM write enable state to either allow or deny * writes depending on the @enable value. */ void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable) { … } EXPORT_SYMBOL_GPL(…); /** * eeprom_93cx6_write - write data to the EEPROM * @eeprom: Pointer to eeprom structure * @addr: Address to write data to. * @data: The data to write to address @addr. * * Write the @data to the specified @addr in the EEPROM and * waiting for the device to finish writing. * * Note, since we do not expect large number of write operations * we delay in between parts of the operation to avoid using excessive * amounts of CPU time busy waiting. */ void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom, u8 addr, u16 data) { … } EXPORT_SYMBOL_GPL(…);