rtw_eeprom.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2017 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. *****************************************************************************/
  15. #ifndef __RTW_EEPROM_H__
  16. #define __RTW_EEPROM_H__
  17. #define RTL8712_EEPROM_ID 0x8712
  18. /* #define EEPROM_MAX_SIZE 256 */
  19. #define HWSET_MAX_SIZE_128 128
  20. #define HWSET_MAX_SIZE_256 256
  21. #define HWSET_MAX_SIZE_512 512
  22. #define HWSET_MAX_SIZE_1024 1024
  23. #define EEPROM_MAX_SIZE HWSET_MAX_SIZE_1024
  24. #define CLOCK_RATE 50 /* 100us */
  25. /* - EEPROM opcodes */
  26. #define EEPROM_READ_OPCODE 06
  27. #define EEPROM_WRITE_OPCODE 05
  28. #define EEPROM_ERASE_OPCODE 07
  29. #define EEPROM_EWEN_OPCODE 19 /* Erase/write enable */
  30. #define EEPROM_EWDS_OPCODE 16 /* Erase/write disable */
  31. /* Country codes */
  32. #define USA 0x555320
  33. #define EUROPE 0x1 /* temp, should be provided later */
  34. #define JAPAN 0x2 /* temp, should be provided later */
  35. /*
  36. * Customer ID, note that:
  37. * This variable is initiailzed through EEPROM or registry,
  38. * however, its definition may be different with that in EEPROM for
  39. * EEPROM size consideration. So, we have to perform proper translation between them.
  40. * Besides, CustomerID of registry has precedence of that of EEPROM.
  41. * defined below. 060703, by rcnjko.
  42. * */
  43. typedef enum _RT_CUSTOMER_ID {
  44. RT_CID_DEFAULT = 0,
  45. RT_CID_8187_ALPHA0 = 1,
  46. RT_CID_8187_SERCOMM_PS = 2,
  47. RT_CID_8187_HW_LED = 3,
  48. RT_CID_8187_NETGEAR = 4,
  49. RT_CID_WHQL = 5,
  50. RT_CID_819x_CAMEO = 6,
  51. RT_CID_819x_RUNTOP = 7,
  52. RT_CID_819x_Senao = 8,
  53. RT_CID_TOSHIBA = 9, /* Merge by Jacken, 2008/01/31. */
  54. RT_CID_819x_Netcore = 10,
  55. RT_CID_Nettronix = 11,
  56. RT_CID_DLINK = 12,
  57. RT_CID_PRONET = 13,
  58. RT_CID_COREGA = 14,
  59. RT_CID_CHINA_MOBILE = 15,
  60. RT_CID_819x_ALPHA = 16,
  61. RT_CID_819x_Sitecom = 17,
  62. RT_CID_CCX = 18, /* It's set under CCX logo test and isn't demanded for CCX functions, but for test behavior like retry limit and tx report. By Bruce, 2009-02-17. */
  63. RT_CID_819X_LENOVO = 19,
  64. RT_CID_819x_QMI = 20,
  65. RT_CID_819x_Edimax_Belkin = 21,
  66. RT_CID_819x_Sercomm_Belkin = 22,
  67. RT_CID_819x_CAMEO1 = 23,
  68. RT_CID_819x_MSI = 24,
  69. RT_CID_819X_ACER = 25,
  70. RT_CID_819x_AzWave_ASUS = 26,
  71. RT_CID_819x_AzWave = 27, /* For AzWave in PCIe, The ID is AzWave use and not only Asus */
  72. RT_CID_819x_HP = 28,
  73. RT_CID_819x_WNC_COREGA = 29,
  74. RT_CID_819x_Arcadyan_Belkin = 30,
  75. RT_CID_819x_SAMSUNG = 31,
  76. RT_CID_819x_CLEVO = 32,
  77. RT_CID_819x_DELL = 33,
  78. RT_CID_819x_PRONETS = 34,
  79. RT_CID_819x_Edimax_ASUS = 35,
  80. RT_CID_NETGEAR = 36,
  81. RT_CID_PLANEX = 37,
  82. RT_CID_CC_C = 38,
  83. RT_CID_819x_Xavi = 39,
  84. RT_CID_LENOVO_CHINA = 40,
  85. RT_CID_INTEL_CHINA = 41,
  86. RT_CID_TPLINK_HPWR = 42,
  87. RT_CID_819x_Sercomm_Netgear = 43,
  88. RT_CID_819x_ALPHA_Dlink = 44,/* add by ylb 20121012 for customer led for alpha */
  89. RT_CID_WNC_NEC = 45,/* add by page for NEC */
  90. RT_CID_DNI_BUFFALO = 46,/* add by page for NEC */
  91. } RT_CUSTOMER_ID, *PRT_CUSTOMER_ID;
  92. extern void eeprom_write16(_adapter *padapter, u16 reg, u16 data);
  93. extern u16 eeprom_read16(_adapter *padapter, u16 reg);
  94. extern void read_eeprom_content(_adapter *padapter);
  95. extern void eeprom_read_sz(_adapter *padapter, u16 reg, u8 *data, u32 sz);
  96. extern void read_eeprom_content_by_attrib(_adapter *padapter);
  97. #ifdef PLATFORM_LINUX
  98. #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
  99. extern int isAdaptorInfoFileValid(void);
  100. extern int storeAdaptorInfoFile(char *path, u8 *efuse_data);
  101. extern int retriveAdaptorInfoFile(char *path, u8 *efuse_data);
  102. #endif /* CONFIG_ADAPTOR_INFO_CACHING_FILE */
  103. #endif /* PLATFORM_LINUX */
  104. #endif /* __RTL871X_EEPROM_H__ */