eeprom_93cx6.h 2.3 KB

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