root/drivers/staging/rtl8188eu/include/rtw_efuse.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 /******************************************************************************
   3  *
   4  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
   5  *
   6  ******************************************************************************/
   7 #ifndef __RTW_EFUSE_H__
   8 #define __RTW_EFUSE_H__
   9 
  10 #include <osdep_service.h>
  11 
  12 #define EFUSE_ERROE_HANDLE              1
  13 
  14 #define PG_STATE_HEADER                 0x01
  15 #define PG_STATE_WORD_0         0x02
  16 #define PG_STATE_WORD_1         0x04
  17 #define PG_STATE_WORD_2         0x08
  18 #define PG_STATE_WORD_3         0x10
  19 #define PG_STATE_DATA                   0x20
  20 
  21 #define PG_SWBYTE_H                     0x01
  22 #define PG_SWBYTE_L                     0x02
  23 
  24 #define PGPKT_DATA_SIZE         8
  25 
  26 #define EFUSE_WIFI                              0
  27 #define EFUSE_BT                                1
  28 
  29 /* E-Fuse */
  30 #define EFUSE_MAP_SIZE      512
  31 #define EFUSE_MAX_SIZE      256
  32 /* end of E-Fuse */
  33 
  34 #define         EFUSE_MAX_MAP_LEN               512
  35 #define         EFUSE_MAX_HW_SIZE               512
  36 #define         EFUSE_MAX_SECTION_BASE  16
  37 
  38 #define EXT_HEADER(header) ((header & 0x1F) == 0x0F)
  39 #define ALL_WORDS_DISABLED(wde) ((wde & 0x0F) == 0x0F)
  40 #define GET_HDR_OFFSET_2_0(header) ((header & 0xE0) >> 5)
  41 
  42 #define         EFUSE_REPEAT_THRESHOLD_                 3
  43 
  44 /*      The following is for BT Efuse definition */
  45 #define         EFUSE_BT_MAX_MAP_LEN            1024
  46 #define         EFUSE_MAX_BANK                  4
  47 #define         EFUSE_MAX_BT_BANK               (EFUSE_MAX_BANK-1)
  48 /*--------------------------Define Parameters-------------------------------*/
  49 #define         EFUSE_MAX_WORD_UNIT                     4
  50 
  51 /*------------------------------Define structure----------------------------*/
  52 struct pgpkt {
  53         u8 offset;
  54         u8 word_en;
  55         u8 data[8];
  56         u8 word_cnts;
  57 };
  58 
  59 /*------------------------------Define structure----------------------------*/
  60 struct efuse_hal {
  61         u8 fakeEfuseBank;
  62         u32     fakeEfuseUsedBytes;
  63         u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE];
  64         u8 fakeEfuseInitMap[EFUSE_MAX_MAP_LEN];
  65         u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN];
  66 
  67         u16 BTEfuseUsedBytes;
  68         u8 BTEfuseUsedPercentage;
  69         u8 BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
  70         u8 BTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN];
  71         u8 BTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN];
  72 
  73         u16 fakeBTEfuseUsedBytes;
  74         u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
  75         u8 fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN];
  76         u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN];
  77 };
  78 
  79 u8 Efuse_CalculateWordCnts(u8 word_en);
  80 u8 efuse_OneByteRead(struct adapter *adapter, u16 addr, u8 *data);
  81 u8 efuse_OneByteWrite(struct adapter *adapter, u16 addr, u8 data);
  82 
  83 void efuse_ReadEFuse(struct adapter *Adapter, u8 efuseType, u16 _offset,
  84                 u16 _size_byte, u8 *pbuf);
  85 void efuse_power_switch(struct adapter *adapt, u8 write, u8  pwrstate);
  86 int Efuse_PgPacketRead(struct adapter *adapt, u8 offset, u8 *data);
  87 bool Efuse_PgPacketWrite(struct adapter *adapter, u8 offset, u8 word, u8 *data);
  88 void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata);
  89 u8 Efuse_WordEnableDataWrite(struct adapter *adapter, u16 efuse_addr,
  90                              u8 word_en, u8 *data);
  91 
  92 void EFUSE_ShadowMapUpdate(struct adapter *adapter, u8 efusetype);
  93 #endif

/* [<][>][^][v][top][bottom][index][help] */