Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003     Copyright (C) 2004 - 2006 rt2x00 SourceForge Project
0004     <http://rt2x00.serialmonkey.com>
0005 
0006  */
0007 
0008 /*
0009     Module: eeprom_93cx6
0010     Abstract: EEPROM reader datastructures for 93cx6 chipsets.
0011     Supported chipsets: 93c46, 93c56 and 93c66.
0012  */
0013 
0014 /*
0015  * EEPROM operation defines.
0016  */
0017 #define PCI_EEPROM_WIDTH_93C46  6
0018 #define PCI_EEPROM_WIDTH_93C56  8
0019 #define PCI_EEPROM_WIDTH_93C66  8
0020 #define PCI_EEPROM_WIDTH_93C86  8
0021 #define PCI_EEPROM_WIDTH_OPCODE 3
0022 #define PCI_EEPROM_WRITE_OPCODE 0x05
0023 #define PCI_EEPROM_ERASE_OPCODE 0x07
0024 #define PCI_EEPROM_READ_OPCODE  0x06
0025 #define PCI_EEPROM_EWDS_OPCODE  0x10
0026 #define PCI_EEPROM_EWEN_OPCODE  0x13
0027 
0028 /**
0029  * struct eeprom_93cx6 - control structure for setting the commands
0030  * for reading the eeprom data.
0031  * @data: private pointer for the driver.
0032  * @register_read(struct eeprom_93cx6 *eeprom): handler to
0033  * read the eeprom register, this function should set all reg_* fields.
0034  * @register_write(struct eeprom_93cx6 *eeprom): handler to
0035  * write to the eeprom register by using all reg_* fields.
0036  * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines
0037  * @drive_data: Set if we're driving the data line.
0038  * @reg_data_in: register field to indicate data input
0039  * @reg_data_out: register field to indicate data output
0040  * @reg_data_clock: register field to set the data clock
0041  * @reg_chip_select: register field to set the chip select
0042  *
0043  * This structure is used for the communication between the driver
0044  * and the eeprom_93cx6 handlers for reading the eeprom.
0045  */
0046 struct eeprom_93cx6 {
0047     void *data;
0048 
0049     void (*register_read)(struct eeprom_93cx6 *eeprom);
0050     void (*register_write)(struct eeprom_93cx6 *eeprom);
0051 
0052     int width;
0053 
0054     char drive_data;
0055     char reg_data_in;
0056     char reg_data_out;
0057     char reg_data_clock;
0058     char reg_chip_select;
0059 };
0060 
0061 extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom,
0062     const u8 word, u16 *data);
0063 extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom,
0064     const u8 word, __le16 *data, const u16 words);
0065 extern void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom,
0066     const u8 byte, u8 *data);
0067 extern void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom,
0068     const u8 byte, u8 *data, const u16 bytes);
0069 
0070 extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);
0071 
0072 extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom,
0073                    u8 addr, u16 data);