1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun Copyright (C) 2004 - 2006 rt2x00 SourceForge Project 4*4882a593Smuzhiyun <http://rt2x00.serialmonkey.com> 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun */ 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun /* 9*4882a593Smuzhiyun Module: eeprom_93cx6 10*4882a593Smuzhiyun Abstract: EEPROM reader datastructures for 93cx6 chipsets. 11*4882a593Smuzhiyun Supported chipsets: 93c46, 93c56 and 93c66. 12*4882a593Smuzhiyun */ 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun /* 15*4882a593Smuzhiyun * EEPROM operation defines. 16*4882a593Smuzhiyun */ 17*4882a593Smuzhiyun #define PCI_EEPROM_WIDTH_93C46 6 18*4882a593Smuzhiyun #define PCI_EEPROM_WIDTH_93C56 8 19*4882a593Smuzhiyun #define PCI_EEPROM_WIDTH_93C66 8 20*4882a593Smuzhiyun #define PCI_EEPROM_WIDTH_93C86 8 21*4882a593Smuzhiyun #define PCI_EEPROM_WIDTH_OPCODE 3 22*4882a593Smuzhiyun #define PCI_EEPROM_WRITE_OPCODE 0x05 23*4882a593Smuzhiyun #define PCI_EEPROM_ERASE_OPCODE 0x07 24*4882a593Smuzhiyun #define PCI_EEPROM_READ_OPCODE 0x06 25*4882a593Smuzhiyun #define PCI_EEPROM_EWDS_OPCODE 0x10 26*4882a593Smuzhiyun #define PCI_EEPROM_EWEN_OPCODE 0x13 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun /** 29*4882a593Smuzhiyun * struct eeprom_93cx6 - control structure for setting the commands 30*4882a593Smuzhiyun * for reading the eeprom data. 31*4882a593Smuzhiyun * @data: private pointer for the driver. 32*4882a593Smuzhiyun * @register_read(struct eeprom_93cx6 *eeprom): handler to 33*4882a593Smuzhiyun * read the eeprom register, this function should set all reg_* fields. 34*4882a593Smuzhiyun * @register_write(struct eeprom_93cx6 *eeprom): handler to 35*4882a593Smuzhiyun * write to the eeprom register by using all reg_* fields. 36*4882a593Smuzhiyun * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines 37*4882a593Smuzhiyun * @drive_data: Set if we're driving the data line. 38*4882a593Smuzhiyun * @reg_data_in: register field to indicate data input 39*4882a593Smuzhiyun * @reg_data_out: register field to indicate data output 40*4882a593Smuzhiyun * @reg_data_clock: register field to set the data clock 41*4882a593Smuzhiyun * @reg_chip_select: register field to set the chip select 42*4882a593Smuzhiyun * 43*4882a593Smuzhiyun * This structure is used for the communication between the driver 44*4882a593Smuzhiyun * and the eeprom_93cx6 handlers for reading the eeprom. 45*4882a593Smuzhiyun */ 46*4882a593Smuzhiyun struct eeprom_93cx6 { 47*4882a593Smuzhiyun void *data; 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun void (*register_read)(struct eeprom_93cx6 *eeprom); 50*4882a593Smuzhiyun void (*register_write)(struct eeprom_93cx6 *eeprom); 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun int width; 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun char drive_data; 55*4882a593Smuzhiyun char reg_data_in; 56*4882a593Smuzhiyun char reg_data_out; 57*4882a593Smuzhiyun char reg_data_clock; 58*4882a593Smuzhiyun char reg_chip_select; 59*4882a593Smuzhiyun }; 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, 62*4882a593Smuzhiyun const u8 word, u16 *data); 63*4882a593Smuzhiyun extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, 64*4882a593Smuzhiyun const u8 word, __le16 *data, const u16 words); 65*4882a593Smuzhiyun extern void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom, 66*4882a593Smuzhiyun const u8 byte, u8 *data); 67*4882a593Smuzhiyun extern void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom, 68*4882a593Smuzhiyun const u8 byte, u8 *data, const u16 bytes); 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable); 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom, 73*4882a593Smuzhiyun u8 addr, u16 data); 74