eeprom_93cx6.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. Copyright (C) 2004 - 2006 rt2x00 SourceForge Project
  3. <http://rt2x00.serialmonkey.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the
  14. Free Software Foundation, Inc.,
  15. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  16. */
  17. /*
  18. Module: eeprom_93cx6
  19. Abstract: EEPROM reader datastructures for 93cx6 chipsets.
  20. Supported chipsets: 93c46, 93c56 and 93c66.
  21. */
  22. /*
  23. * EEPROM operation defines.
  24. */
  25. #define PCI_EEPROM_WIDTH_93C46 6
  26. #define PCI_EEPROM_WIDTH_93C56 8
  27. #define PCI_EEPROM_WIDTH_93C66 8
  28. #define PCI_EEPROM_WIDTH_93C86 8
  29. #define PCI_EEPROM_WIDTH_OPCODE 3
  30. #define PCI_EEPROM_WRITE_OPCODE 0x05
  31. #define PCI_EEPROM_ERASE_OPCODE 0x07
  32. #define PCI_EEPROM_READ_OPCODE 0x06
  33. #define PCI_EEPROM_EWDS_OPCODE 0x10
  34. #define PCI_EEPROM_EWEN_OPCODE 0x13
  35. /**
  36. * struct eeprom_93cx6 - control structure for setting the commands
  37. * for reading the eeprom data.
  38. * @data: private pointer for the driver.
  39. * @register_read(struct eeprom_93cx6 *eeprom): handler to
  40. * read the eeprom register, this function should set all reg_* fields.
  41. * @register_write(struct eeprom_93cx6 *eeprom): handler to
  42. * write to the eeprom register by using all reg_* fields.
  43. * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines
  44. * @drive_data: Set if we're driving the data line.
  45. * @reg_data_in: register field to indicate data input
  46. * @reg_data_out: register field to indicate data output
  47. * @reg_data_clock: register field to set the data clock
  48. * @reg_chip_select: register field to set the chip select
  49. *
  50. * This structure is used for the communication between the driver
  51. * and the eeprom_93cx6 handlers for reading the eeprom.
  52. */
  53. struct eeprom_93cx6 {
  54. void *data;
  55. void (*register_read)(struct eeprom_93cx6 *eeprom);
  56. void (*register_write)(struct eeprom_93cx6 *eeprom);
  57. int width;
  58. char drive_data;
  59. char reg_data_in;
  60. char reg_data_out;
  61. char reg_data_clock;
  62. char reg_chip_select;
  63. };
  64. extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom,
  65. const u8 word, u16 *data);
  66. extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom,
  67. const u8 word, __le16 *data, const u16 words);
  68. extern void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom,
  69. const u8 byte, u8 *data);
  70. extern void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom,
  71. const u8 byte, u8 *data, const u16 bytes);
  72. extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);
  73. extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom,
  74. u8 addr, u16 data);