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