1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 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 * You should have received a copy of the GNU General Public License along with 15 * this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 17 * 18 * 19 ******************************************************************************/ 20 #ifndef __RTW_EEPROM_H__ 21 #define __RTW_EEPROM_H__ 22 23 #include <osdep_service.h> 24 #include <drv_types.h> 25 26 #define RTL8712_EEPROM_ID 0x8712 27 28 #define HWSET_MAX_SIZE_512 512 29 #define EEPROM_MAX_SIZE HWSET_MAX_SIZE_512 30 31 #define CLOCK_RATE 50 /* 100us */ 32 33 /* EEPROM opcodes */ 34 #define EEPROM_READ_OPCODE 06 35 #define EEPROM_WRITE_OPCODE 05 36 #define EEPROM_ERASE_OPCODE 07 37 #define EEPROM_EWEN_OPCODE 19 /* Erase/write enable */ 38 #define EEPROM_EWDS_OPCODE 16 /* Erase/write disable */ 39 40 /* Country codes */ 41 #define USA 0x555320 42 #define EUROPE 0x1 /* temp, should be provided later */ 43 #define JAPAN 0x2 /* temp, should be provided later */ 44 45 #define EEPROM_CID_DEFAULT 0x0 46 #define EEPROM_CID_ALPHA 0x1 47 #define EEPROM_CID_Senao 0x3 48 #define EEPROM_CID_NetCore 0x5 49 #define EEPROM_CID_CAMEO 0X8 50 #define EEPROM_CID_SITECOM 0x9 51 #define EEPROM_CID_COREGA 0xB 52 #define EEPROM_CID_EDIMAX_BELK 0xC 53 #define EEPROM_CID_SERCOMM_BELK 0xE 54 #define EEPROM_CID_CAMEO1 0xF 55 #define EEPROM_CID_WNC_COREGA 0x12 56 #define EEPROM_CID_CLEVO 0x13 57 #define EEPROM_CID_WHQL 0xFE 58 59 /* Customer ID, note that: */ 60 /* This variable is initiailzed through EEPROM or registry, */ 61 /* however, its definition may be different with that in EEPROM for */ 62 /* EEPROM size consideration. So, we have to perform proper translation 63 * between them. */ 64 /* Besides, CustomerID of registry has precedence of that of EEPROM. */ 65 /* defined below. 060703, by rcnjko. */ 66 enum RT_CUSTOMER_ID { 67 RT_CID_DEFAULT = 0, 68 RT_CID_8187_ALPHA0 = 1, 69 RT_CID_8187_SERCOMM_PS = 2, 70 RT_CID_8187_HW_LED = 3, 71 RT_CID_8187_NETGEAR = 4, 72 RT_CID_WHQL = 5, 73 RT_CID_819x_CAMEO = 6, 74 RT_CID_819x_RUNTOP = 7, 75 RT_CID_819x_Senao = 8, 76 RT_CID_TOSHIBA = 9, /* Merge by Jacken, 2008/01/31. */ 77 RT_CID_819x_Netcore = 10, 78 RT_CID_Nettronix = 11, 79 RT_CID_DLINK = 12, 80 RT_CID_PRONET = 13, 81 RT_CID_COREGA = 14, 82 RT_CID_CHINA_MOBILE = 15, 83 RT_CID_819x_ALPHA = 16, 84 RT_CID_819x_Sitecom = 17, 85 RT_CID_CCX = 18, /* It's set under CCX logo test and isn't demanded 86 * for CCX functions, but for test behavior like retry 87 * limit and tx report. By Bruce, 2009-02-17. */ 88 RT_CID_819x_Lenovo = 19, 89 RT_CID_819x_QMI = 20, 90 RT_CID_819x_Edimax_Belkin = 21, 91 RT_CID_819x_Sercomm_Belkin = 22, 92 RT_CID_819x_CAMEO1 = 23, 93 RT_CID_819x_MSI = 24, 94 RT_CID_819x_Acer = 25, 95 RT_CID_819x_AzWave_ASUS = 26, 96 RT_CID_819x_AzWave = 27, /* For AzWave in PCIe,i 97 * The ID is AzWave use and not only Asus */ 98 RT_CID_819x_HP = 28, 99 RT_CID_819x_WNC_COREGA = 29, 100 RT_CID_819x_Arcadyan_Belkin = 30, 101 RT_CID_819x_SAMSUNG = 31, 102 RT_CID_819x_CLEVO = 32, 103 RT_CID_819x_DELL = 33, 104 RT_CID_819x_PRONETS = 34, 105 RT_CID_819x_Edimax_ASUS = 35, 106 RT_CID_819x_CAMEO_NETGEAR = 36, 107 RT_CID_PLANEX = 37, 108 RT_CID_CC_C = 38, 109 RT_CID_819x_Xavi = 39, 110 RT_CID_819x_FUNAI_TV = 40, 111 RT_CID_819x_ALPHA_WD = 41, 112 }; 113 114 struct eeprom_priv { 115 u8 bautoload_fail_flag; 116 u8 bloadfile_fail_flag; 117 u8 bloadmac_fail_flag; 118 u8 mac_addr[6]; /* PermanentAddress */ 119 u16 channel_plan; 120 u8 EepromOrEfuse; 121 u8 efuse_eeprom_data[HWSET_MAX_SIZE_512]; 122 }; 123 124 void eeprom_write16(struct adapter *padapter, u16 reg, u16 data); 125 u16 eeprom_read16(struct adapter *padapter, u16 reg); 126 void read_eeprom_content(struct adapter *padapter); 127 void eeprom_read_sz(struct adapter *adapt, u16 reg, u8 *data, u32 sz); 128 void read_eeprom_content_by_attrib(struct adapter *padapter); 129 130 #endif /* __RTL871X_EEPROM_H__ */ 131