1*1a59d1b8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 29467d64bSIvo van Doorn /* 39467d64bSIvo van Doorn Copyright (C) 2004 - 2006 rt2x00 SourceForge Project 49467d64bSIvo van Doorn <http://rt2x00.serialmonkey.com> 59467d64bSIvo van Doorn 69467d64bSIvo van Doorn */ 79467d64bSIvo van Doorn 89467d64bSIvo van Doorn /* 99467d64bSIvo van Doorn Module: eeprom_93cx6 109467d64bSIvo van Doorn Abstract: EEPROM reader datastructures for 93cx6 chipsets. 1189e536a1SMagnus Damm Supported chipsets: 93c46, 93c56 and 93c66. 129467d64bSIvo van Doorn */ 139467d64bSIvo van Doorn 149467d64bSIvo van Doorn /* 159467d64bSIvo van Doorn * EEPROM operation defines. 169467d64bSIvo van Doorn */ 179467d64bSIvo van Doorn #define PCI_EEPROM_WIDTH_93C46 6 1889e536a1SMagnus Damm #define PCI_EEPROM_WIDTH_93C56 8 199467d64bSIvo van Doorn #define PCI_EEPROM_WIDTH_93C66 8 20afd2a5caSGertjan van Wingerde #define PCI_EEPROM_WIDTH_93C86 8 219467d64bSIvo van Doorn #define PCI_EEPROM_WIDTH_OPCODE 3 229467d64bSIvo van Doorn #define PCI_EEPROM_WRITE_OPCODE 0x05 23072bc801SBen Dooks #define PCI_EEPROM_ERASE_OPCODE 0x07 249467d64bSIvo van Doorn #define PCI_EEPROM_READ_OPCODE 0x06 259467d64bSIvo van Doorn #define PCI_EEPROM_EWDS_OPCODE 0x10 269467d64bSIvo van Doorn #define PCI_EEPROM_EWEN_OPCODE 0x13 279467d64bSIvo van Doorn 289467d64bSIvo van Doorn /** 299467d64bSIvo van Doorn * struct eeprom_93cx6 - control structure for setting the commands 309467d64bSIvo van Doorn * for reading the eeprom data. 319467d64bSIvo van Doorn * @data: private pointer for the driver. 329467d64bSIvo van Doorn * @register_read(struct eeprom_93cx6 *eeprom): handler to 339467d64bSIvo van Doorn * read the eeprom register, this function should set all reg_* fields. 349467d64bSIvo van Doorn * @register_write(struct eeprom_93cx6 *eeprom): handler to 359467d64bSIvo van Doorn * write to the eeprom register by using all reg_* fields. 369467d64bSIvo van Doorn * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines 37b30f8bdcSBen Dooks * @drive_data: Set if we're driving the data line. 389467d64bSIvo van Doorn * @reg_data_in: register field to indicate data input 399467d64bSIvo van Doorn * @reg_data_out: register field to indicate data output 409467d64bSIvo van Doorn * @reg_data_clock: register field to set the data clock 419467d64bSIvo van Doorn * @reg_chip_select: register field to set the chip select 429467d64bSIvo van Doorn * 439467d64bSIvo van Doorn * This structure is used for the communication between the driver 449467d64bSIvo van Doorn * and the eeprom_93cx6 handlers for reading the eeprom. 459467d64bSIvo van Doorn */ 469467d64bSIvo van Doorn struct eeprom_93cx6 { 479467d64bSIvo van Doorn void *data; 489467d64bSIvo van Doorn 499467d64bSIvo van Doorn void (*register_read)(struct eeprom_93cx6 *eeprom); 509467d64bSIvo van Doorn void (*register_write)(struct eeprom_93cx6 *eeprom); 519467d64bSIvo van Doorn 529467d64bSIvo van Doorn int width; 539467d64bSIvo van Doorn 54b30f8bdcSBen Dooks char drive_data; 559467d64bSIvo van Doorn char reg_data_in; 569467d64bSIvo van Doorn char reg_data_out; 579467d64bSIvo van Doorn char reg_data_clock; 589467d64bSIvo van Doorn char reg_chip_select; 599467d64bSIvo van Doorn }; 609467d64bSIvo van Doorn 619467d64bSIvo van Doorn extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, 629467d64bSIvo van Doorn const u8 word, u16 *data); 639467d64bSIvo van Doorn extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, 649467d64bSIvo van Doorn const u8 word, __le16 *data, const u16 words); 657ff28aeeSOndrej Zary extern void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom, 667ff28aeeSOndrej Zary const u8 byte, u8 *data); 677ff28aeeSOndrej Zary extern void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom, 687ff28aeeSOndrej Zary const u8 byte, u8 *data, const u16 bytes); 69072bc801SBen Dooks 70072bc801SBen Dooks extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable); 71072bc801SBen Dooks 72072bc801SBen Dooks extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom, 73072bc801SBen Dooks u8 addr, u16 data); 74